-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: use createHmac to sign generated csrf tokens
BREAKING CHANGE: This change replaces the createHash method with createHmac for hashing tokens. It introduces the getSessionIdentifier configuration option which by default will return req.session.id. The purpose of this function is to return the id of the session associated with the incoming request. The session id will be included in the hmac signature, forcefully tying the generated csrf token with that session. This means by default generated tokens can only be used by the session which they were originally generated for. If you have any kind of session rotation (to mitigate session hijacking), which you should be doing during privilege escaltions and de-escalations (e.g. sign in, sign out) then you will need to generate a new csrf token at the same time. Additionally this change exposes the delimiter and hmacAlgorithm options.
- Loading branch information
Showing
7 changed files
with
133 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters