summaryrefslogtreecommitdiff
path: root/plugins/code-modernization/agents
diff options
context:
space:
mode:
authorMorgan Lunt <morganl@anthropic.com>2026-06-09 08:49:47 -0700
committerGitHub <noreply@github.com>2026-06-09 08:49:47 -0700
commit746c982737e3ce684dc45844f703d5b40389ed78 (patch)
tree7d3127a7d7c34f4f0dcbbc0ef2c1f6f40dd7d0aa /plugins/code-modernization/agents
parent88233b24ba89bcfb04d28444b32b60ad2d4cac01 (diff)
parent4f49895abd8e59eb019780b87531d3ffd3f38765 (diff)
Merge pull request #2467 from anthropics/morganl/code-mod-secrets-redaction
code-modernization: never write discovered credential values into findings
Diffstat (limited to 'plugins/code-modernization/agents')
-rw-r--r--plugins/code-modernization/agents/architecture-critic.md6
-rw-r--r--plugins/code-modernization/agents/business-rules-extractor.md9
-rw-r--r--plugins/code-modernization/agents/legacy-analyst.md9
-rw-r--r--plugins/code-modernization/agents/security-auditor.md25
-rw-r--r--plugins/code-modernization/agents/test-engineer.md9
5 files changed, 57 insertions, 1 deletions
diff --git a/plugins/code-modernization/agents/architecture-critic.md b/plugins/code-modernization/agents/architecture-critic.md
index 08ba03b1..cf45ec6a 100644
--- a/plugins/code-modernization/agents/architecture-critic.md
+++ b/plugins/code-modernization/agents/architecture-critic.md
@@ -29,6 +29,12 @@ For **transformed code**:
- Does the test suite actually pin behavior, or just exercise code paths?
- What would the on-call engineer need at 3am that isn't here?
+## Secret handling (mandatory)
+
+When a finding quotes code containing a credential, key, token, or
+connection string, mask the value (`'Pr0d****'`) and cite `file:line` —
+findings get appended verbatim to committed notes files.
+
## Output
Findings ranked **Blocker / High / Medium / Nit**. Each with: what, where,
diff --git a/plugins/code-modernization/agents/business-rules-extractor.md b/plugins/code-modernization/agents/business-rules-extractor.md
index 31eca621..c0d0bb21 100644
--- a/plugins/code-modernization/agents/business-rules-extractor.md
+++ b/plugins/code-modernization/agents/business-rules-extractor.md
@@ -40,6 +40,15 @@ of the technology, skip it.
from structure/names), **Low** (ambiguous; needs SME).
6. If confidence < High, write the exact question an SME must answer.
+## Secret handling (mandatory)
+
+Rule parameters sometimes *are* credentials — hardcoded passwords in auth
+checks, API keys in partner-service calls, connection strings in batch
+routines. Record the **rule**, never the **value**: write the parameter as
+`<credential — masked, see file:line>` with at most a 2–4 character
+preview. Rule cards flow into briefs and steering decks; a raw credential
+in a parameter list is a leak.
+
## Output format
One "Rule Card" per rule (see the format in the `/modernize-extract-rules`
diff --git a/plugins/code-modernization/agents/legacy-analyst.md b/plugins/code-modernization/agents/legacy-analyst.md
index b22e5736..a6fd5e6c 100644
--- a/plugins/code-modernization/agents/legacy-analyst.md
+++ b/plugins/code-modernization/agents/legacy-analyst.md
@@ -32,6 +32,15 @@ and explain it in terms a modern engineer can act on.
- **Note what's missing.** Unhandled error paths, TODO comments, commented-out
blocks, magic numbers — these are signals about history and risk.
+## Secret handling (mandatory)
+
+Legacy code is full of live credentials, and your findings get copied into
+shareable reports. When the evidence for a finding — hardcoded config,
+dead code, debt, an interface payload — includes a credential, API key,
+token, connection string, or private key, **never reproduce the value**.
+Cite `file:line` with a masked preview (`VALUE 'Pr0d****'`,
+`password=****`). The finding is the practice, not the value.
+
## Output format
Default to structured markdown: tables for inventories, Mermaid for graphs,
diff --git a/plugins/code-modernization/agents/security-auditor.md b/plugins/code-modernization/agents/security-auditor.md
index f1b291db..4f34a340 100644
--- a/plugins/code-modernization/agents/security-auditor.md
+++ b/plugins/code-modernization/agents/security-auditor.md
@@ -39,7 +39,30 @@ terminal/screen items don't apply to a SPA. Work through what's relevant:
Use available SAST where it helps (npm audit, pip-audit, grep for known-bad
patterns) but **read the code** — tools miss logic flaws. Show tool output
-verbatim, then add your manual findings.
+verbatim — except secret values, which you redact (see below) — then add
+your manual findings.
+
+## Secret handling (mandatory)
+
+Legacy codebases routinely contain live production credentials, and your
+findings get pasted into decks, tickets, and committed markdown. Copying a
+secret into a report multiplies the exposure you were hired to find.
+
+When you discover a hardcoded credential, API key, token, connection
+string, or private key:
+
+- **Never write the secret's value into any output** — no finding table,
+ no report, no quoted code excerpt, no echoed tool output. Mask it to the
+ first 2–4 identifying characters plus `****` (`AKIA****`,
+ `postgres://app_user:****@db-prod…`). If a scanner prints a secret,
+ redact it before including the excerpt.
+- Cite `file:line`. The source file is the canonical location — anyone who
+ legitimately needs the value can open it there.
+- State what the credential appears to grant access to (database, queue,
+ cloud account, third-party API) and whether it looks like a production
+ or test credential.
+- Recommend rotation for anything that looks live — exposure in source
+ means it is already compromised, independent of any modernization plan.
## Reporting standard
diff --git a/plugins/code-modernization/agents/test-engineer.md b/plugins/code-modernization/agents/test-engineer.md
index 9f49e883..07057ad0 100644
--- a/plugins/code-modernization/agents/test-engineer.md
+++ b/plugins/code-modernization/agents/test-engineer.md
@@ -28,6 +28,15 @@ someone thinks it should do) so that a rewrite can be proven equivalent.
`@Disabled("pending RULE-NNN")` / `@pytest.mark.skip` / `it.todo()` — never
deleted.
+## Secret handling (mandatory)
+
+Never copy credential-like literals — passwords, API keys, tokens,
+connection strings — from legacy code into test fixtures. Tests live in
+the deliverable codebase and get committed. Substitute clearly-fake values
+of the same shape and length and note the substitution in a comment.
+Anything a test genuinely needs live (e.g. a real database connection for
+a dual-run harness) is read from an environment variable, never inlined.
+
## Output
Idiomatic tests for the requested target stack (JUnit 5 / pytest / Vitest /