Files
molecule-ai-workspace-templ…/.gitea/workflows/secret-scan.yml
T
hongming 0c96019780
meta-ci-advisory / meta (advisory) (push) Skipped
publish-image / Resolve runtime version (push) Skipped
publish-image / Classify change (decouple publish from promote) (push) Skipped
publish-image / Build & push workspace-template-openclaw image (push) Skipped
publish-image / Promote runtime_image_pins (CP admin) (staging-api.moleculesai.app, staging) (push) Skipped
publish-image / Verify runtime_image_pins moved (fail-loud) (staging-api.moleculesai.app, staging) (push) Skipped
Secret scan / secret-scan (push) Skipped
sync-providers-yaml / Compare synced providers.yaml against controlplane canonical (push) Skipped
verify-providers-projection / Regenerate projection, fail on drift, assert registry ⊆ template (push) Skipped
sync-providers-yaml / Compare synced providers.yaml against controlplane canonical (pull_request) Skipped
meta-ci-advisory / meta (advisory) (pull_request) Successful in 4s
Secret scan / secret-scan (pull_request) Successful in 10s
verify-providers-projection / Regenerate projection, fail on drift, assert registry ⊆ template (pull_request) Successful in 12s
CI / Template validation (static) (push) Successful in 3s
CI / Template validation (static) (pull_request) Successful in 3s
CI / Adapter unit tests (pull_request) Successful in 27s
CI / Adapter unit tests (push) Successful in 27s
CI / Template validation (runtime) (pull_request) Successful in 1m11s
CI / Template validation (runtime) (push) Successful in 1m11s
CI / T4 tier-4 conformance (live) (push) Successful in 1m16s
CI / T4 tier-4 conformance (live) (pull_request) Successful in 1m17s
CI / validate (push) Successful in 1s
CI / validate (pull_request) Successful in 1s
Merge branch 'main' into fix/ci-concurrency-cancel-superseded
2026-10-12 00:05:39 +00:00

91 lines
3.3 KiB
YAML

name: Secret scan
# Repository-local secret scan. It stays inline so the required check name
# and scanner behavior are explicit in this repository.
#
# Emits check context "Secret scan / secret-scan (pull_request)" which
# matches the required-check name in this repo's branch protection.
#
# Workflow compatibility choices:
# - No workflow_dispatch.inputs
# - No merge_group trigger
# - No cross-repo uses:
# - GITHUB_SERVER_URL pinned at workflow level
# - No on.push.paths: filter
# - timeout-minutes on every job
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
on:
pull_request:
types: [opened, synchronize, reopened]
push:
branches: [main, staging, master]
env:
GITHUB_SERVER_URL: https://git.moleculesai.app
permissions:
contents: read
jobs:
secret-scan:
name: secret-scan
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Scan for secrets
run: |
python3 - << 'PYEOF'
import os, re, sys
from pathlib import Path
PATTERNS = [
re.compile(r'''["']sk-ant-[a-zA-Z0-9]{50,}["']'''),
re.compile(r'''["']ghp_[a-zA-Z0-9]{36,}["']'''),
re.compile(r'''["']AKIA[A-Z0-9]{16}["']'''),
re.compile(r'''["'][a-zA-Z0-9/+=]{40}["']'''),
re.compile(r'''["']sk_test_[a-zA-Z0-9]{24,}["']'''),
re.compile(r'''["']Bearer\s+[a-zA-Z0-9_.-]{20,}["']'''),
re.compile(r'''ghp_[a-zA-Z0-9]{36,}'''),
re.compile(r'''sk-ant-[a-zA-Z0-9]{50,}'''),
]
SKIP_DIRS = {'.molecule-ci-canonical', '.git', 'node_modules', '__pycache__'}
EXTENSIONS = {'.yaml', '.yml', '.md', '.py', '.sh'}
def is_false_positive(line):
ctx = line.lower()
return '...' in ctx or '<example' in ctx or '</example' in ctx
root = Path(os.environ.get('GITHUB_WORKSPACE', '.'))
warnings = []
for dirpath, dirnames, filenames in os.walk(root):
dirnames[:] = [d for d in dirnames if d not in SKIP_DIRS]
for filename in filenames:
if Path(filename).suffix not in EXTENSIONS:
continue
filepath = Path(dirpath) / filename
try:
with open(filepath, 'r', encoding='utf-8', errors='ignore') as f:
for lineno, line in enumerate(f.readlines(), 1):
for pattern in PATTERNS:
for match in pattern.finditer(line):
if not is_false_positive(line):
warnings.append(f" {filepath}:{lineno}: {match.group(0)[:40]}...")
except Exception:
pass
if warnings:
print("::error::Potential secret found in committed files:")
for w in warnings:
print(w)
sys.exit(1)
else:
print("::notice::No secrets detected")
PYEOF