Repository navigation
Conversation
The Envelope Inspector interpolated strings it reads from the envelope, audit and session-context logs into the lines it prints. The Guardian endpoint is unauthenticated and logs a request's method and id before it validates them, so a request author chose the bytes the operator's terminal received: ESC sequences could clear the screen, overwrite the DENY line, retitle the window or write the clipboard. JSON.stringify protected the envelope body from C0 controls only; DEL and C1 controls passed through it. Replace every C0 control (newline included), DEL and C1 control in a logged field with a visible \xNN escape before the renderer paints it, so the Inspector's own ANSI styling is untouched. The same escape covers the envelope body and the stderr warnings printed for an unparseable log line. Closes GenAI-Security-Project#468 Signed-off-by: Raghuvar Karthik Durga <177662415+drk-ram@users.noreply.github.com>
drk-ram
requested review from
afogel,
bar-capsule and
rocklambros
as code owners
November 3, 2026 06:12
drk-ram
requested review from
GangGreenTemperTatum,
artmaro,
fewdisc,
mamicidal and
sclintonowasp
as code owners
November 3, 2026 06:12
|
Thanks for this. It is queued rather than ignored. A lead has not reviewed this pull request yet. A lead will read it when they have time, and we can't promise a date. Nothing here is rejected. If a check below fails, please fix it. A pull request that waits a long time may be closed, and you can reopen it later. |
This branch has not been deployed
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 changed
The Envelope Inspector now escapes every control character in a field it reads from a log before it prints that field, so a request author can no longer drive the operator's terminal through
method,id, an errormessage,reason_codes,policy_id/rule_id,tool_name,session_idor the other logged strings. Each C0 control (newline included), DEL and each C1 control prints as a visible\xNNescape (for example\x1b[2J). The escape runs on the field beforepaintadds the Inspector's own colour, so the styling is unchanged. It also covers the pretty-printed envelope body, whereJSON.stringifyescapes C0 controls but passes DEL and C1 controls through, and the stderr warning printed for an unparseable log line.Intentional behaviour change: a newline inside a logged field (a
tool_namewith a newline, for instance) is now printed as\x0ainstead of splitting the row. The existing test that pinned the raw newline now pins the escape and still checks that the row is one value.Not covered: printable characters that render confusingly, such as bidirectional overrides. The escape targets
[\x00-\x1f\x7f-\x9f], as the issue asks.Which issue does this implement
Closes #468
meaning, so it needs no issue
Base branch
integration, because this touches the specification, schemas, a referenceimplementation, an adapter, tests, or CI
main, because every changed path is on the documentation lane allowlist inCONTRIBUTING.md
Type of change
Specification changes
Not applicable: nothing under
specification/ordocs/spec/changed.I tested this
uv run pytest -vpasses on my machineuv run mkdocs build --strictpasses on my machineThe change is confined to
reference-implementations/agt/packages/inspector, which has no Python or MkDocs input, so I ran the Bun suite for that package instead, fromreference-implementations/agt:bun test packages/inspector/test/: 99 pass, 3 fail. The 3 failures (tailAuditLogunreadable-log twice,tailEnvelopeLogthrowing read) fail identically on unmodifiedintegrationat bba1b84 on Windows.packages/inspector/test/render-control-characters.test.ts: 25 tests, 19 of which fail without the fix and all pass with it. They cover every renderer,coloron and off, the end-to-end tail-then-render path for all three logs, and the stderr warnings.bun test test/invariants.test.ts: 34 pass, 2 fail. The same 2 (every host shim imports the adapter only,hosts/opencode/acs-plugin.ts exports exactly one symbol) fail on unmodifiedintegration; the vocabulary gates pass.bun testover all ofreference-implementations/agt: 761 pass, 60 fail, against 736 pass, 60 fail on unmodifiedintegration. The 25 extra passes are the new tests and the failing set is unchanged (missing OPA and optional host dependencies in this environment).bun run typecheck: one error,packages/guardian/src/otel-trace-exporter.ts(409,13) TS2739, present on unmodifiedintegrationafterbun installhere. No error inpackages/inspector.Checklist
git commit -s(required by the DCO)Security
This change closes a terminal-injection path in the Inspector. The issue was reported publicly in #468 and describes a viewer-side display defect in a reference implementation, not an exposure of data or a bypass of a Guardian decision.