Skip to content

fix(guardian): keep the envelope log on after a value it cannot serialize - #504

Open
drk-ram wants to merge 1 commit into
GenAI-Security-Project:integrationfrom
drk-ram:guardian/envelope-sink-serialize-377
Open

drk-ram wants to merge 1 commit into
GenAI-Security-Project:integrationfrom
drk-ram:guardian/envelope-sink-serialize-377

Conversation

@drk-ram

@drk-ram drk-ram commented Nov 5, 2026

Copy link
Copy Markdown
Collaborator

What changed

The Guardian's envelope log sink no longer turns itself off when one value cannot be serialized. A request whose params nests 400,000 arrays overflows JSON.stringify; the sink now records that one entry as a serialization_failed marker with the reason and keeps logging. Only a filesystem failure disables the sink.

Which issue does this implement

Base branch

  • integration, because this touches the specification, schemas, a reference
    implementation, an adapter, tests, or CI
  • main, because every changed path is on the documentation lane allowlist in
    CONTRIBUTING.md

Type of change

  • Specification change (schema, hooks, events, AgBOM)
  • Reference implementation or adapter
  • Documentation
  • Tooling or CI
  • Governance (licensing, security policy, contributor docs)

I tested this

  • I synced my branch with the base branch before opening this
  • uv run pytest -v passes on my machine
  • uv run mkdocs build --strict passes on my machine

This change is in the Bun reference implementation, so the Python and mkdocs checks do not apply. From reference-implementations/agt, bun test packages/guardian: the new tests fail on integration (the sink goes dark after the deep request) and pass with this change. 13 other Guardian tests fail identically with and without it on my Windows machine (file modes and proxy environment); none involve the envelope log.

Checklist

  • Commits are signed off with git commit -s (required by the DCO)
  • Prose follows STYLE.md
  • No secrets, tokens, or internal URLs in the diff

Security

  • This change has no security impact

Removes a way to silence the envelope log: any caller that can reach the port could do it until restart with one request. Decisions were never affected.

…lize

The envelope log sink treated any exception during a write as a failure of the sink itself and switched itself off for the life of the process. JSON.stringify throws on values it cannot serialize (400,000 nested arrays overflow the stack, a cycle or a BigInt throws), so one such request silenced the log for every request after it.

A serialization failure now costs that one record. The sink writes the entry with a serialization_failed marker and the reason in place of the envelope, keeps its sequence numbering, returns false so a caller recording a required finding still falls back, and stays on. Only a filesystem failure disables the sink.

Signed-off-by: Raghuvar Karthik Durga <177662415+drk-ram@users.noreply.github.com>
@github-actions

github-actions Bot commented Nov 5, 2026

Copy link
Copy Markdown

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.

@github-actions

github-actions Bot commented Nov 5, 2026

Copy link
Copy Markdown

This pull request's description says it closes #377, which is on the project roadmap. When it merges, GitHub closes that issue and the roadmap counts it as delivered. Please confirm the change delivers the whole issue before merging.

@acs-board-reconciler acs-board-reconciler Bot moved this from Needs triage to In progress in ACS Project Tracker Nov 6, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status:needs-triage Not yet triaged. Applied by the issue forms

Projects

Status: In progress

Development

Successfully merging this pull request may close these issues.

[Bug] One deeply nested request turns off the Guardian's envelope log until restart

1 participant