Enable Customized CSRF Protection in Angular UI#977
Merged
tdonohue merged 3 commits intoDSpace:mainfrom Feb 8, 2021
Merged
Conversation
This was referenced Dec 22, 2020
fcc10dd to
6fa03fe
Compare
63007eb to
2b2f2c2
Compare
2b2f2c2 to
e2d9353
Compare
e2d9353 to
9d2a57d
Compare
…sing new DSPACE-XSRF-TOKEN header
9d2a57d to
31b346d
Compare
Member
Author
|
Just resolved the merge conflicts after merging #975 . I also retested just to verify everything was still working & it's looking good. Will merge on Monday (assuming CI passes & no other feedback to resolve) |
Member
Author
|
Merging as the REST PR is at +2, and this is at +1 and flagged as |
This file contains hidden or 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
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.
References
Description
This PR creates a customized
XsrfInterceptorwhich responds to the Backend/Server Webapp based on the custom CSRF Protection added in DSpace/DSpace#3103Namely, the behavior is as follows:
DSPACE-XSRF-COOKIE. This cookie is not read/used by Angular, but is returned (by user's browser) on every subsequent request to backend.DSPACE-XSRF-TOKENto Angular.XsrfInterceptorlooks forDSPACE-XSRF-TOKENheader in a response. If found, its value is saved to a client-side (only) cookie namedXSRF-TOKEN.XsrfInterceptorchecks for that client-sideXSRF-TOKENcookie. If found, its value is sent to the backend in theX-XSRF-TOKENheader.X-XSRF-TOKENheader is received & compared to the current value of the server-side cookie namedDSPACE-XSRF-COOKIE(created in step 1). If tokens match, the request is accepted. If tokens don't match a 403 is returned.Instructions for Reviewers
Must be tested with DSpace/DSpace#3103
Checklist
yarn run lintpackage.json), I've made sure their licenses align with the DSpace BSD License based on the Licensing of Contributions documentation.