chore(deps): update github/codeql-action action to v2.20.0 #1842
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# .github/workflows/detect-secrets.yaml | |
name: detect-secrets | |
on: [pull_request] | |
permissions: | |
contents: read | |
jobs: | |
detect-secrets: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Harden Runner | |
uses: step-security/harden-runner@215c5ca5ec7b0ee8425ee2e531db206868f0b83b | |
with: | |
egress-policy: block | |
disable-telemetry: true | |
allowed-endpoints: > | |
detect-secrets-client-version.s3.us-south.cloud-object-storage.appdomain.cloud:443 | |
files.pythonhosted.org:443 | |
github.com:443 | |
pypi.org:443 | |
- name: Checkout | |
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3 | |
with: | |
fetch-depth: 0 | |
- name: Setup Python | |
uses: actions/setup-python@bd6b4b6205c4dbad673328db7b31b7fab9e241c0 # v4 | |
with: | |
python-version: "3.7" | |
- name: "Install dev dependencies" | |
run: | | |
pip install --upgrade pip | |
pip install --use-pep517 --upgrade "git+https://github.com/ibm/detect-secrets.git@master#egg=detect-secrets" | |
pip install --no-cache-dir certifi>=2022.12.7 --upgrade | |
sudo apt-get install -y jq | |
- name: "Run detect-secrets" | |
run: | | |
set -o pipefail | |
set -exu | |
DS_REQUIRE_BASELINE=1 | |
DS_BASELINE_FILE="./.secrets.baseline" | |
detect-secrets --version | |
if [ ! -r "$DS_BASELINE_FILE" ]; then | |
if [ "$DS_REQUIRE_BASELINE" -eq 0 ]; then | |
detect-secrets -v scan >"$DS_BASELINE_FILE" | |
else | |
echo "No readable detect-secrets baseline file found at '$DS_BASELINE_FILE', and it was set to required by \$DS_REQUIRE_BASELINE ($DS_REQUIRE_BASELINE)" | |
exit 255 | |
fi | |
else | |
cp .secrets.baseline .secrets.new | |
detect-secrets scan --update .secrets.new | |
# if there is any difference between the known and newly detected secrets, break the build | |
list_secrets() { jq -r '.results | keys[] as $key | "\($key),\(.[$key] | .[] | .hashed_secret)"' "$1" | sort; } | |
if ! diff <(list_secrets .secrets.baseline) <(list_secrets .secrets.new) >&2; then | |
echo "Detected new secrets in the repo" >&2 | |
exit 1 | |
fi | |
fi |