-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Fix Axios CSRF token update #17404
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
Merged
Merged
Fix Axios CSRF token update #17404
Conversation
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
rullzer
approved these changes
Oct 4, 2019
Member
rullzer
left a comment
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.
I like it!
skjnldsv
approved these changes
Oct 4, 2019
Signed-off-by: Christoph Wurst <[email protected]>
fc91769 to
329059d
Compare
Member
|
/compile amend / |
329059d to
12378f4
Compare
Member
I don't understand why 🤔 |
727184f to
8167caa
Compare
Member
Let's try if the lockfile was an issue, since tests are using EDIT: the answer is no ^^' |
Signed-off-by: Christoph Wurst <[email protected]> Signed-off-by: npmbuildbot[bot] <npmbuildbot[bot]@users.noreply.github.com>
8167caa to
81613d2
Compare
Member
|
Built it again and suddenly it works --" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
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.
I found a bug in the
nextcloud-axios(now@nextcloud/axios) package: we read theOC.requesttokenjust once. But the token can actually change over time.As there is no simple solution to intercept every request with Axios (only PUT, POST, DELETE and PATCH), I updated the package (and
@nextcloud/auth) to listen to an event on the new event bus.The server now emits the events so that other modules that need the token can stay in sync.
This PR is split into two parts
@nextcloud/axioswhich listens to the event (via@nextcloud/auth) and thus always uses the correct tokenTo test this PR you can either wait for the CSRF token to expire or just run
_nc_event_bus.emit('csrf-token-update', {token: 123}). On the apps page, for example, you should see 412 errors if you emit an invalid token.