Skip to content

Match unterminated script-tag defanging newline behavior #1184

Description

@fglock

Summary

PerlOnJava produces a different defanged comment for an unterminated script start tag: it retains the source trailing newline inside the generated comment, whereas system Perl emits the closing comment immediately after the tag content.

CPAN impact

HTML::Defang 1.09 failed test 25, No closing script tags, in t/02_xss.t during CPAN tester run 20260827-171032-2227. For the input <SCRIPT SRC=http://ha.ckers.org/xss.js? followed by a newline, PerlOnJava produces a comment whose closing delimiter is on the next line. System Perl passes the test.

The output remains defanged, but it is incompatible with the established parser behavior.

Acceptance criteria

  • Add a focused system-Perl-validated regression for the unterminated script-tag input.
  • Match system Perl output on JVM and interpreter backends.
  • HTML::Defang 1.09 t/02_xss.t passes on both backends.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions