Skip to content

fix: prevent XML injection in skills-ref to-prompt output - #2

Merged
pproenca merged 1 commit into
masterfrom
codex/fix-xml-injection-in-skills-ref-tool
Mar 7, 2026
Merged

fix: prevent XML injection in skills-ref to-prompt output#2
pproenca merged 1 commit into
masterfrom
codex/fix-xml-injection-in-skills-ref-tool

Conversation

@pproenca

@pproenca pproenca commented Mar 7, 2026

Copy link
Copy Markdown
Owner

Motivation

  • to-prompt emitted raw SKILL.md body inside a <![CDATA[ ... ]]> block, allowing a crafted ]]> in SKILL.md to break out of CDATA and inject XML nodes.
  • The intent is to neutralize the CDATA terminator in skill content while preserving emitted content and behavior.

Description

  • In scripts/skills-ref the SKILL.md body is now sanitized by splitting CDATA terminators: ]]>]]]]><![CDATA[> and the script emits the safeCdata value instead of the raw body.
  • Added a regression fixture tests/fixtures/cdata-terminator/SKILL.md containing an example CDATA-terminator payload.
  • Extended tests/run-tests.sh with test_to_prompt_cdata_safety which runs skills-ref to-prompt on the fixture and fails if injected XML appears outside the CDATA block.

Testing

  • Ran ./tests/run-tests.sh and all tests passed (All tests passed: 7/7).
  • Manually ran ./scripts/skills-ref to-prompt tests/fixtures/cdata-terminator to verify the CDATA terminator is split and no injected XML appears outside CDATA.

Codex Task

@pproenca
pproenca merged commit e9ed053 into master Mar 7, 2026
1 check passed
@pproenca
pproenca deleted the codex/fix-xml-injection-in-skills-ref-tool branch May 25, 2026 08:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant