-
Notifications
You must be signed in to change notification settings - Fork 20
fix(user): confine the home folder naming rule to the data directory #849
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
Merged
DeepDiver1975
merged 3 commits into
master
from
fix/oc10-133-confine-home-folder-naming-rule
Jul 28, 2026
+441
−7
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
Oops, something went wrong.
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.
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.
Although the
$pathwon't be empty in this case, it seems better to either ensure it won't happen here, or document that is the caller's responsibility to ensure that the$pathisn't empty.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 instinct — following it up turned out to find a real bug, not just a missing doc line.
You're right that
$path(the home) can't be empty here: it is guarded absolute beforenormalizePath()is reached. But the other argument was not.getHome()skipped an empty base dir like this:The guard ran before normalization — and
.,./and./.normalize to the empty string, so they slipped past it.isContainedIn()then computed:which is true for every absolute path. A single stray
'.'inuser_ldap.home_base_dirssilently disabled the containment check completely.It's also worth noting that an empty value is asymmetric — which is exactly why your comment was worth chasing:
Harmless in the first argument, disabling in the second.
Fixed in 1f7034b by requiring the base dir to be an absolute path before normalizing it. One condition covers
'','.','./','./.','..'and non-strings, and it additionally rules out a relative entry such as'data'—realpath()would have resolved that against the working directory of whichever process ran the check, so the answer would differ between the web server andocc.Then both halves of what you asked for:
isContainedIn()now returnsfalsefor an empty$baseDirin its own right, so the predicate can't fail open even if a future caller forgets to guard.normalizePath()docblocks now state that passing an absolute path is the caller's job, and why.Verified with a negative control — reverting only the guard reproduces exactly the three
'.'-shaped failures and nothing else; restoring it turns them green.owncloud/core#41752had the identical defect inSyncService::verifyHomeLocation()and is fixed the same way.New tests:
testGetHomeIsRefusedForUnusableBaseDir(8 cases).