Repository navigation
fix(auth): answer InvalidSignatureException for timestamps outside skew window (#805) - #889
Dodothereal wants to merge 1 commit into
Conversation
navareamol
left a comment
There was a problem hiding this comment.
One thing to fix, one to run:
- The boundary test pins behaviour that isn't measured (inline on verify.rs).
- No CI has run on this head and the branch is behind main. Could you merge main so CI runs? The 441 unit test count in the description can then be checked against the run.
The messages match the ones measured in #805, and the description matches the code.
|
|
||
| /// Exact ±15 minute boundary timestamps are accepted. | ||
| #[test] | ||
| fn validate_timestamp_at_exact_boundaries_succeeds() { |
There was a problem hiding this comment.
This pins that a date exactly 15 minutes off is accepted. #805 measured 16 minutes either side, not exactly 15, so the boundary has no live measurement. Could you measure 15:00 and 15:01 on the live service? If that isn't possible, I'd drop this test and keep the 16 minute cases, so it doesn't lock in a guess.
|
In its skew texts, DynamoDB gives the instant that it read from the request date, in the UTC basic form. It does not echo the header value. These are its answers in us-east-1 on 21 November 2026. Each request went out twice and got the same answer both times.
The parse on main reads the first two values. With this PR, #1356 adds |
|
I read Lee's table against
I will approve once the two messages use |
What changes
When a request has an
X-Amz-Datetimestamp outside the ±15 minute clock skew window, ExtendDB returnedUnrecognizedClientExceptionwith the generic message"Signature expired: the signature is too old or the request date is too far in the future.".Amazon DynamoDB returns
InvalidSignatureException(HTTP 400) with specific messages indicating the direction and boundary times compared against the server clock:Signature expired: <date> is now earlier than <edge> (<server_time> - 15 min.)Signature not yet current: <date> is still later than <edge> (<server_time> + 15 min.)This PR updates
validate_timestampincrates/auth/src/sigv4/verify.rsto returnInvalidSignatureExceptionwith the directional messages and addsformat_iso8601_basic.Measurements
As reported and measured by the issue reporter in #805 against Amazon DynamoDB in
us-east-1on 2026-11-03 (and referenced in PR #792):InvalidSignatureExceptionSignature expired: 20261103T201550Z is now earlier than 20261103T201650Z (20261103T203150Z - 15 min.)InvalidSignatureExceptionSignature not yet current: 20261103T204750Z is still later than 20261103T204650Z (20261103T203150Z + 15 min.)(Note: Live AWS measurements were not performed in this workspace; they are cited directly from the reporter's findings in #805).
Tests & Validation
crates/auth/src/sigv4/verify.rs:validate_timestamp_expired_returns_invalid_signature_exception: verifies exactSignature expirederror code and text format against known epoch.validate_timestamp_future_returns_invalid_signature_exception: verifies exactSignature not yet currenterror code and text format against known epoch.validate_timestamp_at_exact_boundaries_succeeds: verifies exact ±15 minute boundary timestamps are accepted.validate_timestamp_live_clock_succeeds_for_now: verifies current timestamps validate cleanly against system clock.cargo test -p extenddb-auth(441 unit tests, 3 doctests passed).cargo fmt --checkandcargo clippy -p extenddb-auth --all-targets -- -D warningspassed cleanly.CONTRIBUTING & RFC / Auth Policy Note
Under
CONTRIBUTING.md, an RFC is requested for changes to wire protocol or authentication/authorization. Meanwhile,docs/rfcs/README.mdnotes that an RFC is not required for bug fixes, dependency bumps, internal refactors that preserve public behavior, documentation, or tests.This PR does not alter ExtendDB's authentication model, the 15-minute window threshold, or the constant-time pipeline invariants. However, because it alters the returned error type and message for out-of-skew requests on the wire, this PR is submitted as a draft to seek maintainer review on whether this bug fix falls under standard bug fix treatment or requires an RFC or ADR.
Provenance & Disclosure
Checklist
cargo test -p extenddb-auth)cargo fmt --check)cargo clippy -p extenddb-auth --all-targets -- -D warnings)