Page MenuHomePhabricator

Disallow <! in <script>
ClosedPublic

Authored by vrana on Oct 16 2013, 3:49 PM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Dec 27, 6:49 AM
Unknown Object (File)
Wed, Dec 18, 2:51 AM
Unknown Object (File)
Thu, Dec 12, 2:34 PM
Unknown Object (File)
Dec 10 2024, 2:37 PM
Unknown Object (File)
Dec 10 2024, 2:22 AM
Unknown Object (File)
Dec 9 2024, 6:25 AM
Unknown Object (File)
Dec 9 2024, 4:13 AM
Unknown Object (File)
Dec 9 2024, 4:13 AM

Details

Reviewers
epriestley
Commits
Restricted Diffusion Commit
rP29391a658e77: Disallow <! in <script>
Summary

HTML5 has this crazy script escaping states:

  • Script data escaped dash dash state
  • Script data double escaped state

https://communities.coverity.com/blogs/security/2012/11/16/did-i-do-that-html-5-js-escapers-3

Perhaps <! is too aggressive but I didn't spend much time searching for a more fine grained expression.

Test Plan

Searched for renderInlineScript().

Diff Detail

Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

Thanks!

Do you think we should also force json_encode() to escape !? I can't imagine it causing problems, so we could probably wait until it does...

I think this is fine. It should be dangerous only inside <script> and we replace all < before sending it there.