Skip to content

fix(server): answer a request with no X-Amz-Target as DynamoDB does - #1305

Open
LeeroyHannigan wants to merge 2 commits into
mainfrom
fix/1287-missing-target-unknown-operation
Open

LeeroyHannigan wants to merge 2 commits into
mainfrom
fix/1287-missing-target-unknown-operation

Conversation

@LeeroyHannigan

Copy link
Copy Markdown
Collaborator

What

A request with no usable X-Amz-Target header now gets UnknownOperationException with no message, with or without an Authorization header. Before, such a request with no Authorization header got MissingAuthenticationTokenException.

extract_operation in crates/server/src/request_helpers.rs now 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 the Authorization header and its comment are gone.

The tests:

  • One unit test of the missing header replaces the two tests of it. One of them pinned the old answer.
  • test_missing_target in tests/test_auth_integration.py sends five requests with no usable X-Amz-Target. It checks the status, the body and X-Amz-Crc32.
  • The Rust raw HTTP test missing_target_header expects UnknownOperationException and 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_operation in docs/design/06-component-server.md gives 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 POST to / with the Content-Type application/x-amz-json-1.0 and the body {"Limit": 1} unless the row says otherwise.

  • UO is HTTP 400 {"__type":"com.amazon.coral.service#UnknownOperationException"}, X-Amz-Crc32 1368724161.
  • MAT is HTTP 400 MissingAuthenticationTokenException, Request is missing Authentication Token.
Request DynamoDB ExtendDB on #1290 ExtendDB with this PR
no X-Amz-Target, no Authorization UO MAT UO
the same with an empty body UO MAT UO
the same with the body not json UO MAT UO
the same with the body {} UO MAT UO
the same with the Content-Type application/json UO MAT UO
the same with X-Amz-Date UO MAT UO
the same with X-Amz-Security-Token: abc UO MAT UO
the same at /?X-Amz-Algorithm=AWS4-HMAC-SHA256 UO MAT UO
X-Amz-Target with the one byte FF, no Authorization UO MAT UO
no X-Amz-Target, a SigV4 Authorization and X-Amz-Date UO UO UO
no X-Amz-Target, Authorization: Bearer abc UO UO UO
X-Amz-Target: DynamoDB_20120810.NoSuchOperation, no Authorization UO UO UO
X-Amz-Target with an empty value UO UO UO
X-Amz-Target: DynamoDB_20120810.ListTables, no Authorization MAT MAT MAT
no X-Amz-Target, no Authorization, no Content-Type HTTP 404 with an HTML page MAT UO
X-Amz-Target: DynamoDB_20120810.ListTables, the body not json, no Authorization SerializationException with no message SerializationException with a message the same as on #1290

With 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 SerializationException is #1195.

Testing done

  • cargo test -p extenddb-server: 512 unit tests passed. On this host 5 backup_store::tests fail on every branch, because uid 65534 owns /local/home.
  • cargo +1.97.0 clippy -p extenddb-server --all-targets -- -D warnings and cargo +1.97.0 fmt --all -- --check are clean.
  • Against ExtendDB on SQLite, tests/test_auth_integration.py, tests/test_auth_error_fidelity.py and tests/test_auth_permissions.py passed 179 tests. The 16 requests went to servers of the same build and got the answers in the table.
  • This PR's version of tests/test_auth_integration.py against fix(core): answer a request with no Authorization header as DynamoDB does #1290: 4 of the 5 new rows fail. The Bearer abc row passes on fix(core): answer a request with no Authorization header as DynamoDB does #1290 too. It covers the Authorization path that this change folds into the common path.
  • cargo test --manifest-path tests/rust/Cargo.toml raw_http against ExtendDB: 10 passed.
  • These runs used the commit before its last amend. The amend made the unit test one case and changed the commit message.
  • handle_request behind POST / is the only caller of extract_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 and X-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

  • 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.

…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.
@LeeroyHannigan
LeeroyHannigan marked this pull request as ready for review November 23, 2026 11:28
Base automatically changed from fix/1075-missing-token-type to main November 27, 2026 11:57

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

  1. docs/manuals/07-upgrade-manual.md:385 — Add an entry under Behavior Changes by Release for the new answer to a request with no usable X-Amz-Target. With #1290's extract_operation built into the same server, 4 of the 5 test_missing_target rows got MissingAuthenticationTokenException; 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

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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

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.

A request with no X-Amz-Target and no Authorization gets MissingAuthenticationToken, where DynamoDB answers UnknownOperationException

3 participants