package middleware_test
import (
"io/fs"
"os"
"path/filepath"
"regexp"
"strings"
"testing"
)
// Go-source CSP tripwire.
//
// The templ scan lives in templates/csp_source_test.go, but htmx partials
// can also be emitted from Go handler strings — auth.go used to answer a
// successful login with an inline that
// hash-mode CSP silently refused. This test scans the non-test Go sources
// for the same forbidden patterns: inline script tags and native on*=
// handler attributes in emitted HTML. Partials that need to navigate or
// stash state use data attributes + web/src/auth_forms.ts, or htmx's
// HX-Redirect/HX-Refresh headers.
var goScriptTagRe = regexp.MustCompile(`