test(api-keys): add tests for tenant API key management path rejection
Introduce tests to validate that tenant API keys are correctly restricted from accessing management paths. Implemented new test cases for both allowed and forbidden paths, ensuring proper enforcement of API key scopes. Additionally, refactored existing tests to utilize the new rejection logic.
This commit is contained in:
@@ -260,7 +260,7 @@ func authenticateAPIKeyRequest(
|
||||
if c.IsAborted() {
|
||||
return false
|
||||
}
|
||||
if err := authorizeTenantAPIKeyAccess(c.Request.Context(), c.Request.Method, c.Request.URL.Path); err != nil {
|
||||
if err := rejectTenantAPIKeyManagementPath(c.Request.Context(), c.Request.URL.Path); err != nil {
|
||||
c.JSON(http.StatusForbidden, gin.H{"error": "Forbidden: API key scope does not allow this operation"})
|
||||
c.Abort()
|
||||
return false
|
||||
|
||||
Reference in New Issue
Block a user