Repository navigation
test(streams): check that ListStreams refuses a table ARN for every caller - #843
LeeroyHannigan wants to merge 3 commits into
Conversation
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
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.
navareamol
left a comment
There was a problem hiding this comment.
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.
What
tests/test_authz_cross_account.pygainstest_list_streams_refuses_a_table_arn_as_its_table_name. The test sendsListStreamswith a table ARN inTableNamefor each of the five measured callers below. Each call must answerValidationException"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:
ValidationException, the text aboveMain's table name gate (#830,
crates/server/src/table_name_gate.rs) now refuses this ARN with the same text. It runs inauthorize_requestbefore 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.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.