diff options
| author | Morgan Lunt <morganl@anthropic.com> | 2026-06-17 17:18:26 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-06-17 17:18:26 -0700 |
| commit | 460d1033d454a9bf0e0cdc3969910f68dd69b6be (patch) | |
| tree | b46d7a70419656b30e78235ec46d30ced5924b62 /plugins/code-modernization/commands/modernize-map.md | |
| parent | beae06093ae205afa36c6f58ac96465bc8c31c3b (diff) | |
| parent | 8e61adb4c7f574e4bb7b03a0f242065c95b36f58 (diff) | |
Merge pull request #2536 from anthropics/codemod-dynamic-workflows
code-modernization: dynamic workflow orchestration + untrusted-content hardening
Diffstat (limited to 'plugins/code-modernization/commands/modernize-map.md')
| -rw-r--r-- | plugins/code-modernization/commands/modernize-map.md | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/plugins/code-modernization/commands/modernize-map.md b/plugins/code-modernization/commands/modernize-map.md index 53668ca6..afe248ad 100644 --- a/plugins/code-modernization/commands/modernize-map.md +++ b/plugins/code-modernization/commands/modernize-map.md @@ -146,6 +146,12 @@ tpl = open(tpl_path).read() marker = "/*__TOPOLOGY_DATA__*/ null" assert marker in tpl, f"injection marker not found in {tpl_path}" data = json.dumps(json.load(open(f"{out_dir}/topology.json"))) +# topology.json is derived from UNTRUSTED source (node names come from filenames, +# observations/flows from analyzed code). The data is injected into a <script> +# block, and the HTML parser closes <script> on the literal bytes "</script>" +# regardless of JS string context — so a node named "x</script><script>…" would +# execute. json.dumps does NOT escape "<". Escape it (JSON-safe) to kill the breakout. +data = data.replace("<", "\\u003c").replace(">", "\\u003e").replace("&", "\\u0026") open(f"{out_dir}/TOPOLOGY.html", "w").write( tpl.replace(marker, "/*__TOPOLOGY_DATA__*/ " + data)) print(f"wrote {out_dir}/TOPOLOGY.html") |
