SecretSleuth Talk to IronTech

DocsStart here

How it works

Secret Sleuth does not just report secrets. A full scan changes your working tree and how git treats it, so it pays to know the model before you run it.

What a full scan does to a flagged file

As committed--dry-run marks it

"ConnectionStrings": {
  "DefaultConnection": "Server=sql-02;…;Password=Wint3r!"
},
"SendGrid": { "ApiKey": "SG.f3Kq9vXbT2…" }

After --full-scansealed and guarded

"ConnectionStrings": {
  "DefaultConnection": "DO_NOT_COMMIT_CONNSTR"
},
"SendGrid": { "ApiKey": "DO_NOT_COMMIT_APIKEY" }

Synthetic values. The syntax and quotes stay exactly as they were, so the file still parses.

After a full scan, a flagged file is…What that means for you
Rewritten on diskEach secret value is replaced with a DO_NOT_COMMIT_* placeholder. The real values are still in git HEAD, which is how they can be restored. Untracked files have no HEAD copy, so they are backed up to ~/.ironforge-secretsleuth/backups/ first.
Marked skip-worktree when trackedGit treats a tracked file as unchanged. Your edits to it do not appear in git status or VS Code, and git add refuses it with a confusing “outside of your sparse-checkout definition” message. Use stage to commit edits. Untracked files cannot be marked skip-worktree; the pre-commit hook still blocks staged placeholders in them.
Guarded by a pre-commit hookNothing whose staged content holds a placeholder can be committed.
Not runnable locally until you run the generated setup-dev-secrets scriptThe app reads the real values from user secrets or a local store instead. See Local dev secrets.

The first full scan of a repository explains this and asks you to confirm (--yes skips the question). A --dry-run does not change scanned files, Git protection, or the manifest. It still writes a report and, when findings exist and dev-secrets generation is enabled, a setup script under the profile by default. An explicit --report path inside the repository writes the report and setup script there.

The three guards

  1. skip-worktree on every obfuscated, tracked file. Untracked files cannot use this protection. A git pull or git checkout that would overwrite a tracked protected file fails loudly instead of silently restoring the real secret.
  2. post-merge hook. After every merge it checks that the files listed in .git/ironforge-protected still hold their placeholders, and warns (prompting a re-scan) when a merge restored a secret or changed a config file.
  3. pre-commit hook. Blocks any commit whose staged content contains DO_NOT_COMMIT_, including placeholders in untracked files. It checks what is staged, not the file on disk, so committing your own edit or remediated safe value in a protected file via stage works.

Existing hooks are never overwritten: they are renamed to <hook>.ifss-backup and still run after the Secret Sleuth check. restore --remove-hooks puts them back.

I want to…

All commands default --repo to the current folder. Run <command> --help for every option.

I want to…Run
See what would be found, changing nothingSecretSleuth --dry-run
Obfuscate and protect a repoSecretSleuth --full-scan
Check whether everything is in orderSecretSleuth status
Pull the current branchSecretSleuth pull
Switch branch (and pull)SecretSleuth branch-switch --to main --pull
Commit my edits to a protected fileSecretSleuth stage --file appsettings.json
Put the real values back in some filesSecretSleuth restore --file <path>
Undo everything Secret Sleuth didSecretSleuth restore --all --remove-hooks
Track remediationSecretSleuth remediate --list

Never use plain git pull or git checkout <branch> on a protected repo

Use pull and branch-switch. They put the real values back first, refuse to throw away your own edits, and re-protect afterwards.

Safety first

  1. Run --dry-run first on a clean branch.
  2. Treat detected secrets as compromised and rotate them.
  3. Cleaning the current files is not cleaning history.
  4. Learn the two commands that get you out of trouble before you need them: status and restore --all --remove-hooks.