Repository navigation
dynamodb: verify the admin PutItem URL key against the table schema - #1229
Conversation
Closes the item the data-browser design tracked separately: the HTTP layer checks that every attribute IT received in the URL appears in the body with the same value, but it has no schema access, so it could not tell that a composite-key table's URL segment named only the hash key while the body supplied the range key. The write then landed on a row the URL never fully identified — the difference between "update the item this URL names" and "create some other item". The URL key is now plumbed into AdminPutItem, which loads the table schema and requires the key to name exactly the primary-key attributes: missing ones and extras are both rejected. Extras matter too — a key carrying an attribute the schema does not treat as part of the primary key means the caller and the table disagree about identity, and ignoring it would let the mismatch through. An absent table surfaces as ErrAdminDynamoNotFound from the schema lookup rather than as a validation error. Claude-Session: https://claude.ai/code/session_013rNHooj7NF3giihWVba8QE
|
@codex review |
|
@claude review |
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 23 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
To use Codex here, create a Codex account and connect to github. |
|
Claude finished @bootjp's task in 2m 21s —— View job Review: dynamodb: verify the admin PutItem URL key against the table schema
SummaryThe fix is correctly scoped and the plumbing is consistent end-to-end (HTTP handler → What looks right
Minor, non-blocking observations
Process notes
|
|
@codex review |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5e7c9b584b
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
Warning
Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.
Copilot review overview
2 open findings
What changed in this PR
This PR threads the URL path key into AdminPutItem so the DynamoDB adapter can load table schema and validate that the path key names exactly the table’s primary-key attributes (hash + optional range), preventing writes to unintended rows for composite-key tables.
Changes:
- Extends the
TablesSource.AdminPutItemAPI (handler → bridge → adapter) to accept the URL key map. - Adds adapter-side schema-based validation to reject missing/extra primary-key attributes in the path key.
- Updates/extends DynamoDB admin item tests to cover partial composite keys, extra path-key attributes, and missing-table behavior.
| File | Description |
|---|---|
internal/admin/dynamo_handler.go |
Updates TablesSource interface and documents why the URL key is passed down. |
internal/admin/dynamo_items_handler.go |
Passes parsed URL key through to AdminPutItem. |
main_admin.go |
Bridges admin HTTP layer key into adapter call. |
adapter/dynamodb_admin_items.go |
Adds schema-based path-key vs primary-key validation in adapter AdminPutItem. |
adapter/dynamodb_admin_items_test.go |
Adds helper + new tests for composite/extra key validation and missing table. |
internal/admin/dynamo_items_handler_test.go |
Updates stub signature to include key parameter. |
internal/admin/dynamo_handler_test.go |
Updates stub signature to include key parameter. |
main_admin_forward_test.go |
Updates dummy signature to include key parameter. |
docs/design/2026_05_22_implemented_admin_data_browser.md |
Updates design doc to mark the previously-tracked gap as fixed. |
🧠 Review effort: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8a849faacb
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
Updated this PR to the latest
CI has restarted for the new HEAD. @codex review |
|
Codex Review: Didn't find any major issues. 🎉 Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
🛡️ Codex Security Review · Automatically triggeredSecurity review completed. No security issues were found in this pull request. Reviewed commit: Only the user who started this review can view the report in Codex. ℹ️ About Codex security reviews in GitHubThis is an experimental Codex feature. Security reviews are triggered when:
Once complete, Codex will leave suggestions, or a comment if no findings are found. |


Summary
Behavior and risk
A PUT that previously accepted a partial, extra, or mismatched path key now returns the existing admin validation error. Valid single-key and composite-key writes are unchanged. Validation runs inside the existing fenced write-preparation path, so it does not add an unfenced schema read.
Verification
go test -race ./adapter ./internal/admin . -run '(AdminPutItem|ValidateAdminPathKey|DynamoItems|DynamoHandler|DynamoTablesBridge)' -count=1 -timeout=30mgit diff --check origin/main...HEADAdminPutItemcaller and implementation withrg.