Conversation
66b78c5 to
67a7fab
Compare
tcitworld
left a comment
There was a problem hiding this comment.
Would refactoring OC\AppFramework\Http\Request::passesCSRFCheck to use the new CsrfValidator create more dependency hell? It would avoid to have the logic in two different places.
67a7fab to
ac0652e
Compare
I agree, having the logic in two different places it not an improvement. The goal is to remove passesCSRFCheck and the CSRFTokenManager from IRequest. |
ac0652e to
3cb076e
Compare
3cb076e to
6830563
Compare
f806386 to
6f3ac85
Compare
ca94de7 to
4ba5a0e
Compare
|
But now all the classes need CsrfValidator and that still needs CsrfTokenManager? |
That's correct. IRequest.passesCSRFCheck is only needed in a couple of places, but IRequest is injected in many more classes. |
|
I'm having the idea of making IRequest lighter for a while now. We are injecting an IRequest instance in a couple of places. For example, the logger. It makes sense, to include some details from the request object (e.g. request id, ip address, etc.) in our logs, but that requires a CsrfTokenManager instance and therefore a working database connection and cache. As soon as db or cache is unavailable, you can't use the logger anymore. Examples: |
3 years, not 3 versions xP so 36 😔 |
|
But okay, got it now and see how it improves. Could also remove the dependency already and just depend on |
4ba5a0e to
fe647d5
Compare
😭
Good idea 👍 |
|
Moving to 29 |
ed76c62 to
f41e63e
Compare
cbe00c4 to
a0dd76d
Compare
Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
a0dd76d to
97f4357
Compare
Summary
To validate a CSRF token the Request object needs CsrfTokenManager.
CsrfTokenManager is a heavy dependency.
flowchart TD CsrfTokenManager CsrfTokenManager-->CsrfTokenGenerator-->ISecureRandom CsrfTokenManager-->SessionStorage-->ISession-->IUserSession IUserSession-->OC\User\Session OC\User\Session-->OC\User\Manager OC\User\Session-->OCP\ISession OC\User\Session-->ISecureRandom OC\User\Session-->LoggerInterface OC\User\Session-->IEventDispatcher OC\User\Manager-->ICacheFactory-->ICacheTODO
Checklist