Skip to content

fix(auth): read the request date in the basic and extended ISO-8601 forms - #1356

Open
LeeroyHannigan wants to merge 6 commits into
fix/1289-date-headerfrom
fix/1302-iso-date-forms
Open

LeeroyHannigan wants to merge 6 commits into
fix/1289-date-headerfrom
fix/1302-iso-date-forms

Conversation

@LeeroyHannigan

@LeeroyHannigan LeeroyHannigan commented Nov 22, 2026 •

Copy link
Copy Markdown
Collaborator

Changes since the last review

What

The server now reads the request date in the ISO-8601 forms below, which DynamoDB reads, and it uses the date as DynamoDB does. This applies to X-Amz-Date, and to Date when the request has no X-Amz-Date header.

  • The date is YYYYMMDD or YYYY-MM-DD, from the year 0001. The time follows an upper-case T and is HHMMSS or HH:MM:SS. The date and the time each use either form.
  • A fraction and a zone can follow the time. The fraction is a . and zero to nine digits. The zone is Z, z or an offset with either sign: +01:00, +0100 or +01. A time with no zone is UTC.
  • The sign of an offset applies to its hours only, as DynamoDB reads it. -03:30 is 2 hours 30 minutes behind UTC, and -00:30 is 30 minutes ahead of UTC.
  • A date alone, or a date and a T with nothing after it, is midnight UTC.
  • Each part has a limit: month 12, day 31, hour 24, minute 60 and second 60. The offset hours and minutes can be any two digits. The server then adds up the parts with no calendar check. Month 00 is January, and day 00 is the day before the first. 2026-02-30 is 2 March, and T24:00:00 is the next midnight.
  • These values get DynamoDB's basic format text:
    • a part over its limit, or the year 0000
    • a fraction of ten or more digits, or a , before or in the fraction
    • a lower-case t, or a space in place of T
    • a time without seconds, or a time of five digits, with a zone after it
    • a separator at only one of its two places
    • an offset hour of one digit, or text after the offset
    • a date with a zone and no time, or a T with only a zone
  • The server converts the instant to UTC and writes it as YYYYMMDDTHHMMSSZ, with no fraction. It uses this UTC basic form for the 15 minute check, the scope date and the date line of the string to sign. The x-amz-date and date canonical headers keep the value as sent.

Before, the server read only the basic form with a Z. It also read basic values with a part over its limit, such as month 13, which DynamoDB refuses.

In crates/auth/src/sigv4/verify.rs, parse_request_date replaces parse_iso8601_basic. request_instant reads the request date and returns the instant or the basic format text. basic_form writes the UTC basic form. validate_timestamp returns that form for check_scope, and verify_signature uses it for the scope date and the string to sign. Three test helpers call basic_form in place of their own copies of the format: make_headers_with_auth in crates/auth/src/tests.rs, make_date_stale in crates/auth/src/scope_tests.rs and the window test in verify/tests.rs.

The first commit moves the test module of verify.rs (lines 249 to 629) to crates/auth/src/sigv4/verify/tests.rs with no other change. Each moved line is four spaces less indented. The second commit has the fix. The merge and the three commits after it are the changes since the last review.

The base of this PR is #1306, which reads the Date header and checks the date before the rest of the Authorization parse.

Why

Fixes #1302

These are DynamoDB's answers, measured in us-east-1 on 21 and 22 November and on 3 December 2026. Each request went out twice and got the same answer both times. Each date is the time of the send unless the row gives another time. ExtendDB got the same forms at the time of its run.

  • U, V, M, N, F, L, Y and Z rows are DescribeTable requests of a table that does not exist. The Authorization value used the documentation's example key and a signature of 64 zeros.
  • S rows are ListTables requests, signed with the credentials of an AWS account. The row names the date line of the string to sign. The x-amz-date canonical header is the value as sent.

The answers:

  • UCE is UnrecognizedClientException, The security token included in the request is invalid. The service read the date and did not find the key.
  • FORMAT is IncompleteSignatureException, Date must be in ISO-8601 'basic format'. Got '<value>'. See http://en.wikipedia.org/wiki/ISO_8601.
  • MISMATCH is InvalidSignatureException, the signature mismatch text.
  • EXPIRED(t) and FUTURE(t) are DynamoDB's InvalidSignatureException texts for a date outside the 15 minute window. Each text gives the instant t that the service read.
  • SKEW is ExtendDB's text for the same case: UnrecognizedClientException, Signature expired: the signature is too old or the request date is too far in the future.
Row X-Amz-Date DynamoDB ExtendDB on #1306 ExtendDB with this PR
U1 2026-11-21T22:06:32Z UCE FORMAT UCE
U3 2026-11-21T22:06:34.123456Z UCE FORMAT UCE
U5 2026-11-21T23:06:35+01:00 UCE FORMAT UCE
U6 2026-11-21T22:06:36 UCE FORMAT UCE
U12 2026-11-21T220639Z UCE FORMAT UCE
U22 2026-11-21T23:08:03+01 UCE FORMAT UCE
U23 2026-11-21T22:08:04.Z UCE FORMAT UCE
V8 2026-11-23T00:56:18+26:00 UCE FORMAT UCE
U7 2026-11-21t22:06:36z FORMAT FORMAT FORMAT
U24 2026-11-21T22:08Z FORMAT FORMAT FORMAT
V6 2026-11-21T22:56:17,123Z FORMAT FORMAT FORMAT
M1 20261321T225656Z FORMAT SKEW FORMAT
M9 20261121T225799Z FORMAT UCE FORMAT
M3 20261100T225657Z EXPIRED(20261031T225657Z) SKEW SKEW
M12 2026-11-21T24:00:00Z FUTURE(20261122T000000Z) FORMAT SKEW
U18 2026-11-22T01:07:13+03:00, scope date the UTC day UCE FORMAT UCE
U19 the same value, scope date the local day the scope date text FORMAT the scope date text
S3 2026-11-21T22:06:45Z, date line 20261121T220645Z 200 FORMAT 200
S2 2026-11-21T22:06:44Z, date line as sent MISMATCH FORMAT MISMATCH
S8 2026-11-22T01:07:15+03:00, date line 20261121T220715Z 200 FORMAT 200
S9 the same value, date line 20261122T010715Z (the local time) MISMATCH FORMAT MISMATCH
S12 20261122T005260Z, date line 20261122T005300Z 200 MISMATCH 200
S13 the same value, date line as sent MISMATCH 200 MISMATCH

The local day of U18 and U19 is the day after the UTC day. ExtendDB got U18 and U19 with a -03:00 offset at 01:48Z, so that the local day was again not the UTC day.

The rows of 3 December went out from 13:05:03Z to 13:05:15Z. The ExtendDB column is a server built from the head, on SQLite and on PostgreSQL, with the same forms from 13:58Z to 14:00Z. A value that carries the time of the send carried the new time. Both backends gave the same answers. On #1306, each value that is not in the basic form gets FORMAT.

Row Date header and value DynamoDB ExtendDB with this PR
N1 X-Amz-Date: 2026-01-01T00:00:00-03:30 EXPIRED(20260101T023000Z) SKEW
N2 Date: 2026-01-01T00:00:00-03:30 EXPIRED(20260101T023000Z) SKEW
N3 X-Amz-Date: 2026-12-03T10:35:04-03:30 UCE UCE
N4 X-Amz-Date: 20261203T103505-0330 UCE UCE
N5 X-Amz-Date: 2026-12-03T13:35:05-00:30 UCE UCE
F9 X-Amz-Date: 2026-12-03T13:05:06.123456789Z UCE UCE
F10 X-Amz-Date: 2026-12-03T13:05:07.1234567890Z FORMAT FORMAT
L1 X-Amz-Date: 20261203T136107Z FORMAT FORMAT
L2 X-Amz-Date: 20261203T130561Z FORMAT FORMAT
L3 X-Amz-Date: 20261232T130509Z FORMAT FORMAT
L4 X-Amz-Date: 2026-12-03T13:05:09+5:30 FORMAT FORMAT
L5 X-Amz-Date: 2026-12-03T13:05:10+05:30:00 FORMAT FORMAT
L6 X-Amz-Date: 2026-12-03T13:05:10.12,3Z FORMAT FORMAT
L7 X-Amz-Date: 20261231T000000Z FUTURE(20261231T000000Z) SKEW
L8 X-Amz-Date: 20261121T240100Z EXPIRED(20261122T000100Z) SKEW
Y0 X-Amz-Date: 00001203T130512Z FORMAT FORMAT
Y1 X-Amz-Date: 00010101T000000Z EXPIRED(00010101T000000Z) SKEW
Y9 X-Amz-Date: 99991231T240000Z FUTURE(100000101T000000Z) FORMAT
Z1 X-Amz-Date: 2026-12-03T13:05:14z UCE UCE

On #1306, 15 of the 62 rows of 21 November get DynamoDB's answer. At 58f1097, 51 of those 62 rows got DynamoDB's type name and message, and so did the 5 rows of 22 November. Every row that got DynamoDB's answer on #1306 still got it. The other 11 rows are U9, U14, V5, V11, V14, M3, M4, M5, M10, M11 and M12. In these rows, the server reads the instant that DynamoDB's text gives. It then refuses the date with the 15 minute check, with ExtendDB's type and text (#805, PR #889).

The changes since the last review read four kinds of value in a new way. They are a negative offset with minutes, a fraction of ten or more digits, the year 0000 and a lower-case z. The 62 rows did not go out again at this head. The rows of the first table keep their answers. U7 has a lower-case z, and its lower-case t still gets FORMAT.

botocore, which the AWS CLI and boto3 use, writes X-Amz-Date in the basic form from a datetime. For a basic value whose parts are a valid date and time, basic_form gives back the same bytes. So these requests get the same scope date and date line as before.

An instant after the year 9999, such as 99991231T240000Z, gets FUTURE(100000101T000000Z) from DynamoDB (measured on 3 December). A build of the server without the MongoDB crate refuses it with FORMAT, because the time crate stops at the year 9999. A build with the MongoDB crate gets SKEW, because bson turns on the large-dates feature of time. Neither build authenticates the request. The value is outside the 15 minute window.

#889 adds format_iso8601_basic, which writes the same form as basic_form. The PR that merges second should call the function of the other PR and remove its own. DynamoDB's skew texts give the instant in the UTC basic form (M3, V11), which is basic_form(request).

Testing done

  • cargo +1.97.0 test -p extenddb-auth --no-fail-fast on the head: 548 unit tests, 14 sigv4_differential tests and 3 doc tests passed. cargo +1.97.0 test -p extenddb-core --lib passed 1,260 tests. cargo +1.97.0 test -p extenddb-server --lib passed 521 tests. The 5 backup_store::tests that fail on the test host (storage-sqlite: the two write_lock_tests fail when an ancestor of the Cargo target directory is owned by another user #1414) failed there too.
  • cargo +1.97.0 fmt --all -- --check is clean. Both clippy commands of .github/workflows/clippy.yml (cargo +1.97.0 clippy --all-targets with each feature set, -D warnings) are clean, and so are cargo +1.94.0 check -p extenddb-auth --all-targets and the WebAssembly clippy step. cargo test -p extenddb-wasm-adapter passed, with the parity corpus. cargo fuzz build of sigv4_authorization, sigv4_verify and sigv4_timestamp passed, and so did the doc_version_literals test.
  • The unit tests hold the measured rows. One table has 67 date forms, each with its UTC basic form or the refusal. The other has 12 rows for the date line of the string to sign.
  • With a change since the last review put back, its row fails. That holds for the minus on the hours only, the limit of nine fraction digits, the refusal of the year 0000 and the read of z.
  • With one of these changes to the code, a row fails:
    • a minute or a second limit of 61, a day limit of 32 or a month limit of 11
    • an hour limit of 25, or a fraction limit of 10
    • no check of text after the offset, an offset hour of one digit, or a , in the fraction
  • A month limit of 13 still passes, because time::Month::try_from refuses month 13.
  • At 58f1097, with the acceptance rule of fix(auth): read the Date header and check the date as DynamoDB does #1306 put back, 31 rows of the two tables failed, and so did validate_timestamp_returns_the_utc_basic_form. With calendar limits (a calendar check of the date, hour 23, minute 59, second 59), 17 rows failed. They were 13 values that DynamoDB reads, and S12 to S15.
  • tests/test_auth_error_fidelity.py and tests/test_sigv4_scope_date.py passed 192 tests against ExtendDB on SQLite and 192 on PostgreSQL. Each server was a debug build of the head on 127.0.0.1.
  • A reference of the rule, written from the measurements, read 621,050 generated values. The parse gave the same instant or the same refusal for each value, except 15 instants after the year 9999. On the wire, 417 signed requests with random date forms got the answers that the reference gives. These two checks used the first version of the fix. Its production code differs from 58f1097 only in one match, which 58f1097 writes as map_or. The two checks do not cover the changes since the last review.

Line counts:

With origin/main at c057660, the head merges with no conflict. #949 and #1009 are in main and in #1306 now. Against the open PRs, this PR adds these conflicts to those of #1306:

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

Breaking changes

None for a client that writes X-Amz-Date in the basic form from a valid date and time, as the AWS SDKs do. A request whose date is in another form that DynamoDB reads now authenticates. A basic value with a part over its limit, such as second 99, gets IncompleteSignatureException, as on DynamoDB. Before, the server read such a value.


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.

Move the test module of crates/auth/src/sigv4/verify.rs to
crates/auth/src/sigv4/verify/tests.rs. Each line is four spaces less
indented, and `#[cfg(test)] mod tests;` takes the place of the module.
Nothing else changes.
ExtendDB read the request date only in the basic form YYYYMMDDTHHMMSSZ.
A date in the extended form got the 'basic format' text. So did a value
with a fraction, an offset, no zone or no time.

DynamoDB reads X-Amz-Date and Date as an ISO-8601 date and time, in the
basic or the extended form. A fraction and a zone are optional. The
zone is Z or an offset such as +01:00, +0100 or +01, and a time with no
zone is UTC. A date with no time, or with a T and nothing after it, is
midnight UTC.

Each part has a limit: month 12, day 31, hour 24, minute 60, second 60,
and two digits of offset hours and minutes. The service then adds up
the parts with no calendar check. Month 00 is January, day 00 is the day
before the first, and 2026-02-30 is 2 March. T24:00:00 is the next
midnight. A second of 60 is the next minute, and a minute of 60 the
next hour.

The service converts the instant to UTC and drops the fraction. The
skew check, the scope date and the date line of the string to sign use
this form. That is also true for a second or a minute of 60. The
x-amz-date and date canonical headers keep the value as sent. A part
over its limit gets the 'basic format' text. So do a lower-case t or z,
a space for T, a time without seconds and a time of five digits.
Measured in us-east-1 on 21 and 22 Nov 2026.

parse_request_date reads the measured forms into an instant with the
time crate, and basic_form writes the UTC basic form. validate_timestamp
returns that form, so the scope check and the string to sign use it.

Fixes #1302.

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

More request date forms are read as the service reads them at 58f1097, but two readings differ from the service in ways that let a request authenticate here that the service refuses (below). With DescribeTable and ListTables requests signed by hand, each sent twice to us-east-1 and to this head and its base 6306c32 on SQLite and PostgreSQL, the two backends answered alike on all 262 probes; this head differs from the service on 89 and the base on 154, and on 28 the base matched the service and this head does not. Where they agree: the string to sign carries the UTC basic form with the fraction cut off, second 60 and hour 24 roll over, hour 25, second 61, month 13 and day 32 are refused, +5:30 and +05:30:00 are refused, the scope date must be the UTC day, and under this head's own reading an offset cannot move a request outside the 15-minute check, which uses the same instant as the string to sign. The parser is linear and does not panic up to 200,000 bytes. fmt, clippy and the 1.91.1 check are clean, 47 of the 67 new Python rows fail on the base, nine controls fail as they should, and CI is green on 61 of 61.

The stack does not merge with main at 222d80a: verify.rs conflicts with #1009 (web_time) and tests.rs with #949 (now scope_tests.rs), besides #1295's conflict in lib.rs. Resolved by hand, with #1304 merged, fmt, clippy, the auth tests, the wasm build and the 1.94.0 check pass. The body's "no conflict with origin/main" no longer holds.

I will approve once a fraction of ten or more digits is refused, a negative offset with minutes is read as the service reads it, main is merged, and tests hold the field limits below.

Comment thread crates/auth/src/sigv4/verify.rs Outdated
return None;
}
let rest = rest
.strip_prefix('.')

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 service reads up to nine fraction digits and refuses ten or more with the basic format text, including .0000000000Z, with an offset and on a past date; this takes any number, so a correctly signed request with a ten-digit fraction answers 200 here where the service answers 400 IncompleteSignatureException, measured with ListTables and DescribeTable, twice each. The base refused every fraction, so these are new. Refusing more than nine digits, with rows for nine and ten, would match.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Fixed in ff0b97d. parse_request_date now refuses a fraction of ten or more digits with the basic format text.

I measured both lengths on 3 Dec at 13:05Z with DescribeTable requests of a table that does not exist, each sent twice. 2026-12-03T13:05:06.123456789Z got UnrecognizedClientException, so the service read the date. 2026-12-03T13:05:07.1234567890Z got IncompleteSignatureException with the basic format text.

Both values are rows of the unit table in crates/auth/src/sigv4/verify/tests.rs. nine-digit-fraction and ten-digit-fraction are rows of the same two forms in _DATE_FORMS in tests/test_auth_error_fidelity.py. With no limit, or with a limit of 10, the ten-digit row fails.

Comment thread crates/auth/src/sigv4/verify.rs Outdated
if !rest.is_empty() {
return None;
}
sign * (hours * 3600 + minutes * 60)

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.

For a negative offset with minutes, the service applies the minus to the hours only: it reads 2026-01-01T00:00:00-03:30 as 20260101T023000Z, and -00:30 as +00:30. This applies it to both, so a request dated 2026-11-28T21:57:28-03:30 sent at 01:27:28Z is accepted here and refused by the service as expired at 20261129T002728Z, while the value the service accepts (...T22:57:28-03:30) is refused here; the same holds in basic form (-0330), at -05:45 and through the Date header. No test has a negative offset with minutes.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Fixed in ff0b97d. The sign of an offset now applies to its hours only: parse_request_date computes sign * hours * 3600 + minutes * 60.

Measured on 3 Dec at 13:05Z, each request twice:

  • 2026-01-01T00:00:00-03:30 in X-Amz-Date got "Signature expired: 20260101T023000Z is now earlier than ...". The same value in Date, with no X-Amz-Date, got the same text.
  • 2026-12-03T10:35:04-03:30, 20261203T103505-0330 and 2026-12-03T13:35:05-00:30, sent at 13:05Z, got UnrecognizedClientException. So the service read each one as the time of the send.

These four values are rows of the unit table in crates/auth/src/sigv4/verify/tests.rs. minus-three-thirty, basic-minus-three-thirty and minus-zero-thirty are rows of _DATE_FORMS. X-Amz-Date and Date go through the same parse_request_date, and the_request_date_is_x_amz_date_else_date holds the choice of header. With the old sign rule, the first row fails with 20260101T033000Z.

None if !rest.is_empty() => return None,
None | Some("") => (0, ""),
Some(rest) => {
let (hour, minute, second, rest) = three::<u8>(rest, 2, ':')?;

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 service also reads forms this refuses: a time of hours, or hours and minutes, when no zone or fraction follows (20261129T0127 and 2026-11-29T01:29, signed as ...012700Z), a lower-case z (...T01:27:28z; the body's measurement put t and z in one value, and only t is refused), and an extended ordinal date (2026-333T01:27:28Z, 2026-333T012728Z; 2026-366 rolls into the next year and 2026-999 is refused). The doc comment above says the other way for each.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

The doc comment of parse_request_date now says what the code does (ff0b97d, with shorter sentences in 01d80a0).

parse_request_date reads a lower-case z now. On 3 Dec at 13:05Z, 2026-12-03T13:05:14z got UnrecognizedClientException twice. The value is a row of the unit table, and lower-case-z is a row of _DATE_FORMS. 2026-11-21t22:06:36z stays refused because of the t.

This PR still refuses a time of hours, or of hours and minutes, with nothing after it, and the extended ordinal date. Reading them needs a second form of the time parse and a day-of-year date, each with limits to measure. #1566 tracks them, with your rows. The doc comment names both forms as ones that the service reads and this parse refuses.

/// `t` or `z`, a space for `T`, a `,` before the fraction, a time without
/// seconds and a `T` followed by a zone alone are refused.
fn parse_request_date(s: &str) -> Option<time::OffsetDateTime> {
let (year, month, day, rest) = three(s, 4, '-')?;

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.

Year 0000 gets the basic format text on the service and Signature expired here; an instant past 9999 (99991231T240000Z) gets "not yet current" with 100000101T000000Z there and the format text here, and on the MongoDB build the time crate has large-dates enabled, so the body's "stops at 9999" depends on the build. Neither authenticates. No test holds the field limits: raising the minute, second or day limit by one, dropping the check for text after the offset, accepting a one-digit offset hour or a , in the fraction each pass the unit tests, though the service and this head refuse every value they would let through.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

The unit table and _DATE_FORMS now have rows one past each limit (ff0b97d). These are minute 61, second 61, day 32, +5:30, +05:30:00 and .12,3. On 3 Dec at 13:05Z the service refused each one with the basic format text, each request sent twice. Rows for month 12 (20261231T000000Z) and for 20261121T240100Z hold values that the service and this parse read. The service named 20261231T000000Z and 20261122T000100Z in its texts.

I changed the code one limit at a time and ran the unit table. Each of these changes fails a row:

  • a minute or second limit of 61
  • a day limit of 32, a month limit of 11 or an hour limit of 25
  • no check for text after the offset
  • a one-digit offset hour
  • a , in the fraction

A month limit of 13 still passes, because time::Month::try_from refuses month 13. The month 13 rows hold that limit.

This parse refuses year 0000 now. 00001203T130512Z got the basic format text from the service, and 00010101T000000Z got "Signature expired: 00010101T000000Z is now earlier than ...". Both values are rows.

99991231T240000Z stays as it is. The service answered "Signature not yet current: 100000101T000000Z is still later than ...". A build without the MongoDB crate answers the basic format text here. A build with it reads 10000-01-01 and answers the skew text, because bson turns on the large-dates feature of time. Neither build authenticates the request. The skew type and text differ from the service's for every date outside the window (#805). The PR body now gives the answer of each build and the service's measured answer.

The base now reads each byte of the request date as a Latin-1 character
and refuses a date that is not ASCII before the parse. It reads the clock
through web_time. It adds tests for a byte above 0x7F and for the window
of a Date header.

Conflicts:

- crates/auth/src/sigv4/verify.rs: parse_request_date keeps the ISO-8601
  forms of this branch and starts with the ASCII check of the base. The
  clock lines are those of the base, without the format comment. The doc
  comment of validate_timestamp names both refusals. The two new tests of
  the base go to verify/tests.rs, and the window test writes its dates
  with basic_form.
- crates/auth/src/tests.rs: the tests that the base moved to
  scope_tests.rs stay there. make_date_stale in scope_tests.rs calls
  basic_form, as this branch changed it in tests.rs.
- tests/test_auth_error_fidelity.py: both sets of date constants and both
  sets of tests stay. _BYTE_DATE_TEXT uses _BAD_DATE.
…DB does

DynamoDB applies the minus of a negative offset to the hours only. It
reads 2026-01-01T00:00:00-03:30 as 20260101T023000Z, in the extended
form, in the basic form and through the Date header. It reads -00:30 as
+00:30. The parse applied the minus to the minutes too. So a request
that the service refuses as expired was inside the window here. The
parse refused a date that the service reads as now.

DynamoDB reads up to nine fraction digits. Ten or more get the basic
format text, and so does year 0000. It reads year 0001. It reads a
lower-case z as the zone. The parse read any number of fraction digits
and year 0000, and it refused z.

parse_request_date now applies the sign to the hours only, refuses a
fraction of ten or more digits and year 0000, and reads z. Its doc
comment also names two forms that the service reads and the parse
refuses. They are a time of hours, or of hours and minutes, with nothing
after it, and an ordinal date.

The unit table and the Python table get a row for each case. Other rows
are one past a limit: minute 61, second 61, day 32 and a one-digit
offset hour. Text after the offset and a comma in the fraction get rows
too. Rows for month 12 and for hour 24 with minutes hold values that the
parse reads. Steps 3 and 4 of the security manual now give the forms
that the server reads, and the scope date as the UTC day.

Measured in us-east-1 on 3 Dec 2026, each request twice.
…he hours

The minute 60 rows of test_the_date_line_is_the_utc_basic_form wrote an
offset of minus the current minute as -00MM. DynamoDB applies the minus
of an offset to the hours only (measured 3 Dec 2026). So -00MM is MM
minutes ahead of UTC, and the rows failed with the parse of the last
commit.

The rows now write -01 and 60 - MM, which is MM minutes behind UTC. The
instant is still the current time at any hour.
The doc comment of parse_request_date and steps 3 and 4 of the security
manual had sentences of 27 to 54 words. Each one is now two or three
sentences, with the same facts. No code changes.
@LeeroyHannigan LeeroyHannigan changed the title fix(auth): read the request date in every ISO-8601 form DynamoDB reads fix(auth): read the request date in the basic and extended ISO-8601 forms Dec 3, 2026
@LeeroyHannigan

Copy link
Copy Markdown
Collaborator Author

@demohan The replies in the threads answer the fraction, the negative offset, the field limits and the forms not read.

Main: this branch now merges the head of #1306 (782ec83) in b0160d1. #1306 holds main at c8e66fb, with #1009 and #949, and #1295 is its base. git merge-tree of the new head with origin/main at c057660 gives no conflict. c057660 (#1446, a MongoDB change) is the one commit of main after c8e66fb, and it is not in this branch.

The merge keeps the ASCII check of #1306 at the start of parse_request_date. It moves the two new tests of #1306 to verify/tests.rs, and make_date_stale in scope_tests.rs now calls basic_form.

The body no longer says "no conflict with origin/main". It lists the conflicts with open PRs at the new head.

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.

2 participants