Skip to content

test(streams): check that ListStreams refuses a table ARN for every caller - #843

Open
LeeroyHannigan wants to merge 3 commits into
mainfrom
fix/796-list-streams-table-arn
Open

LeeroyHannigan wants to merge 3 commits into
mainfrom
fix/796-list-streams-table-arn

Conversation

@LeeroyHannigan

@LeeroyHannigan LeeroyHannigan commented Nov 5, 2026 •

Copy link
Copy Markdown
Collaborator

What

tests/test_authz_cross_account.py gains test_list_streams_refuses_a_table_arn_as_its_table_name. The test sends ListStreams with a table ARN in TableName for each of the five measured callers below. Each call must answer ValidationException "TableName must be at least 3 characters long and at most 255 characters long".

Why

Closes #796

The service reads this field as a name. It refuses a table ARN, whichever account the ARN names. Measured on 2026-11-03 in us-east-1, with ARNs of 54 to 57 characters:

Caller Account in the ARN Service answer
an admin another account that exists ValidationException, the text above
an admin an account that does not exist the same
no policy another account that exists the same
no policy an account that does not exist the same
no policy the caller's account the same

Main's table name gate (#830, crates/server/src/table_name_gate.rs) now refuses this ARN with the same text. It runs in authorize_request before the IAM decision and before the developer-mode return. This branch had its own copy of that refusal. The merge with main took main's side in the three Rust files, which drops the copy. Main's unit test covers the gate for one table ARN. This test covers the five callers on the wire.

The gate's text and bounds stay 3 and 255 on a deployment that sets other table name limits. #992 tracks that.

Testing done

  • python3 -m py_compile tests/test_authz_cross_account.py: no errors.
  • The test runs in CI against a server. I did not run it on this host.

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.

ListStreams reads TableName as a table name. The service answers a
table ARN there with ValidationException "TableName must be at least 3
characters long and at most 255 characters long", before the IAM
decision, for an admin and for a caller with no policy, whichever
account the ARN names (measured 2026-11-03 with ARNs of 54 to 57
characters). ExtendDB authorized table/<T>/stream/* in the caller's
account and listed no streams, or denied a caller with no policy.

check_list_streams_table_name refuses a TableName that parses as a
table ARN, with the deployment's table name bounds in the text. The
server runs it before authorization. The ListStreams handler runs it
too, for a server in developer mode, which skips authorization.

Closes #796
Comment thread crates/engine/src/streams.rs Fixed
Code scanning read the panic message of the new ListStreams test, which
printed the ARN built from a loop variable named account, as cleartext
logging of an account ID. The message no longer prints the ARN, and the
variable is named owner.
Main's table name gate (#830) already refuses a table ARN in the TableName of ListStreams. It answers with the same ValidationException text, before the IAM decision and before the developer-mode return. This branch's check is a second copy of that gate, so the merge takes main's side in the three files that hold it.

crates/engine/src/streams.rs keeps main's handler and test module, and drops this branch's check_list_streams_table_name, its call and its unit test.
crates/server/src/request_helpers.rs keeps main's authorize_request, which runs the gate, and drops this branch's call.
crates/engine/src/lib.rs keeps main's exports and drops the export of the removed check.
tests/test_authz_cross_account.py keeps this branch's wire test of the five measured callers, which main does not have.
@LeeroyHannigan LeeroyHannigan changed the title fix(streams): refuse a table ARN as the ListStreams table name test(streams): check that ListStreams refuses a table ARN for every caller Nov 14, 2026
@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.

I think the test is correct. On a PostgreSQL build of this head it passes. When I change the gate's ListStreams check so a table ARN is no longer refused, it fails with DID NOT RAISE, so it guards the right thing.

The description says the gate runs before the developer-mode return, but this test needs the builtin auth provider, so nothing on the wire in this PR covers the developer-mode case. Is that covered by another test, or can the sentence be cut from the description?

The description and the test comment say the rows were measured on 2026-11-03. The comment on ListStreams in table_name_gate.rs says the table ARN was measured on 2026-11-04. Which date is right?

The branch is 81 commits behind main. It merges cleanly. Can you update it so CI runs on the merged tree?

I will approve once the date is settled and the branch is updated with main and green.

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.

ListStreams accepts a table ARN in TableName; the service refuses it

3 participants