Let the tests that forbid inline and outside scripts allow the Google tag, and nothing else
Mirror to forge / mirror (push) Canceled after 0s
Validate / validate (push) Canceled after 0s
Validate / history (push) Canceled after 0s
Validate / site (push) Canceled after 0s
Validate / deploy (push) Canceled after 0s

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
swaitsandClaude Fable 5.2 committed 2026-11-20 15:18:55 -07:00
1 parent 0d6197bedd
commit 99588ce306
4 files changed
+23 -6

No files matched your search

+4 -1
View File
@@ -170,7 +170,10 @@ class JsonLdTest(unittest.TestCase):
rules = serve.parse_headers(os.path.join(OUT, "_headers"))
csp = next(v for pat, hs in rules if pat.match("/") for k, v in hs if k.lower() == "content-security-policy")
script_src = re.search(r"script-src ([^;]*)", csp).group(1).split()
self.assertEqual(script_src, ["'self'"])
# Besides 'self': the Google tag's loader and the hash of its one inline script.
self.assertEqual(script_src[:2], ["'self'", "https://www.googletagmanager.com"])
self.assertEqual(len(script_src), 3)
self.assertTrue(script_src[2].startswith("'sha256-"), script_src)
self.assertNotIn("unsafe-inline", csp.replace("style-src-attr 'unsafe-inline'", ""))
for path, doc in self.pages.items():
self.assertNotRegex(doc, r'<script type="application/ld\+json"[^>]*\ssrc=', path)