Skip to content

fix(fast): drop the size() guard from delegated grant conditions - #358

Merged
Calvin-Cheng1 merged 1 commit into
google:mainfrom
digitalresistor:fix/delegated-grant-conditions
Oct 26, 2026
Merged

Calvin-Cheng1 merged 1 commit into
google:mainfrom
digitalresistor:fix/delegated-grant-conditions

Conversation

@digitalresistor

Copy link
Copy Markdown
Contributor

Description

Let the first Stage 0 apply create the delegated role grant bindings again, which every deployment from main currently fails on.

#274 added an api.getAttribute('iam.googleapis.com/modifiedGrantsByRole', []).size() > 0 guard to the delegated grant conditions. The IAM condition language has no size() function, so IAM rejects each of these bindings with undeclared reference to 'size'.

  • The hasOnly() call alone already returns false when a request modifies a role outside the list, because that role then appears in the attribute.
  • The attribute is empty for every request that changes no role binding, such as a getIamPolicy call, and Google documents that hasOnly() returns true for an empty list.
  • A non-empty requirement would also deny those read requests to the delegated roles, so the conditions match the behavior before fix(security): harden IAM conditions, FAST stages, repository tools, and blueprints #274.
  • The change removes the guard from the conditions in fast/stages-aw/0-bootstrap/automation.tf, fast/stages-aw/0-bootstrap/organization.tf, and fast/stages-aw/3-security/main.tf.
  • The test_delegated_iam_conditions_guard_empty_grant_list test in tests/test_bootstrap_logging_order.py required the guard, so the change removes it.
  • The new tests/test_iam_conditions.py test rejects any size() call on that attribute and checks that the three files still limit the roles with hasOnly().
  • The change needs no README update, because no documentation describes the guard.

No GitHub issue exists for this change. The stellar CLI work in #306 found it during a lab Stage 0 apply.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update

Deployment & Compliance Impact

  • Applicable Regimes:
    • US Region Restricted (e.g., Access Policy constraint)
    • FedRAMP Moderate
    • FedRAMP High
    • DoD IL4
    • DoD IL5
    • General / All
  • NIST 800-53r5 Controls: AC-6 least privilege stays in place, because the hasOnly() call still limits the roles that the automation service accounts can grant.

Checklist

Code Quality & Reusability

  • My code adheres to the Maximize Reusability principle. I have not redefined common elements and have reused existing base configurations and modules where possible.
  • I have checked that no existing module or configuration in modules/ or fast/stages-aw/ can be leveraged for this change.
  • My code follows the established naming conventions outlined in docs/naming-convention.md.

Documentation

  • I have updated the README.md of the modified module or blueprint.
  • I have added/updated documentation for inputs (variables) and outputs.

Security

  • My change adheres to GCP security best practices and the principle of least privilege.
  • I have ensured compliance with the targeted regime (FedRAMP Moderate, FedRAMP High, IL4, IL5, etc.).

Testing

  • I have tested my changes locally.
  • I have included details of my testing in this PR.

Testing Performed

  • A lab Stage 0 apply from main failed on the organization_iam_admin_conditional organization binding and the delegated_grants_resman project binding with undeclared reference to 'size'.
  • terraform init -backend=false and terraform validate pass for the fast/stages-aw/0-bootstrap/ stage.
  • terraform validate passes for the fast/stages-aw/3-security/ stage with a temporary provider file for the google.billing alias, which Stage 0 normally generates.
  • terraform fmt -check passes for both stages.
  • uv run --locked pytest in the repository root passes 108 tests.
  • The new test fails against the code on main.
  • A rerun of the lab apply with this change waits for the next lab session.

The IAM condition language has no size() function, so IAM rejects every
binding whose condition calls it, and the first Stage 0 apply fails on
the delegated grant bindings. hasOnly() alone already returns false when
a call modifies a role outside the list.

- Remove the guard from the Stage 0 and Stage 3 delegated grant
  conditions.
- Replace the test that required the guard with one that rejects any
  size() call and checks that the conditions still use hasOnly().
@github-actions github-actions Bot added the Scope - Fast Related to Fabric FAST deployment stages in the fast directory label Oct 26, 2026
@Calvin-Cheng1
Calvin-Cheng1 merged commit 088a6ae into google:main Oct 26, 2026
16 checks passed
@aghassemlouei aghassemlouei added Bug Something isn't working Framework - FedRAMP High FedRAMP High compliance regime and controls Framework - IL5 DoD Impact Level 5 (IL5) compliance regime and controls Level of Effort - Low Quick, well-defined tasks with no unknowns; takes a few hours up to one day to complete Priority - High Critical issues blocking development or users; urgent bugs or core features for release Security Something is insecure or can be secured labels Oct 26, 2026
@digitalresistor
digitalresistor deleted the fix/delegated-grant-conditions branch October 26, 2026 17:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug Something isn't working Framework - FedRAMP High FedRAMP High compliance regime and controls Framework - IL5 DoD Impact Level 5 (IL5) compliance regime and controls Level of Effort - Low Quick, well-defined tasks with no unknowns; takes a few hours up to one day to complete Priority - High Critical issues blocking development or users; urgent bugs or core features for release Scope - Fast Related to Fabric FAST deployment stages in the fast directory Security Something is insecure or can be secured

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants