Skip to content

Security: Unsafe HTML construction in helper allows injection into output#1084

Open
tuanaiseo wants to merge 1 commit intoanvilco:mainfrom
tuanaiseo:contribai/fix/security/unsafe-html-construction-in-helper-allow
Open

Security: Unsafe HTML construction in helper allows injection into output#1084
tuanaiseo wants to merge 1 commit intoanvilco:mainfrom
tuanaiseo:contribai/fix/security/unsafe-html-construction-in-helper-allow

Conversation

@tuanaiseo
Copy link
Copy Markdown

Problem

spanWrap interpolates className and value directly into an HTML string. If either comes from untrusted spec data, this enables HTML attribute/content injection (e.g., breaking out of attributes or injecting tags) when rendered unescaped or via triple-stash usage.

Severity: high
File: src/themes/default/helpers/spanWrap.js

Solution

Escape both attribute and text contexts before interpolation (or build DOM-safe output via templating primitives). Restrict className to a safe pattern like /^[a-zA-Z0-9_- ]+$/.

Changes

  • src/themes/default/helpers/spanWrap.js (modified)

Testing

  • Existing tests pass
  • Manual review completed
  • No new warnings/errors introduced

…ctio

`spanWrap` interpolates `className` and `value` directly into an HTML string. If either comes from untrusted spec data, this enables HTML attribute/content injection (e.g., breaking out of attributes or injecting tags) when rendered unescaped or via triple-stash usage.

Affected files: spanWrap.js

Signed-off-by: tuanaiseo <221258316+tuanaiseo@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant