Repository navigation
docs: list the SigV4 checks in the code's order, fix two error causes - #1346
LeeroyHannigan wants to merge 1 commit into
Conversation
The security model listed the access key lookup before the X-Amz-Date check and the credential scope check. authenticate in crates/auth/src/lib.rs checks X-Amz-Date, then the credential scope, and then finds the key in the credential store. The list now gives that order. Steps 3, 4, 5 and 9 have the text of #949, which makes the same change. That text also names the scope date check, the refusal of an expired session and the inactive key. The two changes merge without a conflict. The troubleshooting table of the quickstart gave a wrong secret as a cause of UnrecognizedClientException. A wrong secret for a known key gets InvalidSignatureException. The table now gives each of the two exceptions its causes. The first CRUD reference under .agents/skills/extenddb gave clock skew as a cause of InvalidSignatureException. ExtendDB answers a clock more than 15 minutes off with UnrecognizedClientException, and #889 changes that answer to InvalidSignatureException. The reference and the table now give no clock cause, so they agree with the code before and after #889. Fixes #1297.
LJMart11
left a comment
There was a problem hiding this comment.
Reviewed at 2ba1b76. Docs-only diff; no tests were run. Each changed SigV4 statement was compared with the auth code at the head.
Docs — outside the diff
.agents/skills/extenddb/references/troubleshooting/06-auth-symptoms.md:22— Line 22 of this skill reference says clock skew, expired session tokens and region mismatches are not documented causes ofInvalidSignatureExceptionand must not be added as diagnostics. The new quickstart row (04-quickstart-setup-guide.md:415) names the client region as a cause, andcheck_scopeatcrates/auth/src/sigv4/verify.rs:63-65does returnInvalidSignatureExceptionfor a region mismatch (from the code). Updating line 22 to drop region from the list would make the two docs agree.
navareamol
left a comment
There was a problem hiding this comment.
The description is out of date against main. It says #949 is open and that steps 3, 4, 5 and 9 have its text so the two PRs merge without a conflict. #949 merged as 5252eda and main already has those steps. Merged into current main, this branch changes only 02-first-crud.md and 04-quickstart-setup-guide.md, and the 10-security-model.md hunk in the diff shows because the branch is behind main. Can you merge main and update that paragraph and the line numbers in the table?
I think the new UnrecognizedClientException row in the quickstart is incomplete. On a server built from main, a known key with an X-Amz-Date 20 minutes old gets UnrecognizedClientException "Signature expired", and a long term key sent with a session credential header gets the same error. A reader with a skewed clock is told to check the access key ID. The sentence in 02-first-crud.md lost its clock cause under InvalidSignatureException, which is right, but it is not under UnrecognizedClientException either. Can you add a request date more than 15 minutes from the server clock to the row and the sentence, with a note that it changes if #889 merges?
The two docs disagree on region. The quickstart InvalidSignatureException row names the client region, and the sentence in 02-first-crud.md names only the secret key. A known key signed for eu-west-1 against a us-east-1 server gets InvalidSignatureException "Credential should be scoped to a valid region." here. Can you add the client region to that sentence?
I will approve once the description matches main and both docs name the request date cause.
What
This PR fixes three docs that describe the SigV4 checks.
docs/manuals/10-security-model.md: the list of SigV4 checks now gives the code's order. TheX-Amz-Datecheck is step 3, the credential scope check is step 4, and the access key lookup is step 5. Step 9 now names steps 5 and 6.docs/manuals/04-quickstart-setup-guide.md: the troubleshooting row forUnrecognizedClientExceptiongave a wrong secret as a cause. A wrong secret for a known key getsInvalidSignatureException. The row now gives an access key ID that is unknown or inactive. A new row forInvalidSignatureExceptiongives a wrong secret, and a client region that is not the server's[server] region..agents/skills/extenddb/references/first-request/02-first-crud.md: the list of failure modes gave clock skew as a cause ofInvalidSignatureException. The list now gives no clock cause.Open PR #949 makes the same change to the security model, and it came first. Steps 3, 4, 5 and 9 of this PR have the text of #949, byte for byte, so the two PRs merge without a conflict. That text also says the following, which holds on
main:YYYYMMDDprefix ofX-Amz-Date.ExpiredTokenException, before the signature check.A request date more than 15 minutes from the server clock gets
UnrecognizedClientExceptiononmain. Open PR #889 changes that answer toInvalidSignatureException, the answer DynamoDB gave for #805. The new quickstart rows and the CRUD reference give no clock cause, so they agree with the code before and after #889.Fixes #1297
Why
#1297 lists the three statements. The order of the checks decides the answer to a request with an unknown key and a credential scope of another region. In the old list, that request gets
UnrecognizedClientException. ExtendDB answersInvalidSignatureException, as DynamoDB did when measured on 23 Oct 2026 (tests/test_auth_error_fidelity.py).The new statements agree with this code on
mainat 8c64333:X-Amz-Datecheck, then the scope check, then the lookupauthenticateincrates/auth/src/lib.rs, lines 158, 163 and 167check_scopeincrates/auth/src/sigv4/verify.rs, lines 63 to 71ExpiredTokenExceptionat the lookupcrates/auth/src/lib.rs, lines 165 to 173UnrecognizedClientExceptioncrates/auth/src/lib.rs, lines 169 to 173 and 222 to 226InvalidSignatureExceptioncrates/auth/src/sigv4/verify.rs, lines 64 and 150 to 154Testing done
main, at the lines in the table above.git merge-treeof this commit and test(auth): pin the order of the scope date and token expiry checks #949 is clean.git merge-treeshows no conflict withmain. It shows new conflicts indocs/manuals/04-quickstart-setup-guide.mdwith four open PRs:UnrecognizedClientExceptionrow to a colon. A merge keeps the two rows of this PR.docs/install-from-source.mdhas the old row's statement. A merge keeps the deletion and copies the two rows of this PR into that table.Not in this PR:
Checklist
cargo test --workspace)cargo fmt --check)cargo clippy -- -W clippy::pedantic)Storagetrait, auth model, on-diskformat, or public CLI surface, an RFC has been accepted or is linked
below. Otherwise, an ADR captures the decision (link below).
ADR / RFC: n/a
By submitting this pull request, I confirm that my contribution is made under
the terms of the Apache License 2.0 and I agree to the Developer Certificate of
Origin (DCO). See CONTRIBUTING.md for details.