fix(api): extend federation target/source guard to azure-self-source and gcp-self-source (closes #140)#234
Conversation
…mbos Generalise validateFederationTargetSource from the aws-specific check (#42) to a single rule covering all clouds: a self-source bundle (target == source) requires CUDly to be deployed on the matching cloud. This catches the azure-self-source and gcp-self-source cases that previously slipped through and produced broken bundles failing at `terraform apply` with missing-field errors instead of returning a clean HTTP 400 at download time. New (target, source) combos now guarded: - azure / azure on non-Azure → 400 - gcp / gcp on non-GCP → 400 AWS cross-account behaviour is unchanged (subsumbed by the general rule). Tests: extend TestGetFederationIaC_RejectsImpossibleTargetSourceCombo with 4 new 400-only integration cases; add unit test TestValidateFederationTargetSource covering all 9 self-source combos (3 allowed, 6 rejected) and 6 WIF combos (all allowed). Closes #140
|
@coderabbitai review |
|
Warning Rate limit exceeded
To keep reviews running without waiting, you can enable usage-based add-on for your organization. This allows additional reviews beyond the hourly cap. Account admins can enable it under billing. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
✨ Finishing Touches🧪 Generate unit tests (beta)
Review rate limit: 0/5 reviews remaining, refill in 2 minutes and 35 seconds. Comment |
✅ Actions performedReview triggered.
|
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
Summary
validateFederationTargetSourcefrom an AWS-only check to a single rule covering all three clouds: self-source bundles (target == source) require CUDly to be deployed on the matching cloud.azure-self-sourceandgcp-self-sourcerejection cases that previously produced broken bundles failing atterraform applyinstead of returning a clean HTTP 400 at download time.Changes
internal/api/handler_federation.go— 5 LOC change:internal/api/handler_federation_test.go:TestGetFederationIaC_RejectsImpossibleTargetSourceCombowithtarget/sourcefields and 4 new 400-only integration cases (aws→azure/azure, gcp→azure/azure, aws→gcp/gcp, azure→gcp/gcp).TestValidateFederationTargetSourceunit test covering all 9 self-source combos (3 allowed, 6 rejected) and 6 WIF combos (all allowed).Test plan
go test ./internal/api/... -run TestGetFederationIaC_RejectsImpossibleTargetSourceCombo— 7 subtests passgo test ./internal/api/... -run TestValidateFederationTargetSource— 15 subtests passgo test ./internal/api/...— full package (1029 tests) passesgo vet ./...— cleangofmt -l— no unformatted filesCloses #140