Skip to content

fix(scripts): reject unknown --source in generate-federation-iac - #640

Merged
cristim merged 2 commits into
mainfrom
fix/federation-source-allowlist-303
Oct 6, 2026
Merged

cristim merged 2 commits into
mainfrom
fix/federation-source-allowlist-303

Conversation

@cristim

@cristim cristim commented Oct 6, 2026

Copy link
Copy Markdown
Member

Closes #303

Adds a validSources allowlist checked right after --target (via validateCloudFlags, split out to keep populateData under the gocyclo limit). awsOIDCIssuer's default arm is left alone: after the allowlist its only reachable empty return is --source aws, where an empty issuer is correct (the cross-account external-ID artifact has no OIDC issuer). The --target aws --source aws case in the issue already selects the external-ID template on main.

Checks: new TestGenerator_InvalidSourceReportedAsSource fails without the fix and passes with it; go test ./scripts/ passes; gofmt and go vet clean.

populateData allowlisted --target but not --source, so --source Azure fell
through awsOIDCIssuer's default arm and rendered oidc_issuer_url empty next
to a populated subject claim. Add a validSources allowlist and a test
mirroring the --target one.
@cristim cristim added priority/p2 Backlog-worthy severity/medium Moderate harm triaged Item has been triaged urgency/this-quarter Within the quarter impact/few Limited audience effort/xs Trivial / one-liner type/security Security finding labels Oct 6, 2026
@coderabbitai

coderabbitai Bot commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

  • Run on-demand review

This review includes 2 billable files and costs up to $0.50.

  • Ask an admin to make reviews automatic

Open in CodeRabbit

Reviews can continue after your included limit without a manual trigger. An admin must approve usage-based billing.

Or wait 50 minutes for your next included review.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available. Your 69 included PR review attempts over the past 7 days set your current allowance at 1 review per hour.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: Repository: LeanerCloud/cloud-commitments-platform/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Essentials
  • Run ID: f6148a92-965f-43f3-b5a3-5d4369ad0333
📥 Commits

Reviewing files that changed from the base of the PR and between 3413591 and 5a0cc0c.

📒 Files selected for processing (2)
  • scripts/generate-federation-iac.go
  • scripts/generate_federation_iac_test.go
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

With both flags wrong, --target must be reported. Checking --source first
passed every existing test.
@cristim
cristim merged commit 35eaff5 into main Oct 6, 2026
25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

effort/xs Trivial / one-liner impact/few Limited audience priority/p2 Backlog-worthy severity/medium Moderate harm triaged Item has been triaged type/security Security finding urgency/this-quarter Within the quarter

Projects

None yet

Development

Successfully merging this pull request may close these issues.

sec(scripts): generate-federation-iac accepts any --source and renders an empty issuer

1 participant