Import Anubis v1.28.2
Replace the tree with upstream TecharoHQ/anubis v1.28.2 (a1384fbf42e3). Masyunis customizations are re-applied in the following commits.
This commit is contained in:
1 parent
eb3e46d8d0
commit
e07de898cd
573 files changed
+35846
-6807
No files matched your search
+11
-1
@@ -59,7 +59,7 @@ func TestBasePrefixInLinks(t *testing.T) {
|
||||
|
||||
// Render the base template to a buffer
|
||||
var buf strings.Builder
|
||||
component := base(tt.name, templ.NopComponent, impressum, nil, nil, localizer)
|
||||
component := base(tt.name, templ.NopComponent, impressum, &config.Honeypot{Enabled: true, Implementation: "naive"}, nil, nil, localizer)
|
||||
err := component.Render(context.Background(), &buf)
|
||||
if err != nil {
|
||||
t.Fatalf("failed to render template: %v", err)
|
||||
@@ -79,3 +79,13 @@ func TestBasePrefixInLinks(t *testing.T) {
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestHoneypotLinkEscapesHref(t *testing.T) {
|
||||
var out strings.Builder
|
||||
if err := honeypotLink(`/path" onclick="bad"><script>bad</script>`).Render(t.Context(), &out); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if strings.Contains(out.String(), `href="/path" onclick=`) || strings.Contains(out.String(), "<script>bad") {
|
||||
t.Fatalf("unsafe output: %s", out.String())
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user