package waf // The heuristic tag_deny. It reads SWW_WAF_TAG_DENY. import ( "context" "slices" "time" "sneak.berlin/go/smallwebwaf/internal/requestlog" ) // tagDeny refuses a request that carries a tag in SWW_WAF_TAG_DENY. Its figure is // the first such tag, in sorted order. type tagDeny struct { tags []string // SWW_WAF_TAG_DENY } func (tagDeny) name() string { return "tag_deny" } func (t tagDeny) check( _ context.Context, rq *request, _ time.Time, ) *verdict { for _, tag := range rq.tags { if slices.Contains(t.tags, tag) { return &verdict{ action: requestlog.ActionClientDenied, figures: map[string]any{"tag": tag}, } } } return nil }