fix(api): Refine SAML invitation handling and guard auto-provisioning#2204
fix(api): Refine SAML invitation handling and guard auto-provisioning#2204
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ffefd25927
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
|
@cursor review |
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6bc0681cb3
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
|
@cursor review |
|
@cubic review |
@topher-lo I have started the AI code review. It will take a few minutes to complete. |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
There was a problem hiding this comment.
1 issue found across 20 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="tracecat/auth/saml.py">
<violation number="1" location="tracecat/auth/saml.py:342">
P3: `should_allow_email_for_org` is now dead production code. After refactoring `_select_allowlisted_email` → `_select_authorized_email`, the new function calls `_get_active_org_domains` and `_is_normalized_domain_allowed_for_org` directly, bypassing this public function entirely. It has zero production callers — only test code exercises it, creating a false sense of coverage while the actual production path relies on different tests. Consider removing this function or updating tests to target the actual production code paths.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
Summary
Testing
Summary by cubic
Refines SAML invite handling and org access by preserving org context, enforcing domain allowlists, and removing auto‑provisioning. Updates auth discovery to default to the default org’s SAML in single‑tenant and to platform OIDC in multi‑tenant, with email selection that prefers pending invites.
Bug Fixes
Refactors
Written for commit ab0b07d. Summary will update on new commits.