Review main Merged

65700[BUGFIX] Prevent double escaping for src attribute in ScriptViewHelper

Frank Nägler CR +2 V +2 Normal +126 −1 updated 10/25/20, 16:20

Commit message

This patch prevents double escaping of the src attribute by unescaping
the value before handover to the AssetCollector->addJavaScript() function.

Review

  • Code review CR +2 Done
    • Daniel Goerz +2
    • Jonas Eberle +1
  • Verified V +2 Done
    • Daniel Goerz +2
    • Jonas Eberle +1
    • TYPO3com +1 CI

Issues 1

Files 3

Review log 1924

  1. Frank Nägler uploaded patch set 1 09/10/20, 19:56

  2. TYPO3com voted on patch set 1 V +1 09/10/20, 20:22 Completed build in 22m 45s on Thu, 10 Sep, 08:22 PM Test Summary: 73203 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-5523

  3. Benni Mack commented on patch set 1 09/10/20, 20:25

    ScriptViewHelper.php:101

    should we use rawurldecode() instead?
  4. Frank Nägler commented on patch set 1 09/10/20, 20:34

    ScriptViewHelper.php:101 Reply

    > should we use rawurldecode() instead? nope, we have to undo the htmlspecialchars method. check this quick test to see the difference: https://3v4l.org/ZS8Mi
  5. Benni Mack commented on patch set 1 09/10/20, 20:53

    ScriptViewHelper.php:101 Reply

    Ah, thanks for the explanation. Just tried input like this: "https://typo3.com/foo.js?foo=bar&bar=baz<script>evil</script>"; which would revert to the <script> tag again :( but AFAIK this would be resolved in the AssetRenderer then.
  6. Frank Nägler commented on patch set 1 09/10/20, 20:58

    ScriptViewHelper.php:101 Reply Unresolved

    yes, correct. The escaping (HSC) happens again later (in the AssetRenderer?) which is the reason for the fix :D
  7. Andreas Kienast uploaded patch set 2 09/11/20, 06:49

  8. Andreas Kienast voted on patch set 2 V +1 CR +1 09/11/20, 06:49

  9. TYPO3com voted on patch set 2 V +1 09/11/20, 07:00 Completed build in 11m 27s on Fri, 11 Sep, 07:00 AM Test Summary: 73215 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-5527

  10. Jörg Bösche voted on patch set 2 CR +1 09/11/20, 08:54

  11. Oliver Hader commented on patch set 2 09/11/20, 09:00

    ScriptViewHelperTest.php:60

    For security reasons, can be ensure that 'src="<script>alert(1)</script><x "' is properly encoded?
  12. Frank Nägler commented on patch set 2 CR -1 09/11/20, 09:02

    will add some more test cases to the AssetRendererTest (thx Oliver for the hint)
  13. Frank Nägler commented on patch set 2 09/11/20, 09:10

    ScriptViewHelperTest.php:60 Reply Unresolved

    see my comment, I will check and extend the AssetRenderer tests and will add this example.
  14. Frank Nägler uploaded patch set 3 09/11/20, 10:33

  15. TYPO3com voted on patch set 3 V -1 09/11/20, 10:44 Completed build in 11m 08s on Fri, 11 Sep, 10:44 AM Test Summary: 12 of 73796 failed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-5535

  16. Frank Nägler uploaded patch set 4 09/11/20, 11:06

  17. TYPO3com voted on patch set 4 V +1 09/11/20, 11:18 Completed build in 12m 02s on Fri, 11 Sep, 11:18 AM Test Summary: 73311 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-5536

  18. Jörg Bösche voted on patch set 4 CR +1 09/11/20, 12:15

  19. Oliver Hader commented on patch set 4 CR -1 09/11/20, 12:25

    On it
  20. Oliver Hader uploaded patch set 5 09/11/20, 12:32

  21. TYPO3com voted on patch set 5 V +1 09/11/20, 12:43 Completed build in 11m 04s on Fri, 11 Sep, 12:43 PM Test Summary: 73311 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-5542

  22. Jonas Eberle voted on patch set 5 V +1 CR +1 10/20/20, 17:22

  23. Daniel Goerz voted on patch set 5 V +2 CR +2 10/25/20, 16:20

  24. Daniel Goerz merged patch set 6 10/25/20, 16:20