Skip to content

fix: check the required roles before reading the request - #75

Merged
moutonjeremy merged 1 commit into
mainfrom
fix/roles-before-input
Nov 22, 2026
Merged

moutonjeremy merged 1 commit into
mainfrom
fix/roles-before-input

Conversation

@moutonjeremy

Copy link
Copy Markdown
Member

The roles of a route do not depend on its input, but they were checked after the body was decoded and validated: an authenticated caller without the role got a 400 or 422 instead of a 403, and could learn the validation rules of the route. authenticateHandler now checks RequiredRoles right after authentication, before the route middlewares and the input; only the resource permissions, which need the input, are left after it. Without an AuthService, the misconfiguration is still reported as before.

The roles of a route do not depend on its input, but they were checked after
the body was decoded and validated: an authenticated caller without the role
got a 400 or 422 instead of a 403, and could learn the validation rules of the
route. authenticateHandler now checks RequiredRoles right after
authentication, before the route middlewares and the input; only the resource
permissions, which need the input, are left after it. Without an AuthService,
the misconfiguration is still reported as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@moutonjeremy
moutonjeremy merged commit f0a9fe2 into main Nov 22, 2026
4 checks passed
@moutonjeremy
moutonjeremy deleted the fix/roles-before-input branch November 22, 2026 08:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant