-
Notifications
You must be signed in to change notification settings - Fork 2.1k
fix: use empty() to check if header exists #40856
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
Conversation
|
Thanks for opening this pull request! The maintainers of this repository would appreciate it if you would create a changelog item based on your changes. |
504f03f to
42f8f2f
Compare
|
💥 Acceptance tests pipeline apiAuthOcs-maria10.2-php7.4 failed. The build has been cancelled. |
42f8f2f to
575eb49
Compare
Tests are failing because the request token is missing in this scenario.
As per our implemenation guidelines in the past we never require CSRF on GET - why it is done in this case is to be analysed .... |
|
refs 3b4027f |
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.
I assume the new NoCSRFRequired tags are needed, but I'm not sure... any quick confirmation?. The rest looks good.
| Util::callRegister(); | ||
| if (!$this->reflector->hasAnnotation('NoCSRFRequired')) { | ||
| if (!$this->request->passesCSRFCheck() && $this->request->getHeader("Authorization") === null) { | ||
| $hasNoAuthHeader = empty($this->request->getHeader("Authorization")); |
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.
Authorization: 0 would through the exception. I guess this is ok since it's weird for "0" to be a valid value for the authorization header.
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.
good catch - I always forget about these php weirdness ...
.... but yes - I'd consider 0 to be an invalid value ;-)
CSRF annotations on any GET request are non-sense. CSRF is to protect again manipulations (PUT, POST, PATCH, DELETE) (at least this is the way we did this since the beginning of time in ownCloud ....) |
|
@jnweiger can you do the client tests for this please? THX |
4c0866b to
03075d9
Compare
|
https://drone.owncloud.com/owncloud/core/38729/8/7 A unit test fails. |
03075d9 to
4c53f25
Compare
|
Kudos, SonarCloud Quality Gate passed! |
fix: use empty() to check if header exists
fix: use empty() to check if header exists
Description
Related Issue
Motivation and Context
How Has This Been Tested?
Screenshots (if appropriate):
Types of changes
Checklist: