fix(security): synchronize report lifecycle and current roles

Revalidate admin roles from the database and serialize report generation registration with owner-scoped deletion.

Refs #9

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-11-20 21:35:38 +01:00
parent 0ebc531124
commit 609dbff7c1
16 changed files with 668 additions and 35 deletions

View File

@ -16,10 +16,10 @@ import (
func TestArticleLimitEndpointsValidateBoundsAndRequireAdmin(t *testing.T) {
gin.SetMode(gin.TestMode)
secret := "article-limit-test-secret"
router := api.SetupRouter(handlers.New(nil, &config.Config{JWTSecret: secret}, nil, nil, nil, nil), secret)
router := api.SetupRouter(handlers.New(currentRoleRepository(), &config.Config{JWTSecret: secret}, nil, nil, nil, nil), secret)
token := func(role string) string {
t.Helper()
value, err := auth.GenerateToken("user-1", "user@example.test", role, secret)
value, err := auth.GenerateToken(role+"-id", "user@example.test", role, secret)
if err != nil {
t.Fatal(err)
}