package web import ( "embed" "io/fs" "regexp" "strings" "testing" ) // #139 regression guards: with CSP script-src/style-src 'self' (no // 'unsafe-inline'), the templates must not carry inline `) srcOnly := regexp.MustCompile(`]+src=`) for _, e := range entries { b, err := fs.ReadFile(tmplFS, "templates/"+e.Name()) if err != nil { t.Fatal(err) } for _, m := range re.FindAll(b, -1) { if srcOnly.Match(m) { continue // external script tag with src: fine } t.Errorf("%s: inline