Skip to content

feat(ci): add secret-scan workflow + reusable entry point for org-wide enrollment - #2109

Merged
HongmingWang-Rabbit merged 1 commit into
stagingfrom
feat/org-wide-secret-scan-workflow
Apr 26, 2026
Merged

feat(ci): add secret-scan workflow + reusable entry point for org-wide enrollment#2109
HongmingWang-Rabbit merged 1 commit into
stagingfrom
feat/org-wide-secret-scan-workflow

Conversation

@HongmingWang-Rabbit

Copy link
Copy Markdown
Contributor

[Molecule-Platform-Evolvement-Manager]

Org-wide CI gate against credential leaks. Defense-in-depth for the #2090-class incident — audit log proved the leak source was GitHub's hosted Copilot Coding Agent (UA GitHub CLI 2.90.0 Agent/claude-code), not Molecule's CP-BE. That agent runs in GitHub infra outside our control and clones with the token embedded in the remote URL; npm init then slurps it into package.json. We can't fix upstream's clone hygiene — we gate at the PR layer.

Pairs with Molecule-AI/molecule-ai-workspace-runtime#55 which adds the same scan as a runtime-side pre-commit hook (catches commits made by our runtime; this PR catches commits made by GitHub-hosted agents that bypass our runtime).

Single workflow, dual purpose

Mode Trigger Effect
Self-gate pull_request, push (main/staging), merge_group Required check on this repo
Reusable workflow_call Other Molecule-AI repos enroll with 3 lines (see Rollout below)

Pattern set

Covers GitHub family (ghp_, ghs_, gho_, ghu_, ghr_, github_pat_), Anthropic, OpenAI, Slack, AWS. Mirror of the runtime's bundled pre-commit hook (molecule-ai-workspace-runtime: molecule_runtime/scripts/pre-commit-checks.sh). When either side adds a pattern, update both.

Anchored on prefixes with low false-positive rates against agent-generated content. No plain hex blobs (would false-positive on commit hashes / IDs).

Error message redacts the matched value

Prints <file> (matched: <pattern>) only — the secret value never lands in CI logs (logs are searchable + retained, so echoing widens the blast radius).

Self-exclude

.github/workflows/secret-scan.yml is on the SELF exclude list because the file's own regex literals would otherwise block its own merge.

Rollout plan (follow-up PRs, separate scope)

After this lands, enroll the high-traffic repos surfaced in the audit log (top 5 by Copilot Coding Agent activity over 7 days):

Rank Repo Agent events / 7d
1 molecule-core 1,781 — covered by this PR
2 docs 170
3 molecule-monorepo 169 (suspect orphan — investigate first)
4 molecule-controlplane TBD (high-value: provisions tenants)
5 molecule-ai-workspace-runtime TBD (publishes to PyPI — secret leak = supply chain risk)

Each enrollment PR is 3 lines:

name: Secret scan
on: [pull_request, push, merge_group]
jobs:
  scan:
    uses: Molecule-AI/molecule-monorepo/.github/workflows/secret-scan.yml@main

Plus a one-line branch-protection update to mark Scan diff for credential-shaped strings as required.

Test plan

  • CI on this PR: the workflow self-runs and passes (no secret-shaped strings in the workflow file itself thanks to SELF exclude)
  • Verify SELF exclude: the regex literals in the workflow file would otherwise match ghs_[A-Za-z0-9]{36,} against itself; if SELF didn't work the workflow would fail on its own merge
  • Post-merge: open a follow-up enrollment PR for molecule-controlplane as the canary consumer to confirm workflow_call cross-repo invocation works
  • Post-merge follow-up: confirm molecule-monorepo repo's 169 agent events are legitimate (not orphan) before enrolling

🤖 Generated with Claude Code

…e enrollment

Defense-in-depth for the #2090-class incident (2026-04-24): GitHub's
hosted Copilot Coding Agent leaked a ghs_* installation token into
tenant-proxy/package.json via npm init slurping the URL from a
token-embedded origin remote. We can't fix upstream's clone hygiene,
so we gate at the PR layer.

Single workflow, dual purpose:

1. PR / push / merge_group gate on this repo (molecule-monorepo).
   Refuses any change whose diff additions contain a credential-shaped
   string. Same shape as Block forbidden paths — error message tells
   the agent how to recover without echoing the secret value.

2. Reusable workflow entry point (workflow_call) for the rest of the
   org. Other Molecule-AI repos enroll with a 3-line workflow:

     jobs:
       secret-scan:
         uses: Molecule-AI/molecule-monorepo/.github/workflows/secret-scan.yml@main

   This makes molecule-monorepo the single source of truth for the
   regex set; consumer repos pick up new patterns without per-repo PRs.

Pattern set covers GitHub family (ghp_, ghs_, gho_, ghu_, ghr_,
github_pat_), Anthropic / OpenAI / Slack / AWS. Mirror of the
runtime's bundled pre-commit hook (molecule-ai-workspace-runtime:
molecule_runtime/scripts/pre-commit-checks.sh) — keep aligned when
either side adds a pattern.

Self-exclude on .github/workflows/secret-scan.yml so the file's own
regex literals don't block its merge.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@HongmingWang-Rabbit
HongmingWang-Rabbit added this pull request to the merge queue Apr 26, 2026
Merged via the queue into staging with commit 2630122 Apr 26, 2026
15 checks passed
This was referenced Apr 26, 2026
HongmingWang-Rabbit added a commit to Molecule-AI/molecule-ai-plugin-molecule-medo that referenced this pull request Apr 29, 2026
chore(ci): enroll in org-wide secret-scan reusable workflow (EnterOS-AI/enter-os-core#2109)
HongmingWang-Rabbit added a commit to Molecule-AI/molecule-ai-plugin-molecule-security-scan that referenced this pull request Apr 29, 2026
chore(ci): enroll in org-wide secret-scan reusable workflow (EnterOS-AI/enter-os-core#2109)
HongmingWang-Rabbit added a commit to Molecule-AI/molecule-ai-plugin-molecule-session-context that referenced this pull request Apr 29, 2026
chore(ci): enroll in org-wide secret-scan reusable workflow (EnterOS-AI/enter-os-core#2109)
HongmingWang-Rabbit added a commit to Molecule-AI/molecule-ai-plugin-molecule-skill-code-review that referenced this pull request Apr 29, 2026
chore(ci): enroll in org-wide secret-scan reusable workflow (EnterOS-AI/enter-os-core#2109)
HongmingWang-Rabbit added a commit to Molecule-AI/molecule-ai-plugin-molecule-skill-cron-learnings that referenced this pull request Apr 29, 2026
chore(ci): enroll in org-wide secret-scan reusable workflow (EnterOS-AI/enter-os-core#2109)
HongmingWang-Rabbit added a commit to Molecule-AI/molecule-ai-plugin-molecule-skill-cross-vendor-review that referenced this pull request Apr 29, 2026
chore(ci): enroll in org-wide secret-scan reusable workflow (EnterOS-AI/enter-os-core#2109)
HongmingWang-Rabbit added a commit to Molecule-AI/molecule-ai-plugin-molecule-skill-llm-judge that referenced this pull request Apr 29, 2026
chore(ci): enroll in org-wide secret-scan reusable workflow (EnterOS-AI/enter-os-core#2109)
HongmingWang-Rabbit added a commit to Molecule-AI/molecule-ai-plugin-molecule-skill-update-docs that referenced this pull request Apr 29, 2026
chore(ci): enroll in org-wide secret-scan reusable workflow (EnterOS-AI/enter-os-core#2109)
HongmingWang-Rabbit added a commit to Molecule-AI/molecule-ai-plugin-molecule-workflow-retro that referenced this pull request Apr 29, 2026
chore(ci): enroll in org-wide secret-scan reusable workflow (EnterOS-AI/enter-os-core#2109)
HongmingWang-Rabbit added a commit to Molecule-AI/molecule-ai-plugin-molecule-workflow-triage that referenced this pull request Apr 29, 2026
chore(ci): enroll in org-wide secret-scan reusable workflow (EnterOS-AI/enter-os-core#2109)
HongmingWang-Rabbit added a commit to Molecule-AI/molecule-ai-plugin-superpowers that referenced this pull request Apr 29, 2026
chore(ci): enroll in org-wide secret-scan reusable workflow (EnterOS-AI/enter-os-core#2109)
HongmingWang-Rabbit added a commit to Molecule-AI/docs that referenced this pull request Apr 29, 2026
chore(ci): enroll in org-wide secret-scan reusable workflow (EnterOS-AI/enter-os-core#2109)
HongmingWang-Rabbit added a commit to Molecule-AI/molecule-ai-workspace-template-openclaw that referenced this pull request Apr 29, 2026
chore(ci): enroll in org-wide secret-scan reusable workflow (EnterOS-AI/enter-os-core#2109)
HongmingWang-Rabbit added a commit to Molecule-AI/molecule-ai-workspace-template-langgraph that referenced this pull request Apr 29, 2026
chore(ci): enroll in org-wide secret-scan reusable workflow (EnterOS-AI/enter-os-core#2109)
HongmingWang-Rabbit added a commit to Molecule-AI/molecule-ai-workspace-template-deepagents that referenced this pull request Apr 29, 2026
chore(ci): enroll in org-wide secret-scan reusable workflow (EnterOS-AI/enter-os-core#2109)
HongmingWang-Rabbit added a commit to Molecule-AI/molecule-ai-workspace-template-crewai that referenced this pull request Apr 29, 2026
chore(ci): enroll in org-wide secret-scan reusable workflow (EnterOS-AI/enter-os-core#2109)
HongmingWang-Rabbit added a commit to Molecule-AI/molecule-ai-workspace-template-autogen that referenced this pull request Apr 29, 2026
chore(ci): enroll in org-wide secret-scan reusable workflow (EnterOS-AI/enter-os-core#2109)
HongmingWang-Rabbit added a commit to Molecule-AI/molecule-ai-workspace-template-claude-code that referenced this pull request Apr 29, 2026
HongmingWang-Rabbit added a commit to Molecule-AI/molecule-ai-workspace-template-claude-code that referenced this pull request Apr 29, 2026
chore(ci): enroll in org-wide secret-scan reusable workflow (EnterOS-AI/enter-os-core#2109)
HongmingWang-Rabbit added a commit to Molecule-AI/molecule-ai-workspace-template-gemini-cli that referenced this pull request Apr 29, 2026
HongmingWang-Rabbit added a commit to Molecule-AI/molecule-ai-workspace-template-gemini-cli that referenced this pull request Apr 29, 2026
chore(ci): enroll in org-wide secret-scan reusable workflow (EnterOS-AI/enter-os-core#2109)
HongmingWang-Rabbit added a commit to Molecule-AI/molecule-ai-workspace-template-hermes that referenced this pull request Apr 29, 2026
HongmingWang-Rabbit added a commit to Molecule-AI/molecule-ai-workspace-template-hermes that referenced this pull request Apr 29, 2026
chore(ci): enroll in org-wide secret-scan reusable workflow (EnterOS-AI/enter-os-core#2109)
HongmingWang-Rabbit added a commit to Molecule-AI/molecule-ai-plugin-molecule-prompt-watchdog that referenced this pull request May 2, 2026
chore(ci): enroll in org-wide secret-scan reusable workflow (EnterOS-AI/enter-os-core#2109)
HongmingWang-Rabbit added a commit to Molecule-AI/molecule-ai-plugin-molecule-compliance that referenced this pull request May 2, 2026
chore(ci): enroll in org-wide secret-scan reusable workflow (EnterOS-AI/enter-os-core#2109)
HongmingWang-Rabbit added a commit to Molecule-AI/molecule-ai-org-template-molecule-worker-gemini that referenced this pull request May 2, 2026
chore(ci): enroll in org-wide secret-scan reusable workflow (EnterOS-AI/enter-os-core#2109)
HongmingWang-Rabbit added a commit to Molecule-AI/molecule-ai-plugin-molecule-freeze-scope that referenced this pull request May 2, 2026
chore(ci): enroll in org-wide secret-scan reusable workflow (EnterOS-AI/enter-os-core#2109)
HongmingWang-Rabbit added a commit to Molecule-AI/molecule-ai-org-template-reno-stars that referenced this pull request May 2, 2026
chore(ci): enroll in org-wide secret-scan reusable workflow (EnterOS-AI/enter-os-core#2109)
HongmingWang-Rabbit added a commit to Molecule-AI/molecule-ai-org-template-medo-smoke that referenced this pull request May 2, 2026
chore(ci): enroll in org-wide secret-scan reusable workflow (EnterOS-AI/enter-os-core#2109)
@molecule-ai
molecule-ai Bot deleted the feat/org-wide-secret-scan-workflow branch May 20, 2026 06:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant