← 输入框|github.com|刷新
Skip to content

fix(auth): check a workspace's personal-key switch after membership - #9540

Merged
waleedlatif1 merged 2 commits into
stagingfrom
fix/personal-key-switch-after-membership
Oct 31, 2026
Merged

waleedlatif1 merged 2 commits into
stagingfrom
fix/personal-key-switch-after-membership

Conversation

@waleedlatif1

Copy link
Copy Markdown
Collaborator

Summary

  • authorizeWorkspaceOperation refused a personal API key or OAuth token on a workspace with personal keys switched off before checking membership. Workspace use cases load their canonical context before authorizing, so a non-member got 403 PERSONAL_API_KEYS_DISABLED for a resource that exists and 404 for one that doesn't. With v2 file routes accepting guessable files/… paths, that is a practical file-existence oracle for those workspaces.
  • The column check now runs right after the role check, like the permission-group key beside it already did, for the same reason. A non-member gets the concealed NoWorkspaceAccessError (404 on v2). A member still gets PERSONAL_API_KEYS_DISABLED. The only visible change for members: one whose role is also too low gets the insufficient-role 403 first (still a 403).
  • Costs one permission lookup, and only for a key hitting a workspace that disabled them.
  • Same ordering exists in project-file authorization, audit-log and billing reads, and the v2 chat route; left for a follow-up so this change stays one shared site.

Type of Change

  • Bug fix

Testing

  • workspace-authorization.test.ts: the case that pinned column-before-role is inverted ("conceals the workspace before refusing the workspace personal-key column"); it fails on the old order
  • Table and workspace-file authorization cases that pinned "no permission lookup" now assert a member's refusal
  • All 39 suites touching disabled personal keys: 908 tests pass
  • biome, check:comment-hygiene, check:test-patterns; rest in CI

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing (new tests pass the test-audit authoring gate)
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

…so a non-member never learns what it named exists
@vercel

vercel Bot commented Oct 31, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated
docs Skipped Skipped Oct 31, 2026 6:59pm UTC

Request Review

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No issues found across 4 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

This PR changes authentication, authorization, or input validation. Ultrareviews find 2.4x more serious bugs than standard reviews. Comment @cubic-dev-ai ultrareview to run one.

Turn on auto-fix | Re-trigger cubic

@greptile-apps

greptile-apps Bot commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge, with no outstanding findings.

Summary

The PR checks workspace membership before refusing personal API keys or OAuth tokens under the workspace setting.

  • Personal credentials check workspace access before the key switch.

Reviews (2) · Last reviewed commit: "test(auth): import the key-switch error ..." · Reviewed by Greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Oct 31, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@waleedlatif1 I have started the AI code review. It will take a few minutes to complete.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No issues found across 4 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Turn on auto-fix | Re-trigger cubic

@waleedlatif1
waleedlatif1 merged commit f16b71a into staging Oct 31, 2026
69 checks passed
@waleedlatif1
waleedlatif1 deleted the fix/personal-key-switch-after-membership branch October 31, 2026 19:15

This branch was previously deployed

1 inactive deployment
Preview — 27acfa3a Deployed Oct 31, 2026 by vercel[bot]
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