#!/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 ']*>[[:space:]]*[^[:space:]<]' \ | grep -viE ']*[[:space:]]src[[:space:]]*=' \ | grep -viE ']*type[[:space:]]*=[[:space:]]*["'\'']?(application/(ld\+)?json|importmap|speculationrules)' \ || true }