Repository navigation
fix(core): answer a request with no Authorization header as DynamoDB does - #1290
Conversation
…does For a request with no Authorization header, ExtendDB sent the type MissingAuthenticationToken and the message "Missing Authentication Token". DynamoDB sends the type MissingAuthenticationTokenException and the message "Request is missing Authentication Token". DynamoDB gave this answer to ListTables, DescribeTable and GetItem in us-east-1 on 21 Nov 2026. Both send HTTP 400. DynamoDbError::missing_authentication_token builds the error with the measured message. The auth provider and the X-Amz-Target parser call it, so the code holds one copy of the message. The docs that name this error's type give the new type and message, and HTTP 400 where they give a status. The wire test of the no-header case sends four requests and checks the type, the message and X-Amz-Crc32. This commit removes a second test of the same request, which had weaker checks. Fixes #1075.
LJMart11
left a comment
There was a problem hiding this comment.
Reviewed at 208171f.
1 finding is left inline.
Docs — outside the diff
docs/manuals/07-upgrade-manual.md:385— Please add an entry under "Behavior Changes by Release" for the new error code. When botocore 1.42.78 parses the base body, it givesError.CodeMissingAuthenticationToken. With this head's body it givesMissingAuthenticationTokenException, so client code that compares the code for equality, or usesendswith("MissingAuthenticationToken")as the removedtest_auth_permissions.pytest did, stops matching after the upgrade. A short entry naming the old and new code and message would close this.
| DynamoDbError::UnknownOperationException(String::new()) | ||
| } else { | ||
| DynamoDbError::MissingAuthenticationToken("Missing Authentication Token".to_owned()) | ||
| DynamoDbError::missing_authentication_token() |
There was a problem hiding this comment.
The Testing section says cargo test -p extenddb-server --lib passed 513 tests. At this head, under Rust 1.91.1, that binary runs and passes 518. The other two counts match: extenddb-core lib passes 1146 with 1 ignored, and extenddb-auth runs 550 in total. Updating the server number would close this.
demohan
left a comment
There was a problem hiding this comment.
A request with no Authorization header answers as DynamoDB does at 208171f. Of 46 unsigned request shapes sent twice each to us-east-1, a SQLite build of this head matches the service byte for byte on the four test rows and on bodies {}, [] and {"Limit":0}, X-Amz-Date or a security token alone, and an Authorization of byte E9 or é: 400, the same body and X-Amz-Crc32 2088342776, where main sends the old body. An unknown operation and a body over 16 MiB are still refused ahead of this check, as on the service. Reverting the type, the message or the auth call site fails all four rows, fmt, clippy and the 1.91.1 check are clean, and CI is green on 64 of 64 with the rows passing on all four backends.
Two lines of the body read differently from what I measured. Under "Not in this PR", the service does not treat every header that does not start with the algorithm as missing: Bearer abc, Bearer a=b and a lower-case aws4-hmac-sha256 ... answer IncompleteSignatureException, while abc, Foo a=b, AWS AKIA...:abc and a tab answer as no header. And the open PRs have moved since the conflict check: #635 asserts the old type and message in two dev-mode tests, and #1295 rewrites the same ok_or_else at crates/auth/src/lib.rs:140 and adds two copies of the old message in sigv4/parse.rs.
| } | ||
|
|
||
| impl DynamoDbError { | ||
| /// The error for a request with no `Authorization` header (measured 2026-11-21). |
There was a problem hiding this comment.
Optional. No Rust test pins this type or message: with both reverted, the core, auth and server unit tests pass, and only the wire rows fail.
* chore(release): bump version to 1.1.0 Moves the workspace version from 1.0.0 to 1.1.0 on every surface that carries it: the root Cargo.toml version and its 13 exact pins, the 15 workspace entries in Cargo.lock (no third-party entry changes), packaging/npm/package.json (the version and the five platform pins), the four license-notice files (regenerated with cargo-about 0.9.0), and the sample `extenddb version` and `serve` output in docs/getting-started.md and docs/manuals/04-quickstart-setup-guide.md. This is a minor release. Since v1.0.0, main has three features (#468, #1009, #1449) and changes that make ExtendDB answer as DynamoDB does, which docs/versioning.md ships in a minor release. It adds no catalog migration (RELEASED_THROUGH stays 12, the last id), no configuration key and no backup format version. Upgrade manual, Behavior Changes by Release: v1.1.0 entries for #468 (AT_TIMESTAMP, and the GetShardIterator answers it changes), #486, #503, #544, #567, #765 and #774, #588, #596, #690, #963, #1144, #1173, #1194, #1375 and #1522, next to the existing entries for #398, #526, #1166, #1449 and #1523. The #526 entry now gives the old TransactWriteItems mismatch message, the #1523 heading takes the v1.1.0: prefix, and the entries are in PR order. Current Status, the General Upgrade Procedure and the Rollback Procedure cover 1.0.0 to 1.1.0: no migrate step, the #1166 checks before a PostgreSQL upgrade, and a rollback runs the 1.0.0 binary on the same catalog, with the two limits the manual names (#526 tokens, and 1.0.0's catalog-check --fix). The rollback note of the KEK-file switch says that 1.0.0 serves a switched catalog. docs/manuals/11-deployment-guide.md: a sentence about the release before the one that carries #398 is gone. docs/troubleshooting.md: the bus error entry names 1.0.0 as the release that has the bug, so its line carries a version-literal-ok marker. * docs(upgrade): add the v1.1.0 entry of #1290, put #1349's in order #1290 merged after this branch was rebased. It changes the answer to a request with no Authorization header, so it gets a v1.1.0 entry. The merge of main put the #1349 entry after the #1523 entry. It moves to the place of its number, beside the new #1290 entry. --------- Co-authored-by: Lee Hannigan <29015211+LeeroyHannigan@users.noreply.github.com>
Since #1290, the server gives a request with no Authorization header the type MissingAuthenticationTokenException and the message "Request is missing Authentication Token". DynamoDB sends this answer. The tests test_same_request_without_a_marker_is_not_refused and test_a_listed_host_is_not_refused compared the body with the earlier type and message. They failed in the merge queue run of 27 Nov, on main c175e42.
parse_authorization takes the bytes of the value, whether the request has a date header, and whether the operation reads the parts by position. On the item operations the parts are split at commas, spaces and tabs, as on the other operations. The parse refuses a part with no key wherever it sits. A request with no Authorization header gets DynamoDbError::missing_authentication_token(), the text that main sends since #1290. A value that starts with neither AWS4- nor Bearer and a space gets the same answer. Measured in us-east-1 on 2 and 3 Dec 2026, each request twice.
Main is at c057660, 20 commits after 5026c89, the main commit of the last merge (009c4c1). No file conflicted. Two files that this branch changes also change on main. Git merged both with no overlap: - crates/engine/src/lib.rs: #481 adds the query_key_size_tests module next to the scan_request module of this branch. - crates/server/src/request_helpers.rs: #1290 changes how extract_operation builds the MissingAuthenticationToken error. This branch changes authorize_request.
What
A request with no
Authorizationheader now gets the typeMissingAuthenticationTokenExceptionand the messageRequest is missing Authentication Token, as DynamoDB sends. Before this change, ExtendDB sent the typeMissingAuthenticationTokenand the messageMissing Authentication Token. The status stays HTTP 400.The new constructor
DynamoDbError::missing_authentication_tokenincrates/core/src/error/mod.rsholds the message.BuiltinAuthProvider::authenticateincrates/auth/src/lib.rsandextract_operationincrates/server/src/request_helpers.rscall it, so the code holds one copy of the message. Before this change, each of them wrote its own copy.error_typenow returnsMissingAuthenticationTokenException. The Rust variant keeps its name.The docs that name this error's type now give the new type and message. The variant's doc comment and the row of
docs/design/01-requirements.mdnow give HTTP 400, the status both servers send.The wire test
test_missing_auth_headerintests/test_auth_integration.pyis now one table of four requests. Each row checks the status, the whole body andX-Amz-Crc32. This PR removestest_missing_auth_headerfromtests/test_auth_permissions.py, which sent the first request again with weaker checks.Fixes #1075
Why
These are DynamoDB's answers, measured in us-east-1 on 21 November 2026. Each request went out twice and got the same answer both times. No request carries a signature.
{"Limit": 1}, Content-Typeapplication/x-amz-json-1.0, noAuthorization{"__type":"com.amazon.coral.service#MissingAuthenticationTokenException","message":"Request is missing Authentication Token"},X-Amz-Crc322088342776MissingAuthenticationToken,Missing Authentication Tokenapplication/jsonAuthorizationX-Amz-Dateand noAuthorizationAuthorizationof the single byteE9For the second row, DynamoDB answers in
application/json, and ExtendDB inapplication/x-amz-json-1.0(#1020).Testing done
cargo test -p extenddb-core --lib: 1146 passed.cargo test -p extenddb-auth: 550 passed.cargo test -p extenddb-server --lib: 513 passed. On this host 5backup_store::testsfail on every branch, because uid 65534 owns/local/home.cargo +1.97.0 clippy -p extenddb-core -p extenddb-auth -p extenddb-server --all-targets -- -D warningsandcargo +1.97.0 fmt --all -- --checkare clean.tests/test_auth_integration.py,tests/test_auth_permissions.pyandtests/test_auth_error_fidelity.pypassed 174 tests. Against a server built from origin/main, the four new rows fail.Line counts: production +10 -6, tests +19 -24, docs +3 -3.
This PR adds no conflict with the open PRs. Twelve open PRs name the old type. Where their tests check it, they check that the type starts with or contains
MissingAuthenticationToken, which the new type passes.Not in this PR:
Authorizationheader that is empty, holds only spaces, or does not start with the algorithm. DynamoDB answers these as a request with no header, and ExtendDB answersIncompleteSignatureException(Other malformed Authorization headers get other IncompleteSignatureException texts than DynamoDB's #1270).X-Amz-Algorithmand no other signing member: DynamoDB answersIncompleteSignatureExceptionwith the list of missing parameters (A request with X-Amz-Algorithm in the query string and no other signing member gets MissingAuthenticationToken, where DynamoDB lists the missing query-string parameters #1286).X-Amz-Targetand noAuthorization: DynamoDB answersUnknownOperationExceptionwith no message (A request with no X-Amz-Target and no Authorization gets MissingAuthenticationToken, where DynamoDB answers UnknownOperationException #1287).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.