Repository navigation
fix(http): distinct error codes for signing refusals - #2660
Conversation
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 ReviewWarning This pull request has 1 commit after the last Strix review ( ✅ 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 summaryReviewed 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)
Review 1 on this PR · Reviewed by Strix |
|
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
NumaryBot
left a comment
There was a problem hiding this comment.
The required automated review completed with no remaining findings.
What changed
An HTTP signing refusal now answers the signing reason as its
errorCode:UNAUTHENTICATEDMISSING_SIGNATUREPERMISSION_DENIEDINVALID_SIGNATUREPERMISSION_DENIEDUNKNOWN_KEY_IDStatus codes and
errorMessageare 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 ofERROR. JWT failures keepUNAUTHENTICATED/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 throughgoogle.rpc.ErrorInfoin domainledger.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-checkAI_REVIEW_BASE_SHA=<main> bash scripts/agent-check-prgo 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
errorCodeon signing refusals see the new values. Status codes and messages are unchanged, so clients branching on status alone are unaffected.errorCodeis a free string inopenapi.yml, so no SDK regeneration is needed.grpcerr: named reason constants; the decoded forwarded failure keeps its reason; newSigningReason(err)matches both local sentinels and decoded failures.classifyErrorandbulkElementErroruseSigningReason.http-api.mdthat kept these reasons off the HTTP surface;openapi.yml,docs/ops/signing.md,api-comparison.md, admission signing docs and theapi-boundary-contracts/authentication-authorization-boundariesaudit manifests are updated.Review focus
grpcerr.SigningReasonmust not match a bare or wrongly paired status (covered byTestSigningStatusDoesNotReclassifyTransportFailures).INVALID_SIGNATURE(it already usedsigning.ErrInvalidSignatureinternally).Known concerns
None