chore: add copyright headers, CI tests, and sanitize gitignore

This commit is contained in:
DmitrL-dev 2026-03-31 22:13:34 +10:00
parent 5cbb3d89d3
commit d1f844235e
325 changed files with 2267 additions and 902 deletions

View file

@ -1,3 +1,7 @@
// Copyright 2026 Syntrex Lab. All rights reserved.
// Use of this source code is governed by an Apache-2.0 license
// that can be found in the LICENSE file.
package httpserver
import (
@ -38,9 +42,9 @@ type RBACConfig struct {
// RBACMiddleware provides role-based access control for HTTP endpoints (§17).
type RBACMiddleware struct {
mu sync.RWMutex
config RBACConfig
keys map[string]*APIKey // raw key → APIKey
mu sync.RWMutex
config RBACConfig
keys map[string]*APIKey // raw key → APIKey
}
// NewRBACMiddleware creates RBAC middleware. If not enabled, all requests pass through.
@ -123,7 +127,6 @@ func (m *RBACMiddleware) Require(minRole Role, next http.HandlerFunc) http.Handl
return
}
// Check role hierarchy
if !hasPermission(apiKey.Role, minRole) {
writeError(w, http.StatusForbidden, "insufficient permissions: requires "+string(minRole))