mirror of
https://github.com/andrewyng/openworker.git
synced 2026-09-13 15:50:02 +00:00
Sidecar inherits the login shell's env; toolchain resolves absolute paths with pinned installs; request_tool replaces the 'tool missing -> STOP' instruction that hid a check.
2.6 KiB
2.6 KiB
name, description
| name | description |
|---|---|
| secret-scan | Hunt committed secrets with gitleaks and drive safe rotation |
Find committed credentials and get them rotated and removed — without ever exposing them further yourself.
ABSOLUTE RULE: never print a secret's value — not in output, notes, todo items, commits, or PRs. Refer to every hit as " in : (commit )".
- Check the tool:
gitleaks version. If it's missing, do NOT skip this scan and do not stop the review — ask for it withrequest_tool("gitleaks", …). If the user declines, or no pinned build exists for their platform, fall back to step 2b and say in your report that the sweep was manual. - Scan working tree AND history — history matters most: a secret deleted in HEAD is still
live in every clone, and it is the hit users are most surprised by.
a. With gitleaks:
gitleaks detect --source . --report-format json --report-path /tmp/gitleaks.jsonb. Without it, do the same job by hand, and say so:- working tree:
git grep -nIE '(api[_-]?key|secret|token|password|BEGIN [A-Z ]*PRIVATE KEY|AKIA[0-9A-Z]{16}|sk_(live|test)_[0-9a-zA-Z]{16,}|xox[baprs]-)' - history, including files deleted since:
git log -p --all -S 'AKIA' --pickaxe-allandgit log --diff-filter=D --name-only --pretty=format:%h -- '*.env*' '*credential*' '*secret*', then read the removed contents withgit show <sha>^:<path>. - Pipe anything you read through a redactor rather than into your transcript, e.g.
sed -E "s/[A-Za-z0-9_\\-]{16,}/[REDACTED]/g"— the no-printing rule still applies.
- working tree:
- Triage each hit by reading its context:
- Real credential, test fixture, or example placeholder? Say which and why.
- For real ones: what does it grant access to, and is it plausibly still valid?
- For every real secret, in this order:
a. ROTATE first — tell the user exactly where to revoke/rotate it (the provider's
console page or CLI command). Rotation beats removal: history rewrite without
rotation is false comfort.
b. Remove it from the code: move to env vars or the project's secret store, matching
how this codebase already handles configuration.
c. Prevent recurrence: add/extend
.gitignorefor local secret files and offer a.gitleaks.tomlbaseline plus a pre-commit hook. d. History purge (git filter-repo/BFG) is DESTRUCTIVE and rewrites shared history — describe the trade-off and only proceed if the user explicitly asks. - Deliver: a hit list (kind · location · verdict · rotation status), the cleanup branch/PR, and the prevention setup you added or recommend.