Skip to content

chore: neutral examples and no hard-coded infrastructure defaults - #156

Merged
igorls merged 2 commits into
mainfrom
chore/neutral-docs
Oct 12, 2026
Merged

igorls merged 2 commits into
mainfrom
chore/neutral-docs

Conversation

@igorls

@igorls igorls commented Oct 11, 2026

Copy link
Copy Markdown
Owner

Remove application-specific examples and hard-coded infrastructure defaults; use neutral examples; require an explicit seed for invite.

Behavior changes

  • meshguard invite now requires --seed <host:port>. Without it the command exits with error: invite requires --seed <host:port> and a usage line. There is no built-in seed address any more. The default agent label is now agent.
  • meshguard join <token> rejects a token that carries no seed (error: invite token has no seed address) instead of falling back to a built-in address.
  • CLI help and docs/reference/cli.md (new invite / join sections) describe both.

Renames (no wire change)

  • discovery.Lan.APP_ID_DEFAULT replaces the previous app-specific constant name. The value stays 0x5043, so LAN beacons remain compatible.
  • protocol.app_channel.EXAMPLE_CHANNEL ("example-v1") replaces the previous example channel constant, which was only used by tests. Test channel names are neutral (example-v1, example-files).

Other

  • FFI doc example uses relay.example.org:51821.
  • tests/wasm/serve.mjs: the proof page's CSP allows loopback WebSocket origins by default; MESHGUARD_WEB_PROOF_CONNECT_SRC (space-separated ws(s):// origins, validated) adds a gateway origin. Documented in docs/reference/wasm-core.md.
  • test_connect.sh reads the remote host from MESHGUARD_REMOTE.
  • Removed two stale per-machine Android libc files at the repository root; scripts/build-libraries.sh generates its own.
  • WASM workflow: pull-request trigger is main only.
  • Docs: the browser relay qualification is described generically (same results and counts, no device, app, host or run details), its evidence files are removed, and a design note unrelated to MeshGuard itself is deleted. Example organization (acme) and channel names are generic. CHANGELOG Unreleased updated.

Tests

  • Windows: zig build, zig build test (517/519, 2 skipped), zig build wasm wasm-test, python scripts/test-control-startup.py (11 tests, 1 skipped), bun test tests/web (36 pass, 2 skip), docs build.
  • Linux (WSL): zig build test -Dno-sodium=true (533/535, 2 skipped).
  • Manual: invite without --seed, with a dangling --seed, and join with a seedless token all exit 1 with the messages above; invite --seed relay.example.org:51821 prints a token.

Remove application-specific examples and hard-coded infrastructure
defaults from source, tests, CI and docs.

- invite now requires --seed <host:port> and the default agent label is
  "agent"; join rejects a token without a seed instead of falling back
  to a built-in address. CLI help and docs/reference/cli.md describe both.
- LAN discovery: the default app ID constant is APP_ID_DEFAULT; its
  value (0x5043) is unchanged, so beacons stay compatible.
- Application channels: the example channel constant is EXAMPLE_CHANNEL
  ("example-v1"); test channels use neutral names.
- FFI doc example uses relay.example.org.
- The WASM proof server allows loopback WebSocket origins by default;
  MESHGUARD_WEB_PROOF_CONNECT_SRC adds gateway origins.
- test_connect.sh takes the remote host from MESHGUARD_REMOTE.
- Drop stale per-machine Android libc files (build-libraries.sh
  generates its own) and the WASM workflow's extra branch filter.
- Docs: generic example organization and channel names; the browser
  relay qualification is described without device, app or host details,
  and its evidence files and an unrelated design note are removed.
Copilot AI balanced review requested due to automatic review settings October 11, 2026 23:53

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Hostname invite seeds cannot bootstrap joins, and CSP validation permits unrestricted wildcard origins.

2 open findings
What changed in this PR

Removes application-specific examples and infrastructure defaults while requiring explicit invite seeds.

Changes:

  • Replaces product-specific constants, channels, aliases, and documentation.
  • Requires invite tokens to carry an explicit seed.
  • Makes WASM proof WebSocket origins configurable and removes machine-specific files.
File Description
web/​relay.html Generalizes qualification text.
tests/​wasm/​serve.mjs Configures proof-page WebSocket CSP.
test_connect.sh Makes the remote host configurable.
src/​services/​transfers.zig Renames test channels.
src/​services/​control.zig Neutralizes application-channel fixtures.
src/​protocol/​transfer.zig Neutralizes transfer fixtures.
src/​protocol/​messages.zig Updates alias example.
src/​protocol/​codec.zig Updates alias test data.
src/​protocol/​app_channel.zig Renames the example channel constant.
src/​meshguard_ffi.zig Uses neutral discovery and relay examples.
src/​main.zig Requires invite seeds and removes fallback infrastructure.
src/​discovery/​lan.zig Renames the default LAN app ID.
scripts/​test-control-startup.py Updates channel fixtures.
docs/​reference/​wasm-core.md Documents configurable CSP origins.
docs/​reference/​cli.md Documents invite and join behavior.
docs/​reference/​browser-relay.md Generalizes qualification details.
docs/​reference/​app-transfers.md Neutralizes transfer examples.
docs/​reference/​app-channels.md Neutralizes channel examples.
docs/​guide/​trust-model.md Uses a generic organization.
docs/​guide/​services.md Uses generic policy examples.
docs/​guide/​configuration.md Uses generic configuration examples.
docs/​evidence/​android-web-relay-browser.json Removes environment-specific evidence.
docs/​concepts/​identity-and-trust.md Uses a generic alias example.
docs/​agent-rooms-direction-2026-09-20.md Removes an unrelated design note.
dist/​agent-join.sh Generalizes onboarding wording.
CHANGELOG.md Records behavior and naming changes.
android-x86_64-libc.conf Removes machine-specific Android configuration.
android-aarch64-libc.conf Removes machine-specific Android configuration.
.github/​workflows/​wasm.yml Limits PR workflow triggers to main.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread tests/wasm/serve.mjs Outdated
// Extra origins the proof page may connect to (the browser gateway), space-separated,
// for example MESHGUARD_WEB_PROOF_CONNECT_SRC='wss://gateway.example.org'. Loopback only by default.
const extraConnect=(process.env.MESHGUARD_WEB_PROOF_CONNECT_SRC||'').split(/\s+/).filter(Boolean);
for(const origin of extraConnect)if(!/^wss?:\/\/[A-Za-z0-9.\-\[\]:*]+$/.test(origin))throw new Error(`MESHGUARD_WEB_PROOF_CONNECT_SRC: not a ws(s):// origin: ${origin}`);

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 743aedb: each entry is now parsed with new URL and must be a plain ws:/wss: origin (no wildcard, credentials, path, query or fragment). wss://*, wss://*.x.org, wss://u:p@h.org, wss://h.org/path and https://h.org are rejected at startup.

Comment thread src/main.zig
}
}

if (seed.len == 0) {

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, fixed in 743aedb. The static-seed path in up used only parseEndpoint, so hostnames worked only alongside --dns/--mdns. Static seeds now go through Seed.parseOrResolve (numeric address, else DNS A record), the warning names unresolvable seeds, and the seed module tests now run in zig build test. Checked manually: a resolvable hostname seed is accepted and an unresolvable one is reported.

- `up` resolved hostname seeds only when DNS or mDNS discovery was also
  enabled; with static seeds alone a hostname was silently dropped, so an
  invite carrying a hostname seed could not bootstrap `join`. Static
  seeds now go through Seed.parseOrResolve (numeric address, else DNS A
  record), and the warning names unresolvable seeds.
- Run the seed module's tests in `zig build test`.
- The WASM proof server parses each MESHGUARD_WEB_PROOF_CONNECT_SRC entry
  as a URL and accepts only a plain ws:/wss: origin: no wildcard,
  credentials, path, query or fragment.
@igorls
igorls merged commit 9f1a20e into main Oct 12, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants