Skip to content

fix(http): distinct error codes for signing refusals - #2660

Merged
Azorlogh merged 2 commits into
mainfrom
claude/en-3426-http-signing-error-codes-3903f0
Nov 26, 2026
Merged

Azorlogh merged 2 commits into
mainfrom
claude/en-3426-http-signing-error-codes-3903f0

Conversation

@Azorlogh

@Azorlogh Azorlogh commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

What changed

An HTTP signing refusal now answers the signing reason as its errorCode:

Refusal Before After
Missing mandatory signature 401 UNAUTHENTICATED 401 MISSING_SIGNATURE
Invalid signature, or signed batch differing from the HTTP request 403 PERMISSION_DENIED 403 INVALID_SIGNATURE
Unknown or revoked key 403 PERMISSION_DENIED 403 UNKNOWN_KEY_ID

Status codes and errorMessage are unchanged. The answer is identical whether the refusal is raised locally or forwarded from the leader, and a signing refusal inside a bulk element carries the same code instead of ERROR. JWT failures keep UNAUTHENTICATED / PERMISSION_DENIED; bare or foreign gRPC auth statuses keep the sanitized 500.

Why

EN-3426: with signing require true, an unsigned write from the Console answered exactly like an expired token, so clients could not say "this cluster requires signed writes". gRPC already distinguished the three reasons through google.rpc.ErrorInfo in domain ledger.signing.

Product / operational motivation

N/A (exposes an existing gRPC distinction over HTTP).

Technical decision

N/A

Risk

LOW — HTTP adapter error rendering only; no persisted, Raft, protobuf or protocol-revision change.

Validation

  • bash scripts/agent-check
  • AI_REVIEW_BASE_SHA=<main> bash scripts/agent-check-pr
  • Targeted tests: go test ./internal/adapter/grpcerr/... ./internal/adapter/http/...; go test -tags e2e ./tests/e2e/business/ -ginkgo.focus "signed|signing|signature" (12 specs, including the follower-forwarded case)

Architecture / behavior impact

Client impact: clients that match errorCode on signing refusals see the new values. Status codes and messages are unchanged, so clients branching on status alone are unaffected. errorCode is a free string in openapi.yml, so no SDK regeneration is needed.

  • grpcerr: named reason constants; the decoded forwarded failure keeps its reason; new SigningReason(err) matches both local sentinels and decoded failures.
  • classifyError and bulkElementError use SigningReason.
  • Docs reverse the rule in http-api.md that kept these reasons off the HTTP surface; openapi.yml, docs/ops/signing.md, api-comparison.md, admission signing docs and the api-boundary-contracts / authentication-authorization-boundaries audit manifests are updated.

Review focus

  • grpcerr.SigningReason must not match a bare or wrongly paired status (covered by TestSigningStatusDoesNotReclassifyTransportFailures).
  • The HTTP-to-signed-batch mismatch now reads INVALID_SIGNATURE (it already used signing.ErrInvalidSignature internally).

Known concerns

None

A signing refusal over HTTP answered the same errorCode as a JWT failure:
401 UNAUTHENTICATED for a missing mandatory signature, 403
PERMISSION_DENIED for an invalid signature or unknown key. Clients could
not tell "this cluster requires signed writes" from a broken session.

The HTTP errorCode is now the signing reason already carried over gRPC:
401 MISSING_SIGNATURE, 403 INVALID_SIGNATURE, 403 UNKNOWN_KEY_ID. Status
codes and errorMessage are unchanged. A refusal forwarded from the leader
keeps its decoded reason, so local and forwarded answers stay identical,
and bulk elements carry the same code instead of ERROR. Bare or foreign
gRPC auth statuses keep the sanitized 500.
@strix-security

strix-security Bot commented Nov 26, 2026 •

Copy link
Copy Markdown

Strix Security Review

Warning

This pull request has 1 commit after the last Strix review (22301a6). Strix has not reviewed these changes.
Automatic review on push is off for this repository. To review the latest changes, tag @strix-security in a comment, or turn on re-review on push.

✅ No open security findings.

PR summary: The PR makes HTTP signing refusals answer a specific errorCode (MISSING_SIGNATURE, INVALID_SIGNATURE or UNKNOWN_KEY_ID) instead of the coarse UNAUTHENTICATED/PERMISSION_DENIED, both for single requests and bulk elements and whether the refusal is raised locally or forwarded from the leader; status codes, messages, JWT behaviour and documentation are adjusted to match.

Review summary

Reviewed the error-rendering change end to end: grpcerr.SigningReason and the new reason constants, decodeSigningStatus pairing rules, classifyError, bulkElementError, plus the HTTP/gRPC paths they are reached from. No security vulnerabilities were confirmed. The reason is only ever produced by the local signing sentinels or by a decoded leader failure whose ErrorInfo domain and status/reason pair were validated, so a bare or foreign auth status still falls through to the sanitized 500 and a JWT failure still answers UNAUTHENTICATED/PERMISSION_DENIED. The response message stays the generic public kind message, so no peer-controlled text reaches the caller, and the new code values feed no security decision: bulk rollup and continueOnFailure suppression key off the 401/403 status, which is unchanged. Making UNKNOWN_KEY_ID distinguishable from INVALID_SIGNATURE does not disclose anything the gRPC surface did not already expose, and the key lookup is scoped so it reveals no cross-namespace key existence.

Ruled out (1)
  • Does the 401 body on the JWT authentication path return validator internals or the trusted issuer list to an unauthenticated caller?
    The only branch that would print the trusted issuer list is unreachable because the issuer keyset rejects an untrusted iss before that check runs, and everything else echoed names caller-supplied values only.

Review 1 on this PR · 22301a6 · requested Nov 26 10:57 UTC when the PR was opened


Reviewed by Strix
Re-run review · Configure security review settings · Try a deeper review with @strix-security /deep

@NumaryBot NumaryBot added risk: high NumaryBot classified this pull request as high risk. bot-reviewed NumaryBot completed its review workflow for the current head. review-approved The DINESH review gate is satisfied for the current head. labels Nov 26, 2026
NumaryBot

This comment was marked as outdated.

shipfox-ai[bot]

This comment was marked as outdated.

@codecov-commenter

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@NumaryBot NumaryBot added review-approved The DINESH review gate is satisfied for the current head. and removed review-approved The DINESH review gate is satisfied for the current head. labels Nov 26, 2026

@NumaryBot NumaryBot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The required automated review completed with no remaining findings.

@shipfox-ai shipfox-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Shipfox review

No new issues in 2 files changed since 22301a6.

Reviewed the changes since 22301a6f66771893be164a9e3553fc867728eac9 in 822352906ff1922aed2cc4542d811a43aab5236f...0456cc3b2652ee05b1615ecb201e4c19bd1a4d3b.

@Azorlogh
Azorlogh added this pull request to the merge queue Nov 26, 2026
Merged via the queue into main with commit eae7888 Nov 26, 2026
22 checks passed
@Azorlogh
Azorlogh deleted the claude/en-3426-http-signing-error-codes-3903f0 branch November 26, 2026 13:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bot-reviewed NumaryBot completed its review workflow for the current head. review-approved The DINESH review gate is satisfied for the current head. risk: high NumaryBot classified this pull request as high risk.

Development

Successfully merging this pull request may close these issues.

5 participants