Skip to content

fix(security): default service account sentinel and partial deploy validation#10779

Merged
inlined merged 4 commits into
mainfrom
requires-role-6-default-sa
Jul 13, 2026
Merged

fix(security): default service account sentinel and partial deploy validation#10779
inlined merged 4 commits into
mainfrom
requires-role-6-default-sa

Conversation

@inlined

@inlined inlined commented Jul 8, 2026

Copy link
Copy Markdown
Member

Description

This PR resolves the deployment crash when opting out of declarative security and refines unenrollment safety:

  1. Replaces the "default" string sentinel with null to revert to the default service account when unenrolling.
  2. Prohibits partial codebase deployments (filtered deploys) when enrolling or unenrolling from declarative security to prevent inconsistent states.
  3. Enables unenrollment prompts and cleanup for codebase-level filtered deploys.

Scenarios Tested

  • Ran mocha unit tests: npm run mocha:fast

@inlined
inlined requested review from Berlioz and removed request for Berlioz July 8, 2026 23:04

@gemini-code-assist gemini-code-assist 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.

Code Review

This pull request introduces declarative security support and automated rolling IAM role grants/revocations for 2nd generation Cloud Functions. Key changes include refactoring the deployment planning to group changesets by codebase (CodebasePlan) and region, implementing sequential IAM role grants and revocations in the Fabricator to avoid GCP concurrency conflicts, and adding validation to prevent partial codebase deploys during enrollment/unenrollment. Additionally, helper methods in src/gcp/iam.ts were updated to support full service account email addresses, and a temporary warning was added for Dart functions. There are no review comments to evaluate.

@inlined
inlined force-pushed the requires-role-6-default-sa branch from e841de8 to 46bcc29 Compare July 8, 2026 23:08
Comment thread src/deploy/functions/prepare.ts Outdated

if (isPartiallyFiltered && (isEnrolling || isUnenrolling)) {
throw new FirebaseError(
`Cannot deploy a partial codebase when enrolling or unenrolling from declarative security`,

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.

Should the message explain why, to prevent this from feeling frustratingly arbitrary?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

IDK. I don't want an essay; maybe "because it is unsafe?"

@ajperel ajperel 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.

Leaving the substantive review to Victor, but asking some questions just so I can learn as y'all add all this functionality.

if (requiredRoles) {
rolesToAdd = requiredRoles.filter((r) => !roles.includes(r));
rolesToRemove = roles.filter((r) => !requiredRoles.includes(r));
if (!existingManagedSA && managedSA) {

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.

if we care about filters here why don't we also care about filters for enrollment in this instance? I thought you didn't want to do enrollment or unenrollment on partial deploys?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Both are blocked in prepare.ts.

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.

yeah, that's why I was confused by any checking

Comment thread src/deploy/functions/release/planner.ts
Comment thread src/deploy/functions/release/planner.ts
@inlined
inlined enabled auto-merge (squash) July 9, 2026 22:27
@inlined
inlined merged commit 83570ee into main Jul 13, 2026
53 checks passed
@inlined
inlined deleted the requires-role-6-default-sa branch July 13, 2026 21:27
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.

4 participants