Validate the nonce before we set our authenticated state #54
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.
Description of the Change
More plugin review feedback was provided around needing a nonce check before we update our authenticated state to
true. While we could probably argue our way around this, as we don't actually store any value sent in the URL, we just compare that value to what we already have stored to ensure they match (and thus don't really need a nonce check here), was easy enough to adjust the middleware to send back the initial nonce we give them and then verify that.So this PR will rely on changes to the middleware (handled in a separate PR in that repo) to fully function.
In addition, changed our check to only fire in the admin and for administrators, which also reduces the scope of when this code is run.
Note
This PR is branched from the
plugin-submissionbranch. This is to help keep a clean slate of what we have submitted to that team for review. We'll want to ensure the code changes here also get merged intodevelopafterHow to test the Change
authenticated = truein the stored settingsChangelog Entry
Credits
Props @dkotter
Checklist: