Skip to content

fix(agt): treat an HTTP 4xx from the Guardian endpoint as a refusal - #544

Merged
rocklambros merged 2 commits into
GenAI-Security-Project:integrationfrom
Santoshkumarpuppala:fix/post-http-4xx-refusal
Dec 3, 2026
Merged

rocklambros merged 2 commits into
GenAI-Security-Project:integrationfrom
Santoshkumarpuppala:fix/post-http-4xx-refusal

Conversation

@Santoshkumarpuppala

Copy link
Copy Markdown
Contributor

What changed

post() now checks the status before reading the body, so any 4xx except 408 and 429 blocks the step whatever the posture, as Bar set out in #32. 408, 429 and 5xx still follow on_decision_failure, and a 5xx body is still read.

One side effect: a wrong ACS path that 404s now blocks steps instead of following the posture.

Which issue does this implement

Part of #32

  • This is an editorial correction (typo, grammar, link, formatting) with no change in
    meaning, so it needs no issue

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

bun test packages/host-adapter passes (395). Without the status check, the new 4xx tests fail.

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

It closes the fail-open on a rejected adapter credential described in #32.

post() parsed the response body without reading the status, so a 401 or
403 from the Guardian endpoint, or from whatever authenticates in front of
it, became a SyntaxError or an unrecognised JSON-RPC error. Both were left
to on_decision_failure, and under proceed the step ran even though the
adapter's credential had been rejected.

post() now throws GuardianHttpRefusalError for any 4xx except 408 and 429,
and classifyDeliveryFailure files it as refused, so the step is blocked
whatever the posture. 408, 429 and 5xx still follow the posture, and a 5xx
body is still read.

Part of GenAI-Security-Project#32.

Signed-off-by: Santosh Kumar Puppala <puppalas97@gmail.com>
@github-actions

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.

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

@drk-ram drk-ram left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Reviewed guardian-client.ts, failure-posture.ts, and the accompanying tests (d8824bc6):

  • Pre-body HTTP 4xx refusal check (isRefusalStatus / GuardianHttpRefusalError): Checking res.status >= 400 && res.status < 500 && res.status !== 408 && res.status !== 429 before reading or JSON-parsing the response body (and canceling res.body) prevents an HTML/plain-text 401/403 from an authenticating proxy from throwing a SyntaxError (unknown -> proceed).
  • Fail-closed classification (classifyDeliveryFailure): Mapping GuardianHttpRefusalError to kind: "refused" blocks the step regardless of on_decision_failure and attributes the refusal to "the guardian's endpoint" in the audit reasoning.

@DanPazlev

Copy link
Copy Markdown
Collaborator

#603 §6.4 classes HTTP 429 as a refusal, but this PR leaves it as a decision failure ("408, 429 and 5xx still follow on_decision_failure"). Please move 429 to the refusal branch, or I'll note the mismatch on #603.

Separately, GuardianHttpRefusalError puts res.statusText into the error message. That's server-controlled text that can reach logs. Drop it or sanitize it. The HTTP status is enough for the audit record.

A test that asserts a 401 from an intermediary is blocked under proceed would lock in the fix the PR body describes.

@rocklambros rocklambros left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks, Santosh. I'm approving this PR at c791150.

Every HTTP 4xx except 408 and 429 now blocks the step whatever the posture, as Bar set out on issue #32 on 11-04.

One rule changed after that. On 11-05 the leads agreed that an HTTP 429 is a refusal too (decision D-046), and Dan Pazlev pointed this out here on 11-30. With this PR as it is, a 429 still follows the posture, so under proceed the step runs.

I'll make that one change myself when I merge: isRefusalStatus in guardian-client.ts will block 429, and the test in client.test.ts will expect deny for it. 408 stays on the posture. You don't need to do anything for it.

This PR also conflicts with PR #229 (ACS-Core wire safeguards) in failure-posture.ts and its test imports. I'll resolve that in the batch too. With both PRs merged, bun test packages/host-adapter hosts/claude-code passes (635 pass, 0 fail).

This PR will merge into integration in the next batch, together with other PRs for release 0.1.6.

@rocklambros rocklambros mentioned this pull request Dec 3, 2026
11 of 18 tasks
@rocklambros
rocklambros merged commit 54d0ef8 into GenAI-Security-Project:integration Dec 3, 2026
8 checks passed
@github-project-automation github-project-automation Bot moved this from In progress to Done in ACS Project Tracker Dec 3, 2026
@rocklambros rocklambros mentioned this pull request Dec 3, 2026
10 of 15 tasks
e2hln pushed a commit to e2hln/agent-control-standard that referenced this pull request Dec 3, 2026
The leads ruled on 11-05 that an HTTP 429 is a refusal, like the other
4xx (D-046). PR GenAI-Security-Project#544 left 429 with the posture, so under proceed the step
ran. isRefusalStatus now blocks every 4xx except 408, and the client test
expects deny for 429.

Signed-off-by: Rock Lambros <rock@rockcyber.com>
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: Done

Development

Successfully merging this pull request may close these issues.

4 participants