-
Notifications
You must be signed in to change notification settings - Fork 38
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
Add session hijacking mitigation configuration #564
Conversation
Cmon @Ocramius |
Ping @Ocramius |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall, patch direction improved massively.
My feedback is mostly highlighting problems without proposing real alternatives at the moment, since I mostly focused on providing some feedback at first.
I believe we can discuss this on a call again, but the fact that most validation is now handled inside lcobuccci/jwt
is really good.
Things I don't like:
- current ergonomics and docs (mostly, because we're uncovering issues due to lack of a config builder)
- introduction of
sodium_
stuff that we'll have to maintain, where a simplesha1
is already effective - reliance on
$_SERVER
where reading a header would be preferable - reliance on
REMOTE_ADDR
where unreliable
interface Source | ||
{ | ||
/** @return non-empty-string */ | ||
public function extractFrom(ServerRequestInterface $request): string; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This interface requires some documentation: taken as-is, it is not very clear what it does.
Also, could it be that it cannot extract information from $request
?
/** @immutable */ | ||
final class RemoteAddr implements Source | ||
{ | ||
public const REQUEST_ATTRIBUTE_NAME = 'REMOTE_ADDR'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a problem with relying on REMOTE_ADDR
: it does not consider any proxies. If we assume that there's an upfront middleware that clears all this information, that's fine, but this Source
is unreliable when the middleware is deployed independently, and put behind a reverse proxy.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The only thing this library can do about that is documentation:
https://github.com/psr7-sessions/storageless/tree/9.0.x#session-hijacking-mitigation
Done :-) |
4929d6a
to
371336e
Compare
No description provided.