Repository navigation
Conversation
A cookieless OIDC bearer request to /remote.php/dav was treated as an apache session, so loginWithApache() wrote an oc_authtoken row and a login_token preference on every request. DAV bearer requests now skip that path and are authenticated by a Sabre backend registered on SabrePluginAuthInitEvent. Restoring a file from the trash still sees the uid, published for the current request only. It is not written to the PHP session, and getCurrentUserId() does not call setUser(). See nextcloud#1376, nextcloud#1452 and nextcloud#1486. OCS and /remote.php/webdav are unchanged. Refs nextcloud#1584 Signed-off-by: xima lin <lin@rackunit.ru>
OC::initSession() starts a PHP session and session_write_close() leaves the record behind, so a cookieless DAV bearer request still created one session per call after the authtoken row was stopped. When the request did not send the session cookie, shutdown removes the record of this request only. The files handler is unlinked. Redis and memcached records are deleted through their storage backends, including unix sockets. A user-land SessionHandlerInterface is cleared with session_destroy() after session.use_cookies is turned off while headers are still unsent, only for that handler. Built-in handlers are not reconfigured. A cookie that arrived with the request is left alone, including a browser login. Set-Cookie is not stripped. Follow-up to nextcloud#1634. Refs nextcloud#1584 Signed-off-by: xima lin <lin@rackunit.ru>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #1634, which is included here as the first commit. Only the second commit belongs to this PR.
After #1634 a cookieless DAV bearer request no longer creates an
oc_authtokenrow, butOC::initSession()still starts a PHP session andsession_write_close()leaves its record behind: one session per request.When the request did not send the session cookie, shutdown now removes the record of this request only. A cookie that came with the request is left alone, so a browser login is not affected.
Observed on Nextcloud 35.0.2 with 200 cookieless PROPFIND requests (concurrency 20):
Also checked: a user-land
SessionHandlerInterface,session.use_strict_modeon and off, a mixed browser login and cookieless load (200 and 412), aborted connections.Not tested: redis cluster and sentinel, packet-level TCP RST, abort and RST on php-fpm, memcached with strict mode and a browser session.