Skip to content
This repository was archived by the owner on Jun 18, 2026. It is now read-only.

security: harden JavaScript string escaping in HTML exporters (XSS) - #112

Closed
sauravbhattacharya001 wants to merge 1 commit into
masterfrom
gardener/harden-js-escaping
Closed

sauravbhattacharya001 wants to merge 1 commit into
masterfrom
gardener/harden-js-escaping

Conversation

@sauravbhattacharya001

Copy link
Copy Markdown
Owner

What

4 HTML exporter classes had incomplete JS string escaping, vulnerable to XSS (CWE-79) when node IDs or labels contain crafted strings.

Missing escapes (before this PR)

Character Risk
/\ (forward slash) </script>\ tag injection breaks out of JS context
Backtick + \$\ Template literal injection (\)
U+2028, U+2029 Unicode line separators break JS string literals
Single quote Breaks attribute contexts in some embeddings

Fix

  • Created \HtmlExportUtils.java\ — shared utility with comprehensive \�scapeJs()\ and \�scapeHtml()\
  • Updated all 4 affected files to delegate to the shared utility:
    • \GraphDiffHtmlExporter\
    • \CentralityRadarExporter\
    • \GraphAlgorithmAnimator\
    • \GraphTimelineExporter\

Automated by Repo Gardener 🌱

The escapeJs/escapeJson methods in 4 HTML exporter classes were
missing critical escapes:
- Forward slash (/) — allows </script> tag injection (CWE-79)
- Backtick and dollar sign — template literal injection
- Unicode line separators (U+2028/U+2029) — break JS string literals
- Single quotes — break attribute contexts

Created a shared HtmlExportUtils.escapeJs() utility with comprehensive
escaping and updated all 4 affected exporters to delegate to it:
- GraphDiffHtmlExporter
- CentralityRadarExporter
- GraphAlgorithmAnimator
- GraphTimelineExporter
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@github-actions github-actions Bot added visualization Graph visualization and UI size/m labels Mar 23, 2026
@sauravbhattacharya001

Copy link
Copy Markdown
Owner Author

Closing: superseded or conflicting with newer changes already on main/master.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

size/m visualization Graph visualization and UI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant