Skip to content
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

fix: changing environment call for argo app action #2814

Merged
merged 1 commit into from
Nov 4, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/db-ops.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,9 @@ jobs:
needs: update-helm-chart
if: ${{ needs.update-helm-chart.result == 'success' }}
runs-on: ubuntu-latest
environment: ${{ github.env.MIGRATION_ENV }}
environment: ${{ github.event.client_payload.environment }}
env:
stage: ${{ github.env.MIGRATION_ENV }}
stage: ${{ github.event.client_payload.environment }}
Comment on lines +146 to +148
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Add environment validation for security.

Direct use of github.event.client_payload.environment without validation could potentially allow deployment to unintended environments through the repository dispatch event.

Consider adding environment validation:

     environment: ${{ github.event.client_payload.environment }}
     env:
+      ALLOWED_ENVIRONMENTS: 'dev,sb,prod'
       stage: ${{ github.event.client_payload.environment }}
+    if: contains(env.ALLOWED_ENVIRONMENTS, github.event.client_payload.environment)

Also, consider adding a step to validate the environment:

    steps:
      - name: Validate environment
        run: |
          if [[ ! "${{ github.event.client_payload.environment }}" =~ ^(dev|sb|prod)$ ]]; then
            echo "Invalid environment specified"
            exit 1
          fi

permissions:
contents: read
steps:
Expand Down