@@ -91,6 +91,7 @@ for step in job.get('steps') or []:
9191# summarise or upload its output.
9292_PY_SCAN_STEP=" $( _step python-audit ' pip-audit every requirements file' ) "
9393_PY_ASSERT_STEP=" $( _step python-audit ' Assert the audit actually produced' ) "
94+ _SECRET_INSTALL_STEP=" $( _step secret-scan ' Install gitleaks' ) "
9495_SECRET_SCAN_STEP=" $( _step secret-scan ' gitleaks scan' ) "
9596_SECRET_ASSERT_STEP=" $( _step secret-scan ' Assert the secret scan completed cleanly' ) "
9697_SAST_ASSERT_STEP=" $( _step sast ' Assert CodeQL SARIF and reject unreviewed critical findings' ) "
@@ -218,6 +219,27 @@ printf '%s' "$_SECRET_RUNS" | grep -qE "gitleaks/releases/download/v[0-9]" \
218219 && ok " gitleaks version is pinned" \
219220 || bad " gitleaks is unpinned -- the baseline can move without a commit"
220221
222+ # Pinning the URL is not enough: a replaced or corrupted release asset would
223+ # otherwise be extracted and executed with no byte-level provenance check. The
224+ # digest is the official v8.30.0 linux_x64 release checksum, and verification
225+ # must happen before extraction so no unauthenticated binary reaches /tmp.
226+ _gitleaks_linux_x64_sha=" 79a3ab579b53f71efd634f3aaf7e04a0fa0cf206b7ed434638d1547a2470a66e"
227+ _gitleaks_checksum_order=" $( _LOKI_BODY=" $_SECRET_INSTALL_STEP " \
228+ _LOKI_SHA=" $_gitleaks_linux_x64_sha " python3 -c "
229+ import os
230+ body = os.environ['_LOKI_BODY']
231+ sha = os.environ['_LOKI_SHA']
232+ verify = body.find(sha)
233+ extract = body.find('tar -xzf /tmp/gitleaks.tar.gz')
234+ print('ok' if verify >= 0 and 'sha256sum -c' in body[verify:extract]
235+ and extract > verify else 'missing')
236+ " 2> /dev/null ) "
237+ if [ " $_gitleaks_checksum_order " = " ok" ]; then
238+ ok " gitleaks archive matches the pinned official SHA-256 before extraction"
239+ else
240+ bad " gitleaks archive is executed without the pinned official pre-extraction checksum"
241+ fi
242+
221243# --- 8. Secret findings block outside an exact reviewed baseline ------------
222244_secret_name=" $( _LOKI_WF=" $WF " python3 -c "
223245import os, yaml
0 commit comments