Files
molecule-ai-workspace-templ…/.gitea/workflows/secret-scan.yml
T
hongming-ceo-delegated dffdb52799
CI / Template validation (static) (pull_request) Failing after 6s
CI / Template validation (runtime) (pull_request) Has been skipped
CI / Adapter unit tests (pull_request) Successful in 11s
meta-ci-advisory / meta (advisory) (pull_request) Successful in 7s
Secret scan / Scan diff for credential-shaped strings (pull_request) Successful in 5s
CI / Adapter conformance (ADR-004 socket) (pull_request) Successful in 26s
CI / T4 tier-4 conformance (live) (pull_request) Has been skipped
CI / validate (pull_request) Failing after 2s
verify-providers-projection / Regenerate projection, fail on drift, assert registry ⊆ template (pull_request) Successful in 17s
chore(ci): pin molecule-ci validation fetches
2026-07-20 20:37:02 -07:00

77 lines
2.7 KiB
YAML

# Canonical inline diff secret gate. The workflow/job names preserve the
# established `Secret scan / Scan diff for credential-shaped strings` context.
name: Secret scan
on:
pull_request:
types: [opened, synchronize, reopened]
push:
branches: [main, staging]
permissions:
contents: read
jobs:
scan:
name: Scan diff for credential-shaped strings
runs-on: ubuntu-latest
timeout-minutes: 8
env:
MOLECULE_CI_REF: 11b8598e5c0b3f0b1031733a8d5f6bc238f146a4
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
with:
fetch-depth: 2
persist-credentials: false
- name: Fetch immutable molecule-ci scanner
run: |
set -euo pipefail
: "${RUNNER_TEMP:?RUNNER_TEMP is required}"
CI_ROOT="$RUNNER_TEMP/molecule-ci-ssot"
mkdir "$CI_ROOT"
git init -q "$CI_ROOT"
git -C "$CI_ROOT" remote add origin \
https://git.moleculesai.app/molecule-ai/molecule-ci.git
fetched=false
for attempt in 1 2 3; do
if GIT_ASKPASS=/bin/false GIT_TERMINAL_PROMPT=0 \
git -c credential.helper= -c http.userAgent=curl/8.4.0 \
-C "$CI_ROOT" fetch --no-tags --depth 1 origin "$MOLECULE_CI_REF"; then
fetched=true
break
fi
sleep "$attempt"
done
if [ "$fetched" != true ]; then
echo "::error::immutable molecule-ci scanner fetch failed"
exit 1
fi
git -C "$CI_ROOT" checkout -q --detach FETCH_HEAD
ACTUAL_CI_REF="$(git -C "$CI_ROOT" rev-parse HEAD)"
if [ "$ACTUAL_CI_REF" != "$MOLECULE_CI_REF" ]; then
echo "::error::immutable molecule-ci scanner ref mismatch"
exit 1
fi
- name: Scan exact changed content with fail-closed tree fallback
env:
PR_BASE_SHA: ${{ github.event.pull_request.base.sha }}
PR_HEAD_SHA: ${{ github.event.pull_request.head.sha }}
PUSH_BEFORE: ${{ github.event.before }}
PUSH_AFTER: ${{ github.event.after }}
run: |
set -o pipefail
if [ "${{ github.event_name }}" = pull_request ]; then
BASE=$PR_BASE_SHA
HEAD=$PR_HEAD_SHA
else
BASE=$PUSH_BEFORE
HEAD=$PUSH_AFTER
fi
python3 "$RUNNER_TEMP/molecule-ci-ssot/scripts/scan_diff_secrets.py" \
--repo-root . --base "$BASE" --head "$HEAD" \
| tee /tmp/secret-scan.log
- name: Assert scanner execution sentinel
if: always()
run: grep -qxF 'secret-scan:sentinel:executed' /tmp/secret-scan.log