Skip to content

Conversation

@solracsf
Copy link
Member

@solracsf solracsf commented Jan 6, 2024

Checklist

@solracsf solracsf added the 3. to review Waiting for reviews label Jan 6, 2024
@solracsf solracsf added this to the Nextcloud 29 milestone Jan 6, 2024
$instanceId = $this->config->getSystemValueString('instanceid');
if (is_null($request->getCookie($instanceId))) {
return false;
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Without looking in depth, just from the following code lines I think that this could have unexpected side effects when just authenticating with an app password which is also a token but not necessarily has cookies if clients send it.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adjusted so that the token lookup by session id only happens if there is neither an Authrorization header nor session cookie

Copy link
Member

@ChristophWurst ChristophWurst left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bildschirmfoto vom 2024-01-16 19-19-41

👍 as expected

tested with 100 samples of GET /login

@ChristophWurst
Copy link
Member

/backport to stable28

@ChristophWurst
Copy link
Member

/backport to stable27

@ChristophWurst
Copy link
Member

/backport to stable26

$token = substr($authHeader, 7);
} else {
// No auth header, let's try session id
} else if ($request->getCookie($this->config->getSystemValueString('instanceid')) !== null) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
} else if ($request->getCookie($this->config->getSystemValueString('instanceid')) !== null) {
} elseif ($request->getCookie($this->config->getSystemValueString('instanceid')) !== null) {

…ous request

Co-Authored-By: Christoph Wurst <[email protected]>
Signed-off-by: Git'Fellow <[email protected]>
Signed-off-by: Christoph Wurst <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Two useless authtoken database queries for every anonymous request

4 participants