Repository navigation
fix(server): answer a request with no X-Amz-Target as DynamoDB does - #1305
LeeroyHannigan wants to merge 2 commits into
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.
ExtendDB answered a request with no X-Amz-Target header and no Authorization header with MissingAuthenticationTokenException. DynamoDB answers UnknownOperationException with no message. It gives the same answer with an Authorization header, with an empty or invalid body, and with X-Amz-Algorithm in the query string. Measured in us-east-1 on 21 Nov 2026. extract_operation now has one error path. A missing header, a value with a byte outside visible ASCII and a value with no known prefix all get UnknownOperationException. One unit test of the missing header replaces the two tests of it, one of which pinned the old answer. The wire test sends five requests with no usable X-Amz-Target and checks the body and X-Amz-Crc32. The Rust raw HTTP test of a missing target expects the new type and no longer skips DynamoDB. The design doc's sketch of extract_operation gives the new answer. Fixes #1287.
LJMart11
left a comment
There was a problem hiding this comment.
Reviewed at 4624686. The extenddb-server lib tests (517) and the new test_missing_auth_header and test_missing_target rows passed on a PostgreSQL-backed server; with #1290's extract_operation, 4 of the 5 new rows fail. The notes cover the merge with current main and the upgrade notes.
1 finding is left inline.
Docs — outside the diff
docs/manuals/07-upgrade-manual.md:385— Add an entry under Behavior Changes by Release for the new answer to a request with no usableX-Amz-Target. With #1290'sextract_operationbuilt into the same server, 4 of the 5test_missing_targetrows gotMissingAuthenticationTokenException; at this head all 5 get{"__type":"com.amazon.coral.service#UnknownOperationException"}, so a raw-HTTP probe or script that matched on the old type sees a different answer after upgrading. The section has no entry for this change at the head or on current main.
| // DynamoDB answers UnknownOperationException when the header is absent or | ||
| // names no operation, with or without an Authorization header (measured | ||
| // 2026-11-21). | ||
| headers |
There was a problem hiding this comment.
This branch no longer merges with current main. This comes from main moving, not from the change: #1290 landed as c175e42 with the old Authorization branch calling missing_authentication_token(), and git merge-tree --write-tree c175e427 4624686 reports conflicts in crates/server/src/request_helpers.rs (this extract_operation body) and tests/test_auth_integration.py (the new test_missing_target block). Rebasing onto main and keeping this branch's side of both hunks would close it; the body's "no conflict with origin/main" line needs the same update.
navareamol
left a comment
There was a problem hiding this comment.
The description says the base of this PR is #1290, that the production change is +9 -15, and that the PR adds no conflict with main. On GitHub the base is main, and the branch holds #1290's commit 208171f (merged to main as c175e42) plus your commit. The diff against main is 10 files, +68 -72, and merging it with main conflicts in request_helpers.rs and test_auth_integration.py. Can you rebase on main so only your commit remains, and update the base, the line counts and the conflict line in the description?
I think a request with no target and a body over the size limit still answers RequestEntityTooLargeException, because handler.rs reads the body before it calls extract_operation. The description's rule is UnknownOperationException with or without Authorization. Has anyone measured what DynamoDB answers for no target and an oversized body? If it answers UnknownOperationException, the order needs to change. If it answers 413, can a row for it go in the description?
The sketch in docs/design/06-component-server.md calls DynamoDbError::unknown_operation, which does not exist. Can it use the variant name?
I will approve once the branch is rebased and green on main and the oversized body question is answered.
What
A request with no usable
X-Amz-Targetheader now getsUnknownOperationExceptionwith no message, with or without anAuthorizationheader. Before, such a request with noAuthorizationheader gotMissingAuthenticationTokenException.extract_operationincrates/server/src/request_helpers.rsnow has one error path. A missing header, a value with a byte outside visible ASCII and a value with no known prefix all reach it. The branch on theAuthorizationheader and its comment are gone.The tests:
test_missing_targetintests/test_auth_integration.pysends five requests with no usableX-Amz-Target. It checks the status, the body andX-Amz-Crc32.missing_target_headerexpectsUnknownOperationExceptionand no longer skips DynamoDB. Its comment said that DynamoDB requires SigV4 auth on every request, and the measurement below contradicts it.The sketch of
extract_operationindocs/design/06-component-server.mdgives the new answer.The base of this PR is #1290, which changes the same lines.
Fixes #1287
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. Each request is a
POSTto/with the Content-Typeapplication/x-amz-json-1.0and the body{"Limit": 1}unless the row says otherwise.{"__type":"com.amazon.coral.service#UnknownOperationException"},X-Amz-Crc321368724161.MissingAuthenticationTokenException,Request is missing Authentication Token.X-Amz-Target, noAuthorizationnot json{}application/jsonX-Amz-DateX-Amz-Security-Token: abc/?X-Amz-Algorithm=AWS4-HMAC-SHA256X-Amz-Targetwith the one byte FF, noAuthorizationX-Amz-Target, a SigV4AuthorizationandX-Amz-DateX-Amz-Target,Authorization: Bearer abcX-Amz-Target: DynamoDB_20120810.NoSuchOperation, noAuthorizationX-Amz-Targetwith an empty valueX-Amz-Target: DynamoDB_20120810.ListTables, noAuthorizationX-Amz-Target, noAuthorization, no Content-TypeX-Amz-Target: DynamoDB_20120810.ListTables, the bodynot json, noAuthorizationSerializationExceptionwith no messageSerializationExceptionwith a messageWith this change, 14 of the 16 requests get DynamoDB's answer, where 5 did on #1290. The other two differ on both trees: the HTML page for a request with no Content-Type is #1020, and the message of the
SerializationExceptionis #1195.Testing done
cargo test -p extenddb-server: 512 unit tests passed. On this host 5backup_store::testsfail on every branch, because uid 65534 owns/local/home.cargo +1.97.0 clippy -p extenddb-server --all-targets -- -D warningsandcargo +1.97.0 fmt --all -- --checkare clean.tests/test_auth_integration.py,tests/test_auth_error_fidelity.pyandtests/test_auth_permissions.pypassed 179 tests. The 16 requests went to servers of the same build and got the answers in the table.tests/test_auth_integration.pyagainst fix(core): answer a request with no Authorization header as DynamoDB does #1290: 4 of the 5 new rows fail. TheBearer abcrow passes on fix(core): answer a request with no Authorization header as DynamoDB does #1290 too. It covers theAuthorizationpath that this change folds into the common path.cargo test --manifest-path tests/rust/Cargo.toml raw_httpagainst ExtendDB: 10 passed.handle_requestbehindPOST /is the only caller ofextract_operation. Its error returns with no metric and no log line, before and after this change.The first wire row, with no
Authorization, and the Rust test send requests of the same kind. Both stay: the Rust test runs against DynamoDB too, and the wire row checks the whole body andX-Amz-Crc32.Line counts: production +9 -15, tests +27 -24, docs +1 -1.
This PR adds no conflict with origin/main or with an open PR that changes its files.
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.