Repository navigation
fix: restrict federated address book sync to the trusted server - #41869
Merged
Merged
Conversation
The federated system address book sync acted on the resource references a trusted server reported without checking that they belong to that server, and followed redirects that led away from it. Screening the reported reference alone is not sufficient, because it is not the only thing that decides which url is finally requested: Sabre's http client resolves a Location header and re-issues the request itself. Every url the client is about to hand to curl passes through createCurlSettingsArray() though, redirect hops and async requests included, so the rule lives there - TrustedServerClient refuses to send a request which is not on the trusted server it was built for. Reported references are still screened in the sync loop as well, so the ordinary case skips a single card instead of failing the whole sync. Two further constraints on a reported reference. It is rejected if it carries control characters, which have no place in one and would otherwise reach curl and be stored as the card uri we serve back to our own clients. And a reference naming no card - empty, '.' or '..', all of which survive the origin check because resolve() normalises them away - is skipped, because storing it would leave a row our own clients resolve to the collection itself, never to be addressed or deleted again. A well behaved peer is unaffected: it reports paths on its own host and does not redirect away from it. A trusted server stored as plain http may still redirect to its own https site, which is the one scheme change worth following - same host, better transport - and a base url whose own origin cannot be read is refused rather than matching everything. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Signed-off-by: Thomas Müller <[email protected]>
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Signed-off-by: Thomas Müller <[email protected]>
oc-tmueller
marked this pull request as ready for review
September 25, 2026 08:33
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Signed-off-by: Thomas Müller <[email protected]>
jvillafanez
approved these changes
Sep 25, 2026
jvillafanez
left a comment
Member
There was a problem hiding this comment.
Just a minor thing, but it looks good.
Comment on lines
+108
to
+122
| if (($base['scheme'] ?? '') === '' || ($base['host'] ?? '') === '') { | ||
| return false; | ||
| } | ||
|
|
||
| // host is case insensitive, see RFC 3986 | ||
| if (\strcasecmp($base['host'], (string)$target['host']) !== 0) { | ||
| return false; | ||
| } | ||
|
|
||
| // so is scheme | ||
| $baseScheme = \strtolower($base['scheme']); | ||
| $targetScheme = \strtolower((string)$target['scheme']); | ||
| if ($baseScheme === $targetScheme) { | ||
| return self::getPort($base) === self::getPort($target); | ||
| } |
Member
There was a problem hiding this comment.
I'd rather use the same comparison in all the cases.
$baseScheme = \strtolower($base['scheme']);
$baseHost = \strotolower($base['host']);
$targetScheme = \strtolower($target['scheme']);
...
if ($baseScheme === '' || $baseHost === '') {
return false;
}
if ($baseHost !== $targetHost) {
return false;
}
....
oc-tmueller
added a commit
that referenced
this pull request
Sep 25, 2026
Bump version.php to 11.0.1 and materialize the changelog fragments for the first patch release of the 11.0 line. $OC_Version becomes [11, 0, 1, 0]: the 4th digit is the internal DB-upgrade patch level, not the public patch number, and nothing in this release needs it moved. The 15 fragments in changelog/unreleased/ move into changelog/11.0.1_2026-09-25/ (git mv, so the renames stay tracked) and CHANGELOG.md is regenerated with calens. unreleased/ keeps its .gitkeep and is now empty, ready for the next cycle. Security: - #41827 reject SVG/script content before it reaches ImageMagick bitmap previews - #41834 pin the Imagick coder for each preview provider - #41856 prevent path traversal via appconfig public_/remote_ keys Bugfixes: - #41676 reduce priority of checkPropFind event - #41779 do not echo secrets when setting config values via occ - #41782 restore index usage for filecache writes on Oracle - #41807 show federated users in the share dialog when local users also match - #41808 avoid a deprecation notice when hashing the file cache path on Oracle - #41824 ship only the app payload in the release tarballs - #41835 release the file handle when a bitmap preview cannot be decoded - #41855 show a media type icon when a preview file cannot be opened - #41869 restrict federated address book sync to the trusted server Changes: - #41775 update PHP dependencies - #41785 require rhukster/dom-sanitizer as a tagged release - #41808 restore Oracle database support in the command line installer The #41824 fragment is carried over from #41825, which prepared this release on a release/v11.0.1 branch that the org maintenance ruleset freezes after its first push; that branch cannot take the changelog commit, so this supersedes it. Once merged, v11.0.1 gets tagged on the merged commit and the release bundles are built and published from owncloud/server-release. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Signed-off-by: Thomas Müller <[email protected]>
This was referenced Sep 25, 2026
Merged
Member
|
Approved from security. |
oc-tmueller
added a commit
that referenced
this pull request
Sep 25, 2026
* feat: release 11.0.1 Bump version.php to 11.0.1 and materialize the changelog fragments for the first patch release of the 11.0 line. $OC_Version becomes [11, 0, 1, 0]: the 4th digit is the internal DB-upgrade patch level, not the public patch number, and nothing in this release needs it moved. The 15 fragments in changelog/unreleased/ move into changelog/11.0.1_2026-09-25/ (git mv, so the renames stay tracked) and CHANGELOG.md is regenerated with calens. unreleased/ keeps its .gitkeep and is now empty, ready for the next cycle. Security: - #41827 reject SVG/script content before it reaches ImageMagick bitmap previews - #41834 pin the Imagick coder for each preview provider - #41856 prevent path traversal via appconfig public_/remote_ keys Bugfixes: - #41676 reduce priority of checkPropFind event - #41779 do not echo secrets when setting config values via occ - #41782 restore index usage for filecache writes on Oracle - #41807 show federated users in the share dialog when local users also match - #41808 avoid a deprecation notice when hashing the file cache path on Oracle - #41824 ship only the app payload in the release tarballs - #41835 release the file handle when a bitmap preview cannot be decoded - #41855 show a media type icon when a preview file cannot be opened - #41869 restrict federated address book sync to the trusted server Changes: - #41775 update PHP dependencies - #41785 require rhukster/dom-sanitizer as a tagged release - #41808 restore Oracle database support in the command line installer The #41824 fragment is carried over from #41825, which prepared this release on a release/v11.0.1 branch that the org maintenance ruleset freezes after its first push; that branch cannot take the changelog commit, so this supersedes it. Once merged, v11.0.1 gets tagged on the merged commit and the release bundles are built and published from owncloud/server-release. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Signed-off-by: Thomas Müller <[email protected]> * fix: name every updated PHP dependency in the 11.0.1 changelog composer/semver (3.4.4 to 3.5.0) and nikic/php-parser (v5.8.0 to v5.9.0) both moved since v11.0.0, both are direct entries in composer.json's require, and neither was named in the fragment. Diffing composer.lock at v11.0.0 against this branch gives 26 changed production packages; the fragment listed 24. Each was missed by the pass that bumped it: #41864 edited this fragment in the same commit that raised composer/semver, and #41829 did the same for nikic/php-parser. The list is not direct-only either — it already names transitive dependencies such as guzzlehttp/psr7 and symfony/mime — so both are omissions, not a scoping decision. An administrator reconciling the 11.0.1 notes against advisory ranges would read both as unchanged. The four remaining differences are require-dev only (myclabs/deep-copy, phpunit/phpunit, sebastian/exporter, sebastian/recursion-context) and stay out, matching the fragment's existing production-only scope; the tarball installs --no-dev. Also restores CHANGELOG.md's trailing newline. `ocrelease changelog` writes calens' stdout as captured by execa, which strips it; the last six "chore: update changelog" revisions of the file all end in one, and so does calens' own output, so the next regeneration would have put it back as a one-line no-op diff. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Signed-off-by: Thomas Müller <[email protected]> --------- Signed-off-by: Thomas Müller <[email protected]> Co-authored-by: Thomas Müller <[email protected]> Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
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.
What
The federated system address book sync acted on the resource references a trusted server reported without checking that they belong to that server, and followed redirects that led away from it. Both are now refused.
TrustedServerClientis aSabre\DAV\Clientthat only ever talks to the one trusted server it was constructed for.SyncServiceuses it for bothrequestSyncReport()anddownload().Where the check lives, and why there
Screening the reported reference on its own is not sufficient, because it is not the only thing that decides which url is finally requested:
Sabre\HTTP\Clientresolves aLocationheader and re-issues the request itself.createCurlSettingsArray()is the one method every url passes through before it reaches curl. It is called fromdoRequest()— whichsend()'s redirect loop re-enters once per hop — and fromsendAsyncInternal(), which bypassesdoRequest()entirely. Putting the rule there covers all of them at once, which is worth keeping in mind: the// TODO: use multi-get for downloaddirectly above the sync loop invites exactly the change that would otherwise slip past adoRequest()-only guard.It throws
\RuntimeExceptiondeliberately, and not aSabre\HTTP\ClientException—send()catches those and hands them to exception handlers that are allowed to retry.Reported references are still screened in the sync loop as well, so the ordinary case skips a single card and logs it instead of failing that server's whole sync.
Origin comparison
Sabre\Uri\resolve()first, so this check and the request that follows it cannot disagree about the target;:443is not mistaken for a different origin;httpredirecting to its ownhttpssite on the default ports. Without it, peers registered ashttp://that 301 to https would stop syncing permanently.Two further constraints on a reported reference:
basename()would store as the card uri we serve back to our own clients.'',.,..— all of which survive the origin check, becauseresolve()normalises them away). Storing one leaves a row our own clients resolve to the collection itself, never to be addressed or deleted again.Compatibility
A well behaved peer is unaffected: an ownCloud peer reports paths on its own host and does not redirect away from it. Subfolder installs are covered, since they report paths from the server root.
A skipped resource is skipped for good — the sync token still advances, and
sync-collectiononly reports a resource once per token. That is the right outcome for a resource that does not belong to the server reporting it; for a false positive it shows up as awarningin the log.Tests
apps/dav/tests/unit/CardDAV/— 160 tests / 403 assertions green on PHP 8.3.apps/federation/tests/— 101 tests / 279 assertions green.download()is never called, since that is the method which issues the request; each one fails on that line if the corresponding guard is removed.php-cs-fixerclean.🤖 Generated with Claude Code