Skip to content

Commit af4235d

Browse files
andrevanzuydamclaudetina4stack
committed
test(csp): case-insensitive tag regex to satisfy CodeQL js/py-bad-tag-filter
The CSP test scanned the framework's own (always-lowercase) inline tags with a case-sensitive regex; CodeQL's bad-HTML-filter rule flagged it as not matching <SCRIPT>. The scan is a test assertion over the framework's own output, not a sanitiser over untrusted input, so it was a false positive in context - but the case-insensitive flag is strictly better and clears the CodeQL gate. php already used /i; python/ruby/node now match. Signed-off-by: Andre van Zuydam <andrevanzuydam@gmail.com> Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Co-Authored-By: Tina4 <82961293+tina4stack@users.noreply.github.com>
1 parent f89d9a5 commit af4235d

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

‎tests/test_csp_nonce_inline.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,8 @@ def test_welcome_inline_style_and_script_carry_the_header_nonce(served):
9090
# Every inline <style>/<script> the framework emits must carry THIS nonce.
9191
# An external <script src=...> (the dev toolbar) is exempt and must NOT be
9292
# forced to carry one, so only inspect tags with no src attribute.
93-
inline_style_open = re.findall(r"<style\b([^>]*)>", body)
94-
inline_script_open = re.findall(r"<script\b([^>]*)>", body)
93+
inline_style_open = re.findall(r"<style\b([^>]*)>", body, re.IGNORECASE)
94+
inline_script_open = re.findall(r"<script\b([^>]*)>", body, re.IGNORECASE)
9595
assert inline_style_open, "welcome page emitted no <style>"
9696
assert inline_script_open, "welcome page emitted no <script>"
9797

0 commit comments

Comments
 (0)