-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Enhance privacy of contactsmenu fixes #5107 #5585
Conversation
Codecov Report
@@ Coverage Diff @@
## master #5585 +/- ##
=============================================
- Coverage 53.44% 37.01% -16.43%
- Complexity 22542 22552 +10
=============================================
Files 1408 1408
Lines 87206 87233 +27
Branches 1328 1328
=============================================
- Hits 46604 32291 -14313
- Misses 40602 54942 +14340
|
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.
Some early feedback. I haven't had a closer look yet, nor did I test this. Will do ASAP.
Thanks!
* 1. filter the current user | ||
* 2. if the `shareapi_exclude_groups` config option is enabled and the | ||
* current user is in an excluded group it will filter all local users. | ||
* 3. if the ``shareapi_only_share_with_group_members config option is |
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.
Should be
`shareapi_only_share_with_group_members`
I guess
* @return array the filtered contacts | ||
*/ | ||
private function filterContacts(IUser $self, Array $entries) { | ||
$excludedGroups = $this->config->getAppValue('core', 'shareapi_exclude_groups', 'no') === 'yes' ? true : false; |
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.
? true : false
is not necessary, the ===
check will already result in a boolean value.
$excludedGroups = $this->config->getAppValue('core', 'shareapi_exclude_groups', 'no') === 'yes' ? true : false; | ||
|
||
$skipLocal = false; // whether to filter out local users | ||
$ownGroupsOnly = $this->config->getAppValue('core', 'shareapi_only_share_with_group_members', 'no') === 'yes' ? true : false; // whether to filter out all users which doesn't have the same group as the current user |
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.
same as above
f10cd5b
to
6b79567
Compare
milestone nextcloud 13?? i would definitely call this serious privacy problem a regression that has to be fixed with the next maintenance release. |
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.
Tested and works as expected. Thanks a lot 👍
I've left some comments regarding coding style.
* enabled it will filter all users which doens't have a common group | ||
* with the current user. | ||
* @param IUser $self | ||
* @param $entries Entry[] |
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.
should be @param Entry[] $entries
* @param $entries Entry[] | ||
* @return array the filtered contacts | ||
*/ | ||
private function filterContacts(IUser $self, Array $entries) { |
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.
array
instead of Array
* with the current user. | ||
* @param IUser $self | ||
* @param $entries Entry[] | ||
* @return array the filtered contacts |
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.
@return Entry[]
private function filterContacts(IUser $self, Array $entries) { | ||
$excludedGroups = $this->config->getAppValue('core', 'shareapi_exclude_groups', 'no') === 'yes'; | ||
|
||
$skipLocal = false; // whether to filter out local users |
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.
move inline comments to a new line please
} | ||
|
||
public function testGetContactsOnlyIfInTheSameGroup() { | ||
$this->config->expects($this->at(0)) ->method('getAppValue') |
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.
great to have this tested 👍
@ChristophWurst I addressed your issues, thanks for testing. @rotanid I do agree with you. |
i think this should be backported |
I just realized that the An alternative way could be to move the filtering to the What do you think? |
60b961f
to
3253e11
Compare
@ChristophWurst I fixed a bug and also updated the findOne method because that wasn't filtered already. |
@MorrisJobke @LukasReschke @blizzz @rullzer @schiessle @nickvergessen @georgehrke Excuse me for pinging you all 😄 , but can someone please review this? There are many people asking for this. Also please point out your opinion about #5585 (comment) and #5107 (comment) Thanks! |
I'll review this and additionally revert 56a9084 in here and add the handling here itself. |
- Groups, which are excluded from sharing should not see local users at all - If sharing is restricted to users own groups, he should only see contacts from his groups: Signed-off-by: Tobia De Koninck <tobia@ledfan.be>
Signed-off-by: Tobia De Koninck <tobia@ledfan.be>
Signed-off-by: Tobia De Koninck <tobia@ledfan.be>
…ption + fix findOne Signed-off-by: Tobia De Koninck <tobia@ledfan.be>
3253e11
to
5896176
Compare
Rebased upon master. |
…letion is disabled" This reverts commit 56a9084.
This adjusts the contacts menu to also support searching by email address which is relevant in scenarios where no UID is known such as LDAP, etc. Furthermore, if `shareapi_allow_share_dialog_user_enumeration` is disabled only results are shown that match the full user ID or email address. Signed-off-by: Lukas Reschke <lukas@statuscode.ch>
I added 5896176...705432c, in particular:
Note that the search is on "UID" and "EMAIL". So "FN" is not searched. |
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.
Works 👍
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.
CI complains because reverted commit was not signed, but as it is a revert commit it is not a big deal.
Tested and works; code looks good (but, please, next time do not mix code style changes and behaviour changes in the same commit!) 👍
@LukasReschke thanks for taking care of this!
Is there a reason for? E.g. on LDAP you as user would know the FN but not the UID? |
Mainly because we have a business requirement requiring this behaviour: Filtering via UID / EMAIL should be possible but for whatever reason filtering to FN shouldn't be possible. cc @oparoz Or would filtering for complete FN here also be acceptable? Your call 😉 |
Backport at #6554 |
This filter outs all contacts which shouldn't be visible according to the rules in #5107.