-
Notifications
You must be signed in to change notification settings - Fork 18
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
Chore/update with v3 changes #73
Merged
Merged
Conversation
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
Added the getSessionIdentifier parameter to the csrf-csrf configuration. By providing the getSessionIdentifier callback, generated tokens will only be valid for the original session identifier they were generated for. For example: (req) => req.session.id The token will now be signed with the session id included, this means a generated CSRF token will only be valid for the session it was generated for. This also means that if you rotate your sessions (which you should) you will also need to generate a new CSRF token for the session after rotating it.
BREAKING CHANGE: Parameter update to generateToken. The third and fourth parameters for generateToken have been combined into an object. The third parameter is keyed by overwrite, the fourth parameter is keyed by validateOnReuse. Any calls to generateToken (also via req.csrfToken) will need to be updated accordingly: generateToken(req, res) > generateToken(req, res) // no change generateToken(req, res, true) > generateToken(req, res, { overwrite: true }); generateToken(req, res, true, false) > generateToken(req, res, { overwrite: true, validateOnReuse: false }) req.csrfToken(true) > req.csrfToken({ overwrite: true }); req.csrfToken(true, true) > req.csrfToken({ overwrite: true, validateOnReuse: true });
When calling `generateToken` the third options object parameter can now take a cookieOptions property to override any of the initial cookieOptions that were provided. This commit also removes the forced httpOnly true option. E.g. generateToken(req, res, { cookieOptions })
psibean
force-pushed
the
chore/update-with-v3-changes
branch
from
September 21, 2024 05:37
79dd877
to
2bfb4a6
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Brings v3 upstream changes