From 718818146e93eeef3a94a3dac9ffa087558115cc Mon Sep 17 00:00:00 2001 From: Morgan Lunt Date: Mon, 11 May 2026 16:17:59 -0700 Subject: Fix code-modernization plugin: align README with commands, fix pipeline gaps MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - modernize-brief: read TOPOLOGY.html (what modernize-map actually produces) instead of nonexistent TOPOLOGY.md, and tell the user which command produces each missing input. - README: rewrite the Commands section to match actual command behavior — correct output filenames, ordering (brief is the synthesis/approval gate after discovery, not the first step), agent attributions, and required args. Add a workspace-layout note and an explicit callout that modernize-harden edits legacy/, which conflicts with the recommended deny rule. Reconcile the Overview and Typical Workflow sequences. - modernize-assess: generalize the production-runtime overlay step so it no longer assumes a specific MCP server/tool; mark it optional. Fix app/jcl/ -> legacy/$1/jcl/ for layout consistency. - modernize-map: make TOPOLOGY.html self-contained (load Mermaid from a CDN) so it renders in any browser; drop assumptions about an external artifact renderer. Generalize the telemetry annotation note. - business-rules-extractor agent: fix command cross-reference to the actual command name. - plugin.json: include the brief step in the workflow description. --- plugins/code-modernization/agents/business-rules-extractor.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'plugins/code-modernization/agents') diff --git a/plugins/code-modernization/agents/business-rules-extractor.md b/plugins/code-modernization/agents/business-rules-extractor.md index 19839aa6..31eca621 100644 --- a/plugins/code-modernization/agents/business-rules-extractor.md +++ b/plugins/code-modernization/agents/business-rules-extractor.md @@ -42,5 +42,5 @@ of the technology, skip it. ## Output format -One "Rule Card" per rule (see the format in the modernize:extract-rules +One "Rule Card" per rule (see the format in the `/modernize-extract-rules` command). Group by category. Lead with a summary table. -- cgit From 22a1b2597750246f104c88e66f0c379932d05c9b Mon Sep 17 00:00:00 2001 From: Morgan Lunt Date: Mon, 11 May 2026 16:28:27 -0700 Subject: Harden code-modernization plugin from a real CardDemo dry run MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes found by running the discovery workflow against the AWS CardDemo mainframe sample (~50 KLOC of COBOL/CICS/JCL/BMS/VSAM): - modernize-assess: add scc -> cloc -> find/wc fallback chain with the COCOMO-II formula so Step 1 works when scc isn't installed; same for portfolio-mode cloc/lizard. Drop the reference to a specific agent-spawning tool name (just "in parallel"). Sharpen the structural- map subagent prompt: 5-12 domains, subgraph clustering, ~40-edge cap, repo-relative paths, dangling-reference check. - modernize-map: expand the parse-target list with the things a literal-minded reader would miss on a real mainframe codebase — CICS CSD DEFINE TRANSACTION/FILE for entry points and online file I/O, EXEC CICS file ops, SELECT...ASSIGN TO joined with JCL DD, EXEC SQL table refs (not JCL DD), SEND/RECEIVE MAP, dynamic data-name XCTL resolution, COBOL fixed-format column slicing. Without these the dead-code list is wrong (most CICS programs look unreachable). Also write a machine-readable topology.json alongside the summary. - modernize-extract-rules: add a Priority (P0/P1/P2) field with a heuristic, and an optional Suspected-defect field. modernize-brief reads P0 rules to build the behavior contract, but the Rule Card had no priority slot — the chain was broken. - modernize-brief: read the new P0 tags; flag low-confidence P0 rules as SME blockers. - modernize-reimagine: drop "for the demo" wording. - security-auditor agent: add mainframe/COBOL coverage items (RACF, JCL/PROC creds, BMS field validation, DB2 dynamic SQL, copybook PII) and mark web-only items as such so it adapts to the target stack. - README: add Optional Tooling section and a symlink example for the expected layout. --- .../code-modernization/agents/security-auditor.md | 26 ++++++++++++++-------- 1 file changed, 17 insertions(+), 9 deletions(-) (limited to 'plugins/code-modernization/agents') diff --git a/plugins/code-modernization/agents/security-auditor.md b/plugins/code-modernization/agents/security-auditor.md index f26aac53..e33ee940 100644 --- a/plugins/code-modernization/agents/security-auditor.md +++ b/plugins/code-modernization/agents/security-auditor.md @@ -11,20 +11,28 @@ engineer can fix. ## Coverage checklist -Work through systematically: -- **Injection** (SQL, NoSQL, OS command, LDAP, XPath, template) — trace every - user-controlled input to every sink +Adapt to the target stack — web items don't apply to a batch COBOL system, +mainframe items don't apply to a SPA. Work through what's relevant: + +- **Injection** (SQL, NoSQL, OS command, LDAP, XPath, template, dynamic + DB2 SQL, JCL/PARM injection) — trace every user-controlled input to every sink - **Authentication / session** — hardcoded creds, weak session handling, - missing auth checks on sensitive routes -- **Sensitive data exposure** — secrets in source, weak crypto, PII in logs -- **Access control** — IDOR, missing ownership checks, privilege escalation paths -- **XSS / CSRF** — unescaped output, missing tokens + missing auth checks on sensitive routes/transactions +- **Sensitive data exposure** — secrets in source, weak crypto, PII/PAN/SSN in + logs, cleartext data in copybooks/flat files +- **Access control** — IDOR, missing ownership checks, privilege escalation; + for CICS: missing/permissive RACF transaction & resource definitions, + unguarded admin transactions +- **XSS / CSRF** — unescaped output, missing tokens (web targets only) - **Insecure deserialization** — pickle/yaml.load/ObjectInputStream on untrusted data - **Vulnerable dependencies** — run `npm audit` / `pip-audit` / read manifests and flag versions with known CVEs -- **SSRF / path traversal / open redirect** -- **Security misconfiguration** — debug mode, verbose errors, default creds +- **SSRF / path traversal / open redirect** (web targets only) +- **Input validation** — for CICS/3270: unvalidated BMS field input, + missing length/range/format checks before file/DB writes +- **Security misconfiguration** — debug mode, verbose errors, default creds, + hardcoded passwords/userids in JCL, PROCs, or sign-on programs ## Tooling -- cgit From 5e4a45001d608ce34437181d96340faa1f5899c9 Mon Sep 17 00:00:00 2001 From: Morgan Lunt Date: Mon, 11 May 2026 16:46:03 -0700 Subject: code-modernization: harden writes a patch instead of editing legacy; make map/security guidance language-agnostic - modernize-harden: never edits legacy/ anymore. Writes findings plus a reviewed unified diff to analysis//security_remediation.patch. A second security-auditor pass reviews each hunk (RESOLVES / PARTIAL / INTRODUCES-RISK) before presenting. The user reviews and applies the patch deliberately, then re-runs to verify. This makes every command consistent with the recommended deny Edit(legacy/**) workspace setting, so the README's exception note is gone. - modernize-map: restructure the parse-target list around three stack- agnostic principles (dispatcher targets are variables; code-storage joins live in config; entry points live in deployment descriptors), with COBOL/Java/web/CLI examples on equal footing rather than COBOL-dominant. Same protections against false dead-code findings, less stack-specific. - security-auditor agent: rephrase coverage items in stack-neutral terms (record layouts/temp datasets, resource ACLs, deployment scripts/job definitions, batch input records) so the checklist reads naturally for COBOL, Java EE, .NET, and web targets alike. - README: drop the harden exception note; describe the patch workflow. --- .../code-modernization/agents/security-auditor.md | 33 +++++++++++----------- 1 file changed, 17 insertions(+), 16 deletions(-) (limited to 'plugins/code-modernization/agents') diff --git a/plugins/code-modernization/agents/security-auditor.md b/plugins/code-modernization/agents/security-auditor.md index e33ee940..f1b291db 100644 --- a/plugins/code-modernization/agents/security-auditor.md +++ b/plugins/code-modernization/agents/security-auditor.md @@ -11,28 +11,29 @@ engineer can fix. ## Coverage checklist -Adapt to the target stack — web items don't apply to a batch COBOL system, -mainframe items don't apply to a SPA. Work through what's relevant: +Adapt to the target stack — web items don't apply to a batch system, +terminal/screen items don't apply to a SPA. Work through what's relevant: -- **Injection** (SQL, NoSQL, OS command, LDAP, XPath, template, dynamic - DB2 SQL, JCL/PARM injection) — trace every user-controlled input to every sink +- **Injection** (SQL, NoSQL, OS command, LDAP, XPath, template) — trace every + user-controlled input to every sink, including dynamic SQL and shell-outs - **Authentication / session** — hardcoded creds, weak session handling, - missing auth checks on sensitive routes/transactions -- **Sensitive data exposure** — secrets in source, weak crypto, PII/PAN/SSN in - logs, cleartext data in copybooks/flat files + missing auth checks on sensitive routes/transactions/jobs +- **Sensitive data exposure** — secrets in source, weak crypto, PII in logs, + cleartext sensitive data in record layouts, flat files, or temp datasets - **Access control** — IDOR, missing ownership checks, privilege escalation; - for CICS: missing/permissive RACF transaction & resource definitions, - unguarded admin transactions -- **XSS / CSRF** — unescaped output, missing tokens (web targets only) -- **Insecure deserialization** — pickle/yaml.load/ObjectInputStream on - untrusted data + missing/permissive resource ACLs (RACF profiles, IAM policies, file perms); + unguarded admin functions +- **XSS / CSRF** — unescaped output, missing tokens (web targets) +- **Insecure deserialization** — untrusted data into pickle/yaml.load/ + `ObjectInputStream` or custom record parsers - **Vulnerable dependencies** — run `npm audit` / `pip-audit` / read manifests and flag versions with known CVEs -- **SSRF / path traversal / open redirect** (web targets only) -- **Input validation** — for CICS/3270: unvalidated BMS field input, - missing length/range/format checks before file/DB writes +- **SSRF / path traversal / open redirect** (web/network targets) +- **Input validation** — missing length/range/format checks at trust + boundaries (form/screen fields, API params, batch input records) before + persistence or downstream calls - **Security misconfiguration** — debug mode, verbose errors, default creds, - hardcoded passwords/userids in JCL, PROCs, or sign-on programs + hardcoded credentials in deployment scripts, job definitions, or config ## Tooling -- cgit