Skip to content

Account isolation matrix: cover PATCH /api-keys/{key_id} from #17833 (rest red on main) - #17956

Merged
danielhanchen merged 1 commit into
mainfrom
fix-api-key-patch-matrix-factory
Nov 16, 2026
Merged

danielhanchen merged 1 commit into
mainfrom
fix-api-key-patch-matrix-factory

Conversation

@danielhanchen

Copy link
Copy Markdown
Member

Summary

(Python 3.13, rest) is red on main (seen on the staging run of #17933):

studio/backend/tests/multi_account/test_alice_bob_matrix.py::test_object_route_factory_completeness
E   AssertionError: ['routes.auth:PATCH:/api-keys/{key_id}']

#17833 added PATCH /api/auth/api-keys/{key_id} (switch a key between full and inference access). The account isolation matrix requires every object route to have a factory, so it is exercised as owner / right user / wrong user / unauthenticated / deactivated, or to be listed as skipped with a reason. The new route had neither. The route itself is scoped correctly (set_api_key_access filters by the caller's key scope); it was only missing from the matrix.

Change

Test only: studio/backend/tests/multi_account/factories.py adds a factory for the route next to the existing DELETE /api-keys/{key_id} one: seed one of alice's keys, PATCH it to {"access": "inference"}, and expect the response to show inference for alice and a 404 for everyone else, with alice's data unchanged on every rejected call.

Testing

  • The matrix rows for both api-key routes plus the completeness / skipped / factory checks: 15 passed. On main the completeness check fails as above.
  • Sabotage: with the key scope removed from set_api_key_access (any user can change any key), the new [owner] and [wrong] rows fail.

@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-16T10:20:42.331588Z b9d234c Manual request
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 🎉

Reviewed commit: b9d234c3e9

ℹ️ 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".

@danielhanchen
danielhanchen merged commit bf7f6e0 into main Nov 16, 2026
@danielhanchen
danielhanchen deleted the fix-api-key-patch-matrix-factory branch November 16, 2026 10:23
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.

1 participant