fix(github): scope 2FA check to selected repos' orgs only#2569
Merged
fix(github): scope 2FA check to selected repos' orgs only#2569
Conversation
When the connected GitHub user belongs to orgs they don't own, the 2FA filter returns a 422. Previously this surfaced as a 'Cannot verify 2FA' finding, which confused customers seeing unrelated orgs in their results (e.g. eighteenlabs seeing sisoputnfrba and dds-utn). Now we silently skip these orgs with a log message instead of emitting a fail finding. The /user/orgs fetch is preserved as-is to ensure all relevant orgs are discovered. Fixes CS-259
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
There was a problem hiding this comment.
1 issue found across 1 file
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="packages/integration-platform/src/manifests/github/checks/two-factor-auth.ts">
<violation number="1" location="packages/integration-platform/src/manifests/github/checks/two-factor-auth.ts:167">
P2: This silent-skip branch can mask real 422/validation errors because the permission detector is too broad. Narrow the skip condition so only confirmed non-owner errors are skipped.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review, or fix all with cubic.
The 2FA check was iterating every org returned by /user/orgs, which included orgs the connected user happened to belong to but the customer never selected. eighteenlabs saw findings for sisoputnfrba and dds-utn (personal orgs of the connecting account) alongside their own org. Derive the orgs to check from ctx.variables.target_repos instead — the same selection the user already configures in the integration UI. Drop the /user/orgs call entirely. The user-selected list is already filtered to Organization-owned repos by targetReposVariable.fetchOptions. Reverts the silent 422 skip from b5f9f3d: now that the org list comes from explicit user selection, a 422 means the customer selected a repo in an org they don't own — that's a real misconfiguration and should surface as a finding. Fixes CS-259 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Contributor
|
🎉 This PR is included in version 3.22.4 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The 2FA check was iterating every org returned by
/user/orgs— every org the connected GitHub user happens to belong to, regardless of what the customer configured. eighteenlabs saw findings forsisoputnfrbaanddds-utn(personal orgs of the connecting account) alongside their own orgeighteen-labs.The "Repositories to monitor" UI selection was effectively ignored — the check never declared
target_reposas a variable.Fix
Derive the org list from
ctx.variables.target_repos(same selection the user configures in the integration UI). Drop the/user/orgscall entirely.Example: selecting
eighteen-labs/ato-server,eighteen-labs/app,eighteen-labs/ato-device→ checks onlyeighteen-labs.sisoputnfrba/dds-utnare never touched.The user-selected list is already filtered to
Organization-owned repos bytargetReposVariable.fetchOptions, so we don't need to re-validate the org type here.Why we don't filter
/user/orgsinsteadWe deliberately keep
/user/orgsas the source for the selectable repo list (invariables.ts) — that's how customers find all their orgs/repos in the picker. We just don't run the check against everything we discovered; we only check what they explicitly selected.What changed
packages/integration-platform/src/manifests/github/checks/two-factor-auth.ts:variables: [targetReposVariable]/user/orgsfetch withparseRepoBranches(target_repos) → unique ownersVerification
bun run --filter '@trycompai/integration-platform' build✅npx turbo run typecheck --filter=@trycompai/integration-platform✅Test plan
eighteen-labs/*repos → onlyeighteen-labsis checked, no findings forsisoputnfrba/dds-utnFixes CS-259