-
+
-
-
+
+
diff --git a/internal/web/security_test.go b/internal/web/security_test.go
index 4db91b5..d77ad12 100644
--- a/internal/web/security_test.go
+++ b/internal/web/security_test.go
@@ -104,6 +104,37 @@ func TestTemplatesHaveNoInlineJS(t *testing.T) {
}
}
+// TestTemplatesUseAssetHelper enforces that every static reference goes through
+// the {{ asset }} helper (href="{{ asset "/static/x" }}"), never a bare
+// href="/static/x". The helper rewrites the URL to a content-hashed,
+// immutably-cached path; a bare reference silently loses that caching.
+func TestTemplatesUseAssetHelper(t *testing.T) {
+ t.Parallel()
+ root := moduleRoot(t)
+ bare := regexp.MustCompile(`(?i)(href|src)="/static/`)
+
+ err := filepath.WalkDir(filepath.Join(root, "internal"), func(path string, d os.DirEntry, err error) error {
+ if err != nil {
+ return err
+ }
+ if d.IsDir() || !strings.HasSuffix(path, ".html") {
+ return nil
+ }
+ b, err := os.ReadFile(path)
+ if err != nil {
+ return err
+ }
+ rel, _ := filepath.Rel(root, path)
+ if loc := bare.FindIndex(b); loc != nil {
+ t.Errorf("%s: bare static reference — use {{ asset \"/static/...\" }}: %q", rel, snippet(b, loc[0]))
+ }
+ return nil
+ })
+ if err != nil {
+ t.Fatalf("walk templates: %v", err)
+ }
+}
+
func snippet(b []byte, at int) string {
end := at + 40
if end > len(b) {
diff --git a/internal/web/templates/base.html b/internal/web/templates/base.html
index f5e0cbb..3515719 100644
--- a/internal/web/templates/base.html
+++ b/internal/web/templates/base.html
@@ -3,14 +3,14 @@
-
+
{{block "title" .}}MeshTender{{end}}
-
-
-
-
-
-
+
+
+
+
+
+
Skip to main content
@@ -164,14 +164,14 @@
-
+
{{template "title" .}}
-
-
-
-
-
-
+
+
+
+
+
+
Skip to main content
@@ -210,12 +210,12 @@
-
+
{{template "title" .}}
-
-
-
-
+
+
+
+
@@ -239,12 +239,12 @@
-
+
{{template "title" .}}
-
-
-
-
+
+
+
+
{{template "rootnav" .}}
diff --git a/internal/web/templates/org_config.html b/internal/web/templates/org_config.html
index e3fae0f..26c1901 100644
--- a/internal/web/templates/org_config.html
+++ b/internal/web/templates/org_config.html
@@ -55,10 +55,10 @@
-
+
-
-
+
+
-
-
+
+
+
-
-
+
+
+