diff --git a/scripts/lib-inline-script.sh b/scripts/lib-inline-script.sh new file mode 100644 index 0000000..68f84f5 --- /dev/null +++ b/scripts/lib-inline-script.sh @@ -0,0 +1,15 @@ +#!/usr/bin/env bash +# Finds inline scripts in an HTML page (read from stdin): the ones a Content-Security-Policy with script-src 'self' blocks. +# +# An inline script is a , and data blocks that are not executed (type="application/json", "application/ld+json", +# "importmap" and the like). Prints the opening tag of every inline script found; no output means none. +# Plain POSIX tools only (no grep -P), so it behaves the same on every runner. +inline_scripts() { + tr '\r\n' ' ' \ + | grep -oiE ' + + + +