fix(06-12): reject typed-nil guards and fractional JWT subjects

This commit is contained in:
Jakub Zych
2026-09-21 19:43:35 +02:00
parent 4ad2ad29f2
commit 8a9449df63
4 changed files with 38 additions and 2 deletions

View File

@@ -233,3 +233,15 @@ func TestJWTGuardRegistryMatchesMiddleware(t *testing.T) {
})
}
}
func TestRegisterRejectsTypedNilGuard(t *testing.T) {
var reg Registry
var g *credPtrGuard
if err := reg.Register("p", "n", g); err == nil {
t.Fatal("typed-nil guard accepted")
}
}
type credPtrGuard struct{}
func (*credPtrGuard) Authenticate(*http.Request) (*Principal, error) { return nil, nil }