Skip to content

[comp] Production Deploy#2917

Merged
tofikwest merged 5 commits into
releasefrom
main
May 22, 2026
Merged

[comp] Production Deploy#2917
tofikwest merged 5 commits into
releasefrom
main

Conversation

@github-actions
Copy link
Copy Markdown
Contributor

@github-actions github-actions Bot commented May 22, 2026

This is an automated pull request to release the candidate branch into production, which will trigger a deployment.
It was created by the [Production PR] action.


Summary by cubic

Fixes GCP project detection by switching folder listing to Cloud Resource Manager v3 and only using a broad folder-projects query when folder enumeration is forbidden (403). Folder-nested projects now appear for affected users while avoiding projects from other orgs when an org simply has no folders.

  • Bug Fixes
    • Switched folder listing to cloudresourcemanager.googleapis.com/v3/folders (v2 was deprecated and returned 403 for some OAuth grants).
    • Fallback to lifecycleState:ACTIVE AND parent.type:folder fires only on HTTP 403; does not run on 200 + empty results to preserve scoping in multi-org setups.
    • Tests updated: added 403 fallback and “no folders” cases; verified precise scoping when enumeration succeeds; mocks now use v3.

Written for commit 0f2c990. Summary will update on new commits. Review in cubic

github-actions Bot and others added 3 commits May 22, 2026 15:56
…dden

Customer Propper hit a real failure that PR #2899's folder enumeration
could not handle. Verified in production CloudWatch logs:

  WARN [GCPSecurityService] Failed to list child folders of
       organizations/43356919874: {
    "error": {
      "code": 403,
      "message": "The caller does not have permission",
      "status": "PERMISSION_DENIED"
    }
  }
  LOG  [GCPSecurityService] GCP detectProjectsForOrg(43356919874):
       13 direct + 0 folder-nested → 13 unique

Two coordinated changes:

1. Switch `cloudresourcemanager.googleapis.com/v2/folders` →
   `cloudresourcemanager.googleapis.com/v3/folders`. v2 is deprecated
   and was observed returning 403 PERMISSION_DENIED for OAuth grants
   that legitimately had org-level folder roles (roles/owner +
   roles/resourcemanager.folderAdmin). v3 is the current API and
   accepts the same `parent`/`pageSize`/`pageToken` query params, so
   the swap is purely defensive — response shape is identical.

2. Add a broad-query fallback in `listProjectsInOrgFolderTree`. When
   folder enumeration returns zero folder IDs (whether due to 403,
   404, no folders existing, or anything else), retry with a broader
   `lifecycleState:ACTIVE AND parent.type:folder` query. That returns
   every folder-nested project the OAuth user can `projects.get`,
   which solves Greg's case without depending on the folders endpoint
   succeeding.

Multi-org tradeoff: in a multi-org tenant the fallback path may
include folder-nested projects from other orgs the user has access
to. This is acceptable because:
  - the picker is selection-based — the user chooses what to monitor,
  - the alternative is a silently empty picker like Greg saw,
  - the user already authorized those projects via their IAM grant.
When v3/folders works as expected, the precise per-folder query is
preferred and the fallback never fires — verified by a new test that
locks in this behavior.

Tests:
- 2 new regression tests on `gcp-security.service.spec.ts`:
  - customer-Propper scenario: v3/folders empty → broad fallback
    fires → folder-nested projects appear.
  - healthy multi-org scenario: v3/folders succeeds → precise scoping
    preserved, broad fallback does not fire.
- All 15 GCP detection tests pass; full cloud-security suite (269
  tests) passes; one pre-existing TLS env failure is unrelated.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…on-fallback

fix(cloud-tests): unblock GCP picker when folder enumeration returns 403
@vercel
Copy link
Copy Markdown

vercel Bot commented May 22, 2026

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

Project Deployment Actions Updated (UTC)
comp-framework-editor (staging) Ready Ready Preview, Comment May 22, 2026 6:44pm
2 Skipped Deployments
Project Deployment Actions Updated (UTC)
app (staging) Skipped Skipped May 22, 2026 6:44pm
portal (staging) Skipped Skipped May 22, 2026 6:44pm

Request Review

Copy link
Copy Markdown
Contributor

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

Choose a reason for hiding this comment

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

1 issue found across 2 files

Confidence score: 3/5

  • There is a concrete regression risk in apps/api/src/cloud-security/providers/gcp-security.service.ts: the empty-folder fallback now expands scope to all accessible folder projects, which can misattribute projects across organizations.
  • Given the 6/10 severity with high confidence (8/10) and clear user-facing impact on org-specific project detection, this carries some merge risk rather than being a minor housekeeping issue.
  • Pay close attention to apps/api/src/cloud-security/providers/gcp-security.service.ts - empty-folder fallback logic may over-broaden project selection when an org has no folders.

Reply with feedback, questions, or to request a fix.

Fix all with cubic | Re-trigger cubic

Comment thread apps/api/src/cloud-security/providers/gcp-security.service.ts Outdated
tofikwest and others added 2 commits May 22, 2026 14:36
…orbidden

Cubic flagged PR #2916 (merged into main) with a P2 regression: the
broad `parent.type:folder` fallback fired any time folder enumeration
returned zero folders, including the case where an org legitimately
has no folders at all. For multi-org tenants that meant the picker
for an empty-folder org could surface folder-nested projects from
OTHER orgs the OAuth user happened to have IAM access to (because
the broad query is not org-scoped).

Concrete cases:

  Case                                          | Before (PR #2916) | After (this PR)
  ----------------------------------------------+-------------------+----------------
  v3/folders returns 200 + empty (no folders)   | Fallback fires    | No fallback ✓
  v3/folders returns 403 PERMISSION_DENIED      | Fallback fires    | Fallback fires ✓
  v3/folders returns folder ids                 | No fallback       | No fallback ✓

To distinguish the two cases, the folder-enumeration helpers now
return `{ folderIds, forbidden }` where `forbidden` is true only when
GCP responded with HTTP 403. The caller fires the broad query only
when `folderIds.length === 0 && forbidden`.

Customer Propper (Greg's case) is unaffected — their failure mode is
"403 PERMISSION_DENIED" so the fallback still fires.

New regression test locks in cubic's concern: when an org legitimately
has no folders (200 OK + empty list), the broad fallback must NOT
fire. The customer-Propper test was updated to return a real 403
response so it exercises the fallback path the way production does.

Full cloud-security suite: 270/270 pass.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…rbidden

fix(cloud-tests): only fire GCP broad fallback when folder list was forbidden
@tofikwest
Copy link
Copy Markdown
Contributor

@cubic-dev-ai review it

@cubic-dev-ai
Copy link
Copy Markdown
Contributor

cubic-dev-ai Bot commented May 22, 2026

@cubic-dev-ai review it

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

Copy link
Copy Markdown
Contributor

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

Choose a reason for hiding this comment

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

No issues found across 2 files

Confidence score: 5/5

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

Re-trigger cubic

@tofikwest tofikwest merged commit 3e8da30 into release May 22, 2026
14 checks passed
@claudfuen
Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 3.63.1 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants