fix(api-keys): enforce scope from request context after attach
Use c.Request.Context() in authenticateAPIKeyRequest so scoped keys are actually restricted, update dto tests for removed tenant.api_key, and add a regression test for the attach-context contract.
This commit is contained in:
@@ -260,7 +260,7 @@ func authenticateAPIKeyRequest(
|
||||
if c.IsAborted() {
|
||||
return false
|
||||
}
|
||||
if err := authorizeTenantAPIKeyAccess(ctx, c.Request.Method, c.Request.URL.Path); err != nil {
|
||||
if err := authorizeTenantAPIKeyAccess(c.Request.Context(), c.Request.Method, 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