Repository navigation
fix: non-blocking telemetry, post-DNS egress guardrails, writable bwrap workspace - #2
Merged
Merged
Conversation
Generated by Mistral Vibe. Co-Authored-By: Mistral Vibe <[email protected]>
…ap workspace Phase 1 hardening from the egress audit: - emit: POST moved to a background worker with a bounded queue (128) so a slow or absent ingest never delays a tunnel; emit() now writes the JSONL file (the authority) and enqueues. Undelivered posts retry twice with a 250ms pause, then stay file-only. Ingest hostnames resolve, so http://localhost:8000 no longer silently falls back to file-only. - proxy: after DNS resolution the dial address is checked against an egress guardrail (ssrf_guard in guard.json or AGENTMETRY_GUARD_SSRF): metadata (default) refuses link-local destinations such as 169.254.169.254, strict also refuses loopback/private/ULA, off keeps the name lists as the whole policy. Denials are outcome=denied with policy=ssrf-guard and cannot be voted away by allowlisting. This closes the pre-DNS gap where alternate IP encodings and DNS rebinding slipped past string matching. - sandbox: the Bubblewrap wrapper binds cwd and /tmp writable by default (writable_defaults) plus configurable writable_paths with tilde expansion, fixing EROFS on every wrapped server or build that writes files or caches. Sensitive overlays are applied after the writable binds, so hiding always wins; paths inside credential directories or missing paths are skipped with a warning. - fileconf: strict parsing for the new keys (ssrf_guard, writable_paths, writable_defaults); unknown keys, bad booleans and bad enum values still fail closed. Gates: cargo test --locked 44 passed, clippy --all-targets -D warnings clean, release build OK, scripts/smoke.sh OK. Generated by Mistral Vibe. Co-Authored-By: Mistral Vibe <[email protected]>
blitzcrieg1
added a commit
to blitzcrieg1/agentmetry
that referenced
this pull request
Nov 28, 2026
* fix(external): accept the guard's ssrf-guard policy verdict agentmetry-guard's post-DNS egress guardrail denies with policy=ssrf-guard. The canonical ingest whitelist only knew allowlist and denylist, so the refusal reached the trail with no reason attached. Accept the one new value; anything else is still dropped so a client cannot stamp arbitrary text into the canonical arguments. The guard-egress-denied detection fires on outcome alone and is unaffected. Companion to blitzcrieg1/agentmetry-guard#2. Generated by Mistral Vibe. Co-Authored-By: Mistral Vibe <[email protected]> * docs(readme): 3113 tests collected with the guard policy-value tests Generated by Mistral Vibe. Co-Authored-By: Mistral Vibe <[email protected]> --------- Co-authored-by: Mistral Vibe <[email protected]>
This was referenced Nov 28, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Phase 1 of the egress audit:
emit()writes the JSONL file synchronously (the authority) and enqueues; a stalled recorder can no longer add up to ~2s per request between the CONNECT reply and the tunnel. Undelivered posts retry twice (250ms pause), then stay file-only. Ingest URLs now resolve hostnames, sohttp://localhost:8000works instead of silently falling back to file-only.ssrf_guardin guard.json orAGENTMETRY_GUARD_SSRFselects the mode:metadata(default) refuses link-local destinations such as 169.254.169.254,strictalso refuses loopback/RFC1918/ULA/unspecified,offkeeps the lists as the whole policy. Denials areoutcome=deniedwithpolicy="ssrf-guard"and cannot be voted away by allowlisting a name. Alternate IP encodings (glibc resolves the integer form of 169.254.169.254) and DNS rebinding land on the same decision.--ro-bind / /made every wrapped server or build fail with EROFS on its first write. By default (writable_defaults: true) the wrapper now binds the current directory writable and mounts a fresh/tmp, plus configurablewritable_pathswith tilde expansion. Sensitive overlays are applied after the writable binds, so hiding always wins; paths inside credential directories are skipped with a warning instead of silently shadowed.ssrf_guard,writable_paths,writable_defaultsparse under the same fail-closed rules: unknown keys, bad booleans and bad enum values prevent startup.Why
These were the three high-priority guard findings: telemetry on the hot path blocks tunnels and drops hostname ingest URLs; string-only policy lets encoded/rebound addresses reach metadata endpoints; and the Linux wrapper was unusable for anything that writes a file.
Evidence
cargo test --locked: 44 passed, 0 failed (21 new tests: async emit regression, hostname delivery, bounded retry, queue overflow, metadata/strict/off guardrail behavior, argv ordering and conflict refusals)cargo clippy --all-targets --locked -- -D warnings: cleancargo build --locked --release: OKbash scripts/smoke.sh ./target/release/agentmetry-guard: OK (loopback, strict policy, destination-only evidence)Notes for review
allowlist/denylistin_guard_destination; a companion PR there acceptsssrf-guardso the denial reason survives into the canonical trail. The existingguard-egress-denieddetection fires on outcome alone, so detection is unaffected either way.metadatamode keeps loopback and RFC1918 reachable: local LLMs and internal APIs are legitimate wrapped destinations, andNO_PROXYalready routes localhost around the proxy, so blocking loopback at the proxy would be theater.strictis available for operators who want it.--versionflag in the first commit was authored in an earlier session and left uncommitted in the local clone; it is preserved as its own commit.