Skip to content

docs: list the SigV4 checks in the code's order, fix two error causes - #1346

Open
LeeroyHannigan wants to merge 1 commit into
mainfrom
fix/1297-sigv4-docs
Open

LeeroyHannigan wants to merge 1 commit into
mainfrom
fix/1297-sigv4-docs

Conversation

@LeeroyHannigan

Copy link
Copy Markdown
Collaborator

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. The X-Amz-Date check 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 for UnrecognizedClientException gave a wrong secret as a cause. A wrong secret for a known key gets InvalidSignatureException. The row now gives an access key ID that is unknown or inactive. A new row for InvalidSignatureException gives 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 of InvalidSignatureException. 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:

  • The scope date must be the YYYYMMDD prefix of X-Amz-Date.
  • The lookup refuses an expired session with ExpiredTokenException, before the signature check.
  • The lookup reads whether the key is active, and step 9 applies that decision.

A request date more than 15 minutes from the server clock gets UnrecognizedClientException on main. Open PR #889 changes that answer to InvalidSignatureException, 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 answers InvalidSignatureException, as DynamoDB did when measured on 23 Oct 2026 (tests/test_auth_error_fidelity.py).

The new statements agree with this code on main at 8c64333:

Statement Code
The X-Amz-Date check, then the scope check, then the lookup authenticate in crates/auth/src/lib.rs, lines 158, 163 and 167
The scope sentences in the order region, service, date check_scope in crates/auth/src/sigv4/verify.rs, lines 63 to 71
An expired session gets ExpiredTokenException at the lookup crates/auth/src/lib.rs, lines 165 to 173
An unknown or inactive access key ID gets UnrecognizedClientException crates/auth/src/lib.rs, lines 169 to 173 and 222 to 226
A wrong secret or another region gets InvalidSignatureException crates/auth/src/sigv4/verify.rs, lines 64 and 150 to 154

Testing done

Not in this PR:

Checklist

  • I have read CONTRIBUTING.md
  • All tests pass (cargo test --workspace)
  • Code is formatted (cargo fmt --check)
  • Clippy is clean (cargo clippy -- -W clippy::pedantic)
  • I have added or updated tests for new functionality
  • I have updated documentation if behavior changed
  • Breaking changes are noted below (if any)
  • If this changes the wire protocol, Storage trait, auth model, on-disk
    format, 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.

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 LJMart11 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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

  1. .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 of InvalidSignatureException and must not be added as diagnostics. The new quickstart row (04-quickstart-setup-guide.md:415) names the client region as a cause, and check_scope at crates/auth/src/sigv4/verify.rs:63-65 does return InvalidSignatureException for a region mismatch (from the code). Updating line 22 to drop region from the list would make the two docs agree.

@navareamol navareamol self-assigned this Dec 3, 2026

@navareamol navareamol 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.

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.

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

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

The security model lists the SigV4 checks in another order than the code, and two docs give a wrong cause for an auth error

3 participants