Repository navigation
Commit 79c23d8
test(api): add security tests for TenantNamespace IDOR fix
Added comprehensive unit tests for authorization logic:
- hasAccessToNamespace() tests:
- User subject access (positive and negative cases)
- Group subject access
- ServiceAccount subject access
- ServiceAccount with empty namespace (defaults to RoleBinding ns)
- Privileged groups (system:masters, cozystack-cluster-admin)
- Get() handler tests:
- Returns namespace when user has access
- Returns NotFound when user lacks access (not Forbidden)
- Returns NotFound for non-tenant namespaces
All tests verify that authorization correctly enforces RoleBinding-based
access control and prevents IDOR vulnerabilities.
Signed-off-by: IvanHunters <[email protected]>
(cherry picked from commit 5b2501d)1 parent 82fb799 commit 79c23d8
1 file changed
Lines changed: 461 additions & 0 deletions
0 commit comments