Skip to content
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

share manager should emit share.link auth events to catch all accesses #37430

Closed
wants to merge 1 commit into from

Conversation

karakayasemi
Copy link
Contributor

@karakayasemi karakayasemi commented May 21, 2020

Description

Currently, WebDAV access for the password-protected public links is not emitting any link share auth events. These events are only emitted when ShareController used.

This PR moves link share auth events emitting logic to share manager to cover all access cases.

Related Issue

How Has This Been Tested?

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Database schema changes (next release will require increase of minor version instead of patch)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Technical debt
  • Tests only (no source changes)

Checklist:

  • Code changes
  • Unit tests added
  • Changelog item

@karakayasemi karakayasemi self-assigned this May 21, 2020
@update-docs
Copy link

update-docs bot commented May 21, 2020

Thanks for opening this pull request! The maintainers of this repository would appreciate it if you would create a changelog item based on your changes.

@phil-davis
Copy link
Contributor

No codecov result had come. The branch was off a quite-old version of master.
I rebased and force-pushed just now. The codecov reporting problem was fixed recently in master, so this should get a codecov result from CI this time.

@jvillafanez
Copy link
Member

Question: how about triggering a new event? I'm concerned this PR might break things because the events are triggered in a different place, so it could happen that the event was triggered before an error happened, but this might not happen any longer.
In addition, having an error code of 403, probably referencing a http error code, doesn't make sense in the share manager. I know it's to keep compatibility, but this one problem of moving events after they're been established.

@codecov
Copy link

codecov bot commented May 22, 2020

Codecov Report

Merging #37430 into master will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff            @@
##             master   #37430   +/-   ##
=========================================
  Coverage     64.68%   64.68%           
  Complexity    19331    19331           
=========================================
  Files          1277     1277           
  Lines         75506    75522   +16     
  Branches       1331     1331           
=========================================
+ Hits          48838    48854   +16     
  Misses        26276    26276           
  Partials        392      392           
Flag Coverage Δ Complexity Δ
#javascript 54.14% <ø> (ø) 0.00 <ø> (ø)
#phpunit 65.85% <100.00%> (+<0.01%) 19331.00 <0.00> (ø)
Impacted Files Coverage Δ Complexity Δ
.../files_sharing/lib/Controllers/ShareController.php 53.52% <ø> (-1.07%) 54.00 <0.00> (ø)
lib/private/Share20/Manager.php 96.26% <100.00%> (+0.10%) 273.00 <0.00> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1d6094c...59dfc8e. Read the comment docs.

@karakayasemi
Copy link
Contributor Author

Question: how about triggering a new event? I'm concerned this PR might break things because the events are triggered in a different place, so it could happen that the event was triggered before an error happened, but this might not happen any longer.

@jvillafanez before and after share link auth events was already newly added with this pr #34158, for the purpose of using it in brute force protection app. So, by assuming there is no other usage of it in the organization-wide (not even brute force protection app yet), I can say there is no need to afraid to move them to a different class.

In addition, having an error code of 403, probably referencing a http error code, doesn't make sense in the share manager. I know it's to keep compatibility, but this one problem of moving events after they're been established.

I assume this event is intended to emit on every access attempt of a share. However, currently, WebDAV accesses miss these events. I identify this situation as a bug. I agree with you on about the error code issue but could not find a better solution. I kept the event format the same for compatibility reasons as you said.

Since ShareController also using the Share Manager, the previously emitted events will still be emitted as identical with before in this PR's solution, so, I expect It should not break any current usage. In addition, it will fix the bug by emitting event signals in DAV accesses also.

Another solution would be adding the same events to dav app, but I think, unifying emitting logic in the share manager is a better solution.

@jvillafanez
Copy link
Member

I still think it's a better idea to deprecate the old events (leaving them for a while) and add new events to fix this, then the app can switch to the new events once they're in place. This way we can adjust the event name to be more intuitive (using this the "checkPassword" function doesn't mean that a link is being accessed, but a link, in this particular case, has its password checked), and adjust what the event is sending to be more meaningful.

@karakayasemi
Copy link
Contributor Author

I will open a new pr without touching existing events. Closing this for now.

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.

3 participants