-
Notifications
You must be signed in to change notification settings - Fork 13.8k
fix(api)!: return 403 for authorization failures, reserve 401 for missing session #41658
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| --- | ||
| "@rocket.chat/meteor": patch | ||
| "@rocket.chat/http-router": patch | ||
| --- | ||
|
|
||
| fix(api)!: return 403 for authorization failures, reserve 401 for missing session |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -245,7 +245,7 @@ export class Router< | |
| return c.json( | ||
| { | ||
| success: false, | ||
| errorType: 'invalid-params', | ||
| errorType: 'error-invalid-params', | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
When Useful? React with 👍 / 👎. |
||
| error: validatorFn.errors?.map((error: any) => error.message).join('\n '), | ||
| }, | ||
| 400, | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For
rooms.membersOrderedByRole, the response spec above this action still only registers 200/400/401/404. When this broadcast-room permission branch is hit underTEST_MODE, the typed router looks up a validator for status 403 and throwsMissing response validator...instead of returning the intended forbidden response; it also leaves the generated route metadata without the new 403. Add403: validateForbiddenErrorResponseto this endpoint's response map along with the behavior change.Useful? React with 👍 / 👎.