ci: fix pipeline vulnerabilities #388
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Purpose
This pull request introduces several improvements and refactorings to the GitHub Actions workflows, focusing on enhanced input validation, security best practices, and simplification of deployment steps. The most notable changes are the addition of robust input parameter validation for deployment jobs, the explicit setting of permissions for all workflows, and the removal of redundant Azure CLI installation steps.
Workflow input validation improvements:
job-cleanup-deployment.ymlandjob-deploy-linux.yml. These steps check for required fields, enforce naming conventions, and validate formats for inputs such as environment names, Azure locations, resource group names, Docker image tags, and resource IDs. This ensures that invalid or missing parameters are caught early, preventing misconfigured or failed deployments. [1] [2]Security and permissions:
permissions: contents: read, actions: readfor all workflows, includingbuild-docker-image.yml,deploy-linux.yml,deploy-orchestrator.yml,deploy-windows.yml,deploy.yml,job-cleanup-deployment.yml, andjob-deploy-linux.yml. This follows GitHub security best practices by restricting workflow permissions to the minimum required. [1] [2] [3] [4] [5] [6] [7]Deployment workflow simplification and modernization:
azd) in favor of using the officialAzure/setup-azdaction and relying on pre-installed tools in the deployment runners. This streamlines the setup process and reduces the risk of installation errors. [1] [2] [3] [4]Environment variable handling:
deploy.ymlto use theenv:block for the quota check step, instead of exporting variables within the shell script. This aligns with GitHub Actions best practices and improves readability.Minor shell script improvements:
deploy.ymlto avoid unnecessaryexportstatements and ensure values are properly written to the GitHub Actions environment.These changes collectively improve the reliability, security, and maintainability of the CI/CD workflows.
Does this introduce a breaking change?
Golden Path Validation
Deployment Validation