Skip to content

fix(3-security): add --project and --prefix filtering to validation.sh - #427

Open
johnlakeee wants to merge 1 commit into
mainfrom
fix/3-security-validation-filtering
Open

johnlakeee wants to merge 1 commit into
mainfrom
fix/3-security-validation-filtering

Conversation

@johnlakeee

Copy link
Copy Markdown
Collaborator

Description

fast/stages-aw/3-security/validation.sh previously failed whenever multiple -prod-iac-core-0 projects existed in the same organization (multi-tenant or multi-enclave deployments).

  • Add --project PROJECT_ID and --prefix PREFIX CLI flags (preserving default discovery when omitted)
  • Add mocked gcloud shell test tests/test_validation_sh.sh

Part of #388 (Milestone 1 — Group A, PR 6 of 6).

Type of Change

  • Bug fix (non-breaking change which fixes an issue)

Testing Performed

  • bash tests/test_validation_sh.sh and bash tests/test_shell_syntax.sh (33 scripts, 0 failures)
  • terraform fmt -check -recursive, terraform validate, tflint (155 directories, 0 failed)
  • pytest: 131 passed

@github-actions github-actions Bot added Security Something is insecure or can be secured Scope - Fast Related to Fabric FAST deployment stages in the fast directory Bug Something isn't working Level of Effort - Medium Moderate task requiring thought and testing; typically takes a couple of days to a week Priority - High Critical issues blocking development or users; urgent bugs or core features for release labels Nov 16, 2026

@aghassemlouei aghassemlouei left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for adding --project and --prefix filtering to fast/stages-aw/3-security/validation.sh. Reviewing the argument parser and filter construction surfaced two shell edge cases along with a pull request template gap:

  • In fast/stages-aw/3-security/validation.sh lines 25 and 41, if [ $# -lt 2 ] || [ -z "$2" ] does not check whether $2 begins with -, so running bash validation.sh --prefix --help silently consumes --help as PREFIX_FILTER instead of reporting a missing value. Adding || [[ "$2" == -* ]] to both --project and --prefix checks prevents flag values from consuming subsequent options.
  • In fast/stages-aw/3-security/validation.sh line 76, PROJECT_FILTER="projectId~'^${PREFIX_FILTER}-prod-iac-core-0$'" interpolates PREFIX_FILTER directly into a single-quoted gcloud --filter regular expression. Validating PREFIX_FILTER against ^[a-z0-9-]+$ and PROJECT_OVERRIDE against ^[a-z][a-z0-9-]{4,28}[a-z0-9]$ during flag parsing prevents unexpected regex or quote characters from altering the gcloud projects list filter.
  • Please also include the ## Deployment & Compliance Impact and ## Checklist sections from .github/pull_request_template.md in the pull request description.

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

Labels

Bug Something isn't working Level of Effort - Medium Moderate task requiring thought and testing; typically takes a couple of days to a week 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.

2 participants