Skip to content

Respect mod_unique_id and refactor OC_Request::getRequestId - #13973

Merged
LukasReschke merged 1 commit into
masterfrom
enhancement/security/13366
Feb 9, 2015
Merged

LukasReschke merged 1 commit into
masterfrom
enhancement/security/13366

Conversation

@LukasReschke

Copy link
Copy Markdown
Contributor

When mod_unique_id is enabled the ID generated by it will be used for logging. This allows for correlation of the Apache logs and the ownCloud logs.

Testplan:

  • When mod_unique_id is enabled the request ID equals the one generated by mod_unique_id.
  • When mod_unique_id is not available the request ID is a 20 character long random string
  • The generated Id is stable over the lifespan of one request

Changeset looks a little bit larger since I had to adjust every unit test using the HTTP\Request class for proper DI.

Fixes #13366

@MorrisJobke @PVince81 Please review.

When `mod_unique_id` is enabled the ID generated by it will be used for logging. This allows for correlation of the Apache logs and the ownCloud logs.

Testplan:

- [ ] When `mod_unique_id` is enabled the request ID equals the one generated by `mod_unique_id`.
- [ ] When `mod_unique_id` is not available the request ID is a 20 character long random string
- [ ] The generated Id is stable over the lifespan of one request

Changeset looks a little bit larger since I had to adjust every unit test using the HTTP\Request class for proper DI.

Fixes #13366
@LukasReschke
LukasReschke force-pushed the enhancement/security/13366 branch from 9e5ca32 to 770fa76 Compare February 9, 2015 10:53
@LukasReschke

Copy link
Copy Markdown
Contributor Author

@owncloud-bot Retest this please

@DeepDiver1975

Copy link
Copy Markdown
Contributor

Look good thx 👍

@ghost

ghost commented Feb 9, 2015

Copy link
Copy Markdown

Refer to this link for build results (access rights to CI server needed):
https://ci.owncloud.org//job/pull-request-analyser-ng-simple/9019/
Test PASSed.

@DeepDiver1975

Copy link
Copy Markdown
Contributor

Feel free to submit more prs to kill oc_request completely.

@LukasReschke

Copy link
Copy Markdown
Contributor Author

Feel free to submit more prs to kill oc_request completely.

With pleasure. – Let's get this in first though to prevent merge fuckups. I didn't want to mix new features with refactoring in one PR.

@nickvergessen Care to review as well?

@LukasReschke LukasReschke mentioned this pull request Feb 9, 2015
@ghost

ghost commented Feb 9, 2015

Copy link
Copy Markdown

Refer to this link for build results (access rights to CI server needed):
https://ci.owncloud.org//job/pull-request-analyser-ng-simple/9023/
Test PASSed.

@scrutinizer-notifier

Copy link
Copy Markdown

The inspection completed: 6 new issues, 3 updated code elements

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This is equal to $this->getMock('\OCP\Security\ISecureRandom') just as a hint.

@nickvergessen

Copy link
Copy Markdown
Contributor

Looks good 👍

LukasReschke added a commit that referenced this pull request Feb 9, 2015
Respect `mod_unique_id` and refactor `OC_Request::getRequestId`
@LukasReschke
LukasReschke merged commit 47c7eb4 into master Feb 9, 2015
@LukasReschke
LukasReschke deleted the enhancement/security/13366 branch February 9, 2015 16:35
LukasReschke added a commit that referenced this pull request Feb 10, 2015
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)
LukasReschke added a commit that referenced this pull request Feb 11, 2015
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)
LukasReschke added a commit that referenced this pull request Feb 16, 2015
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)
@drzraf

drzraf commented May 14, 2016

Copy link
Copy Markdown

From the Git history, this commit introduced HTTP_X_OC_MTIME for the first time but there is no rational for it.
For example, why Last-Modified header hasn't been chosen over a new custom HTTP extension?
(it would have been a much more standard way to preserve timestamps of uploaded files?)

@PVince81

Copy link
Copy Markdown
Contributor

@drzraf I don't see any reference of "OC_MTIME" in this diff, maybe you commented on the wrong PR ? I suggest you make a new ticket to discuss this.
From what I remember, X-OC-MTIME was introduced to tell the desktop client whether the mtime was accepted by the server/storage. Some storages don't support touch operations and for some reason the client needs to know about this. Not sure whether it is still needed nowadays, so a ticket to discuss this would be nice 😄

@drzraf

drzraf commented May 17, 2016

Copy link
Copy Markdown

commt 886bda5

Fixes #13976 which was requested in #13973 (comment)

Still I don't see documentation about timestamp preservation and how one is expected to touch files.
AFAICT there is no such "touch" thing in the webdav protocol, nor in lftp, ftp or cadaver clients.
I'll open an issue about this.

@lock

lock Bot commented Aug 5, 2019

Copy link
Copy Markdown

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock Bot locked as resolved and limited conversation to collaborators Aug 5, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Respect request ID from mod_unique_id when installed for the oC Request ID

6 participants