X Tutup
Skip to content

[full-ci] Revert loader logic in ChunkLocationProvider.php#40700

Closed
pako81 wants to merge 28 commits intomasterfrom
loader_chunklocationprovider
Closed

[full-ci] Revert loader logic in ChunkLocationProvider.php#40700
pako81 wants to merge 28 commits intomasterfrom
loader_chunklocationprovider

Conversation

@pako81
Copy link

@pako81 pako81 commented Mar 24, 2023

Description

Revert loader logic in ChunkLocationProvider.php

Related Issue

Motivation and Context

File Firewall acceptance tests were failing after merging #40693 as we changed the position of the loader in the constructor. Not sure why this is happening but reverting the change seems to make the tests to pass.

How Has This Been Tested?

Ran File Firewall acceptance tests locally and make sure that following scenarios pass (they were previously failing):

webUILimitUpload/limituploadbasedonsize.feature:29
webUILimitUpload/limituploadbasedonsize.feature:37
webUILimitFileAccess/limitfileaccessbasedonrequesttype.feature:13

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
  • Acceptance tests added
  • Documentation ticket raised
  • Changelog item

@pako81 pako81 added this to the development milestone Mar 24, 2023
@pako81 pako81 self-assigned this Mar 24, 2023
@update-docs
Copy link

update-docs bot commented Mar 24, 2023

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.

@ownclouders
Copy link
Contributor

ownclouders commented Mar 24, 2023

💥 Acceptance tests pipeline webUISharingExt2-git-chrome-mariadb10.2-php7.4 failed. The build has been cancelled.

https://drone.owncloud.com/owncloud/core/38132/155

@ownclouders
Copy link
Contributor

💥 Acceptance tests pipeline webUIRestrictSharing-chrome-mariadb10.2-php7.4 failed. The build has been cancelled.

https://drone.owncloud.com/owncloud/core/38130/132

@jvillafanez
Copy link
Member

I think we'll have to investigate what's happening there. Accordingly to the constructor in https://github.com/owncloud/core/blob/master/lib/private/Files/Mount/MountPoint.php#L79 , if the loader is null, we use an "empty" storage factory instead of whatever storage factory is prepared. In particular, some wrappers could be set in place in the factory we want to inject, but they won't be present in the newly created one (if the loader is null).

If that's the case, we should remove the loader parameter in this PR because it's unused.

We probably should also investigate why the code is dependent on a specific loader; the wrappers around the storages shouldn't matter I think.

@phil-davis
Copy link
Contributor

Yes, changing this code here does help the firewall tests to all pass. But actually the change here is removing the passing of "loader" to the MountPoint constructor. It gets passed as an entry in the $arguments parameter and gets ignored. So if this is the "fix" then we should completely remove $loader from being passed at all.

As @jvillafanez says, this needs investigation to understand what the code used to do, and what it should do. (And to try and provide a solution that is reasonably upward-compatible for apps like firewall - so that we don't have to require specific versions of firewall to go with specific releases of core)

phil-davis and others added 12 commits March 27, 2023 17:20
Bumps [phpunit/phpunit](https://github.com/sebastianbergmann/phpunit) from 9.6.5 to 9.6.6.
- [Release notes](https://github.com/sebastianbergmann/phpunit/releases)
- [Changelog](https://github.com/sebastianbergmann/phpunit/blob/main/ChangeLog-9.6.md)
- [Commits](sebastianbergmann/phpunit@9.6.5...9.6.6)

---
updated-dependencies:
- dependency-name: phpunit/phpunit
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
…hpunit-9.6.6

Bump phpunit/phpunit from 9.6.5 to 9.6.6
…#40702)

* occ encryption:encrypt-all should not auto-enable user-key encryption

* add changelog and tests

* Update changelog/unreleased/40702

Co-authored-by: Phil Davis <phil@jankaritech.com>

---------

Co-authored-by: Phil Davis <phil@jankaritech.com>
* Add rewrite base to generated .htaccess rules

If htaccess.RewriteBase is set we need to prepend it to the generated rules.

* Fix potential double slash and empty rewriteBase if rewriteBase is "/"

* use preg_quote() for proper regex escaping.

* Update lib/private/Setup.php


---------

Co-authored-by: Juergen Weigert <jnweiger@gmail.com>
* prevent 507 Insufficient Storage on 32bit systems

* add changelog

* improve if-else logic

* retrigger CI
* fix permission bits when enforcing rw links

* adapt test to match the code.

* list all cases that the admin config for password enforces refers to

---------

Co-authored-by: Piotr Mrówczyński <piotr@owncloud.com>
@pako81
Copy link
Author

pako81 commented Mar 29, 2023

When running the tests locally, in both cases - with and without loader in ChunkLocationProvider.php - following is logged (which is expected):

{"reqId":"zG36QILFddhbJ6cEzTpW","level":4,"time":"2023-03-27T20:05:59+00:00","remoteAddr":"128.140.6.151","user":"admin","app":"webdav","method":"PUT","url":"\/owncloud\/remote.php\/webdav\/filespecificSize.txt-chunking-3098-3-0","message":"Exception: HTTP\/1.1 403 Access to this resource has been forbidden by a file firewall rule.: {\"Exception\":\"OCA\\\\DAV\\\\Connector\\\\Sabre\\\\Exception\\\\Forbidden\",\"Message\":\"Access to this resource has been forbidden by a file firewall rule.\",\"Code\":0,\"Trace\":\"
#0 \\\/var\\\/www\\\/html\\\/owncloud\\\/lib\\\/composer\\\/sabre\\\/dav\\\/lib\\\/DAV\\\/Server.php(1098): OCA\\\\DAV\\\\Connector\\\\Sabre\\\\Directory->createFile()\\n
#1 \\\/var\\\/www\\\/html\\\/owncloud\\\/lib\\\/composer\\\/sabre\\\/dav\\\/lib\\\/DAV\\\/CorePlugin.php(504): Sabre\\\\DAV\\\\Server->createFile()\\n
#2 \\\/var\\\/www\\\/html\\\/owncloud\\\/lib\\\/composer\\\/sabre\\\/event\\\/lib\\\/WildcardEmitterTrait.php(89): Sabre\\\\DAV\\\\CorePlugin->httpPut()\\n
#3 \\\/var\\\/www\\\/html\\\/owncloud\\\/lib\\\/composer\\\/sabre\\\/dav\\\/lib\\\/DAV\\\/Server.php(472): Sabre\\\\DAV\\\\Server->emit()\\n
#4 \\\/var\\\/www\\\/html\\\/owncloud\\\/lib\\\/composer\\\/sabre\\\/dav\\\/lib\\\/DAV\\\/Server.php(253): Sabre\\\\DAV\\\\Server->invokeMethod()\\n
#5 \\\/var\\\/www\\\/html\\\/owncloud\\\/lib\\\/composer\\\/sabre\\\/dav\\\/lib\\\/DAV\\\/Server.php(321): Sabre\\\\DAV\\\\Server->start()\\n
#6 \\\/var\\\/www\\\/html\\\/owncloud\\\/apps\\\/dav\\\/appinfo\\\/v1\\\/webdav.php(67): Sabre\\\\DAV\\\\Server->exec()\\n
#7 \\\/var\\\/www\\\/html\\\/owncloud\\\/remote.php(165): require_once('\\\/var\\\/www\\\/html\\\/o...')\\n
#8 {main}\",\"File\":\"\\\/var\\\/www\\\/html\\\/owncloud\\\/apps\\\/dav\\\/lib\\\/Connector\\\/Sabre\\\/Directory.php\",\"Line\":185}"}

In addition, with the loader in place (which makes the firewall tests to fail) this is also logged:

**{"reqId":"ikmhcKdsCxI2FXrxI1Ok","level":4,"time":"2023-03-27T20:06:00+00:00","remoteAddr":"128.140.6.151","user":"admin","app":"webdav","method":"PUT","url":"\/owncloud\/remote.php\/dav\/uploads\/admin\/chunking-7148\/0","message":"Exception: Access to this resource has been forbidden by a file firewall rule.: {\"Exception\":\"OCP\\\\Files\\\\ForbiddenException\",\"Message\":\"Access to this resource has been forbidden by a file firewall rule.\",\"Code\":0,\"Trace\":\"
#0 \\\/var\\\/www\\\/html\\\/owncloud\\\/apps\\\/firewall\\\/lib\\\/storagewrapper.php(91): OCA\\\\Firewall\\\\Firewall->checkRulesForFiles()\\n
#1 \\\/var\\\/www\\\/html\\\/owncloud\\\/apps\\\/firewall\\\/lib\\\/storagewrapper.php(356): OCA\\\\Firewall\\\\StorageWrapper->checkFirewall()\\n
#2 \\\/var\\\/www\\\/html\\\/owncloud\\\/lib\\\/private\\\/Files\\\/View.php(726): OCA\\\\Firewall\\\\StorageWrapper->fopen()\\n
#3 \\\/var\\\/www\\\/html\\\/owncloud\\\/lib\\\/public\\\/Events\\\/EventEmitterTrait.php(50): OC\\\\Files\\\\View->OC\\\\Files\\\\{closure}(*** sensitive parameters replaced ***)\\n
#4 \\\/var\\\/www\\\/html\\\/owncloud\\\/lib\\\/private\\\/Files\\\/View.php(754): OC\\\\Files\\\\View->emittingCall()\\n
#5 \\\/var\\\/www\\\/html\\\/owncloud\\\/apps\\\/dav\\\/lib\\\/Connector\\\/Sabre\\\/Directory.php(527): OC\\\\Files\\\\View->file_put_contents()\\n
#6 \\\/var\\\/www\\\/html\\\/owncloud\\\/apps\\\/dav\\\/lib\\\/Upload\\\/UploadFolder.php(37): OCA\\\\DAV\\\\Connector\\\\Sabre\\\\Directory->createFileDirectly()\\n
#7 \\\/var\\\/www\\\/html\\\/owncloud\\\/lib\\\/composer\\\/sabre\\\/dav\\\/lib\\\/DAV\\\/Server.php(1098): OCA\\\\DAV\\\\Upload\\\\UploadFolder->createFile()\\n
#8 \\\/var\\\/www\\\/html\\\/owncloud\\\/lib\\\/composer\\\/sabre\\\/dav\\\/lib\\\/DAV\\\/CorePlugin.php(504): Sabre\\\\DAV\\\\Server->createFile()\\n
#9 \\\/var\\\/www\\\/html\\\/owncloud\\\/lib\\\/composer\\\/sabre\\\/event\\\/lib\\\/WildcardEmitterTrait.php(89): Sabre\\\\DAV\\\\CorePlugin->httpPut()\\n
#10 \\\/var\\\/www\\\/html\\\/owncloud\\\/lib\\\/composer\\\/sabre\\\/dav\\\/lib\\\/DAV\\\/Server.php(472): Sabre\\\\DAV\\\\Server->emit()\\n
#11 \\\/var\\\/www\\\/html\\\/owncloud\\\/lib\\\/composer\\\/sabre\\\/dav\\\/lib\\\/DAV\\\/Server.php(253): Sabre\\\\DAV\\\\Server->invokeMethod()\\n
#12 \\\/var\\\/www\\\/html\\\/owncloud\\\/apps\\\/dav\\\/lib\\\/Server.php(348): Sabre\\\\DAV\\\\Server->start()\\n
#13 \\\/var\\\/www\\\/html\\\/owncloud\\\/apps\\\/dav\\\/appinfo\\\/v2\\\/remote.php(31): OCA\\\\DAV\\\\Server->exec()\\n
#14 \\\/var\\\/www\\\/html\\\/owncloud\\\/remote.php(165): require_once('\\\/var\\\/www\\\/html\\\/o...')\\n
#15 {main}\",\"File\":\"\\\/var\\\/www\\\/html\\\/owncloud\\\/apps\\\/firewall\\\/lib\\\/firewall.php\",\"Line\":194}"}

@jvillafanez
Copy link
Member

I don't know if those errors are ok because there is a firewall rule being correctly applied, or the errors shouldn't happen...

IljaN and others added 2 commits March 29, 2023 16:12
* changelog for #40697

* update changelog

---------

Co-authored-by: Pasquale Tripodi <ptripodi@owncloud.com>
@jnweiger jnweiger self-requested a review April 3, 2023 10:13
@jnweiger jnweiger changed the title Revert loader logic in ChunkLocationProvider.php [full-ci] Revert loader logic in ChunkLocationProvider.php Apr 3, 2023
Copy link
Contributor

@jnweiger jnweiger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let us merge this for 10.12.1
I'd like to see a full CI run. Please rebase and merge.

Please open a separate issue for further investigation of the $loader wrapper logic.

@CLAassistant
Copy link

CLAassistant commented Apr 3, 2023

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
5 out of 7 committers have signed the CLA.

✅ IljaN
✅ mrow4a
✅ phil-davis
✅ DeepDiver1975
✅ jnweiger
❌ Pasquale Tripodi
❌ ownclouders


Pasquale Tripodi seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

@sonarqubecloud
Copy link

sonarqubecloud bot commented Apr 3, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

100.0% 100.0% Coverage
0.0% 0.0% Duplication

@jnweiger
Copy link
Contributor

jnweiger commented Apr 3, 2023

My rebase attempt failed. The history here is now a mess.
Clean restart with identical code change at #40719

@jnweiger jnweiger closed this Apr 3, 2023
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.

9 participants

X Tutup