For AI agents: A markdown version of this page is available at https://docs.datadoghq.com/security/code_security/iac_security/iac_rules/cicd-github-misfeature.md.
A documentation index is available at /llms.txt.
Certain GitHub Actions features create brittle or hard-to-audit workflows that increase the risk of inconsistent builds, unexpected runtime behavior, and missed detection of unsafe commands.
The pip-install input to actions/setup-python installs packages into a global (user or system) Python environment rather than an isolated virtual environment. This can lead to inconsistent dependency resolution and unexpected side effects across different runners and Python versions. This rule flags workflow steps that use uses: actions/setup-python with a with mapping that contains pip-install. Avoid that input and instead create and use a virtual environment, such as python -m venv and activating it, before installing packages.
Using shell: cmd or cmd.exe for run steps hampers static analysis because Windows CMD has no formal grammar and multiple line-continuation behaviors, which can hide unsafe commands or make auditing unreliable. This rule flags steps with shell: cmd/cmd.exe and will also flag other non‑well‑known shells as auditor findings. Prefer well-known shells like pwsh or bash when possible.
Secure configuration examples:
- name:Setup Python and use a virtual environmentuses:actions/setup-python@v4with:python-version:'3.11'- name:Create and activate venv, then installrun:| python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
- name:Run script with PowerShell on Windowsshell:pwshrun:| Write-Host "Performing build steps..."
./build.ps1
Compliant Code Examples
name:Proper Features Usageon:pushjobs:test:runs-on:ubuntu-lateststeps:- uses:actions/checkout@v4- name:Setup Python properlyuses:actions/setup-python@v5with:python-version:'3.11'- name:Install with venvshell:bashrun:| python -m venv venv
source venv/bin/activate
pip install -r requirements.txt- name:PowerShell on Windowsshell:pwshrun:Write-Host "Using PowerShell"