Repository navigation
Refactor OC_Request into TrustedDomainHelper and IRequest - #14056
Conversation
There was a problem hiding this comment.
This is a behavioural change already announced for 8.0 but let's finally introduce this with 8.1 – won't break sane setups, in other cases a simple error will be shown to the admin.
There was a problem hiding this comment.
Did it default to "localhost" before ? Or is it something else ?
There was a problem hiding this comment.
Previously you could disable the trusted domain check by just not adding any domain to the config. Though on every update ownCloud will add the used domain anyways.
I saw this abused a lot of time in the forum by users for some other purposes that it was never meant to. To prevent admins from doing this mistake this will though not be possible anylonger.
|
No worries: Most changes are in test files and others are pretty simple changes like "replacing the old call with the new one". |
There was a problem hiding this comment.
I'm not really sure if we want to have hasModificationTime on the IRequest. It only seems to be used for SabreDAV – opinions?
There was a problem hiding this comment.
a simple key based access should be fine as well
93a3c23 to
1ea7c54
Compare
|
Did I already mention that I love our encryption "unit tests"? – Honestly stuff like https://github.com/owncloud/core/blob/dfbc405a45f42acd1202d5f0649619388adbfb83/apps/files_encryption/tests/webdav.php#L101-101 makes it IMPOSSIBLE to do ANY adjustments ANYWHERE without breaking some stuff………… Again and again: SETTING UP A WHOLE WEBDAV SERVER IN A UNIT TEST IS NOT A UNIT TEST… |
51b696e to
45294d6
Compare
|
This is ready to review now… Be aware that this includes some horrible hacks in the server container because our unit tests are setting Thus now the request class gets initialized all the time new it is requested :-/ |
There was a problem hiding this comment.
Should we make a method getServerVar() ? Would make it mockable.
(or maybe something for later)
|
To test:
|
There was a problem hiding this comment.
If we had "getServerVar()" this might be mockable 😄
There was a problem hiding this comment.
Well it is mockable? ;-)
There was a problem hiding this comment.
$request = new Request(['server' => ['foo' = >'bar']],…)
|
Refer to this link for build results (access rights to CI server needed): |
|
Tested, works 👍 |
There was a problem hiding this comment.
Can't we inject the config object which is created above?
There was a problem hiding this comment.
Nope. Above thing is not associated in any way with an IConfig sigh
|
👍 apart from the 👔 s above |
This changeset removes the static class `OC_Request` and moves the functions either into `IRequest` which is accessible via `\OC::$server::->getRequest()` or into a separated `TrustedDomainHelper` class for some helper methods which should not be publicly exposed. This changes only internal methods and nothing on the public API. Some public functions in `util.php` have been deprecated though in favour of the new non-static functions. Unfortunately some part of this code uses things like `__DIR__` and thus is not completely unit-testable. Where tests where possible they ahve been added though. Fixes #13976 which was requested in #13973 (comment)
f82b710 to
cebf9f6
Compare
|
@nickvergessen Incorporated your changes. |
|
/me is throwing a 💣 against Jenkins |
|
The inspection completed: 38 new issues, 43 updated code elements |
|
Refer to this link for build results (access rights to CI server needed): |
Refactor OC_Request into TrustedDomainHelper and IRequest
This changeset removes the static class
OC_Requestand moves the functions either intoIRequestwhich is accessible via\OC::$server::->getRequest()or into a separatedTrustedDomainHelperclass for some helper methods which should not be publicly exposed.This changes only internal methods and nothing on the public API. Some public functions in
util.phphave been deprecated though in favour of the new non-static functions.Unfortunately some part of this code uses things like
__DIR__and thus is not completely unit-testable. Where tests where possible they ahve been added though.Fixes #13976 which was requested in #13973 (comment)
(let's hope the tests pass on Jenkins as well – can't run the full test suite locally but for the changes parts they worked just fine – will take a look once CI passed)
@DeepDiver1975 As requested by you.
@th3fallen @nickvergessen @MorrisJobke @PVince81 Huge PR. Would be cool if you have some time to review this and test carefully.
Fixes itself.