Skip to content

fix(core): answer a request with no Authorization header as DynamoDB does - #1290

Merged
LeeroyHannigan merged 1 commit into
mainfrom
fix/1075-missing-token-type
Nov 27, 2026
Merged

LeeroyHannigan merged 1 commit into
mainfrom
fix/1075-missing-token-type

Conversation

@LeeroyHannigan

Copy link
Copy Markdown
Collaborator

What

A request with no Authorization header now gets the type MissingAuthenticationTokenException and the message Request is missing Authentication Token, as DynamoDB sends. Before this change, ExtendDB sent the type MissingAuthenticationToken and the message Missing Authentication Token. The status stays HTTP 400.

The new constructor DynamoDbError::missing_authentication_token in crates/core/src/error/mod.rs holds the message. BuiltinAuthProvider::authenticate in crates/auth/src/lib.rs and extract_operation in crates/server/src/request_helpers.rs call it, so the code holds one copy of the message. Before this change, each of them wrote its own copy. error_type now returns MissingAuthenticationTokenException. 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.md now give HTTP 400, the status both servers send.

The wire test test_missing_auth_header in tests/test_auth_integration.py is now one table of four requests. Each row checks the status, the whole body and X-Amz-Crc32. This PR removes test_missing_auth_header from tests/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.

Request DynamoDB ExtendDB before ExtendDB with this PR
ListTables {"Limit": 1}, Content-Type application/x-amz-json-1.0, no Authorization 400, {"__type":"com.amazon.coral.service#MissingAuthenticationTokenException","message":"Request is missing Authentication Token"}, X-Amz-Crc32 2088342776 MissingAuthenticationToken, Missing Authentication Token DynamoDB's body byte for byte, the same CRC
The same with Content-Type application/json the same body the same as the row above the same as the row above
DescribeTable and GetItem of a missing table, no Authorization the same body the same the same
ListTables with X-Amz-Date and no Authorization the same body the same the same
ListTables with an Authorization of the single byte E9 the same body the same the same

For the second row, DynamoDB answers in application/json, and ExtendDB in application/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 5 backup_store::tests fail 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 warnings and cargo +1.97.0 fmt --all -- --check are clean.
  • Against ExtendDB on SQLite, tests/test_auth_integration.py, tests/test_auth_permissions.py and tests/test_auth_error_fidelity.py passed 174 tests. Against a server built from origin/main, the four new rows fail.
  • The requests of the table went to a SQLite server built from this commit and got the answers shown.

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:

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.

@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 208171f.

1 finding is left inline.

Docs — outside the diff

  1. 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 gives Error.Code MissingAuthenticationToken. With this head's body it gives MissingAuthenticationTokenException, so client code that compares the code for equality, or uses endswith("MissingAuthenticationToken") as the removed test_auth_permissions.py test 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()

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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 demohan self-assigned this Nov 26, 2026

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

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

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.

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.

@LeeroyHannigan
LeeroyHannigan added this pull request to the merge queue Nov 27, 2026
Merged via the queue into main with commit c175e42 Nov 27, 2026
72 of 74 checks passed
@LeeroyHannigan
LeeroyHannigan deleted the fix/1075-missing-token-type branch November 27, 2026 11:57
LeeroyHannigan added a commit that referenced this pull request Nov 27, 2026
#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.
LeeroyHannigan added a commit that referenced this pull request Nov 27, 2026
* 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>
LeeroyHannigan added a commit that referenced this pull request Dec 1, 2026
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.
LeeroyHannigan added a commit that referenced this pull request Dec 3, 2026
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.
LeeroyHannigan added a commit that referenced this pull request Dec 3, 2026
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

3 participants