Repository navigation
test: cover csrf rejection, stored episodes and since filtering - #83
Merged
Merged
Conversation
Nothing sent a bad token to a protected route, validCSRFToken could return true unconditionally and the suite stayed green. Covers form and header token, and a token minted for another session.
The episode and subscription change tests only checked status codes and response shape, written against a mock that ignored since. Upload now checks the action is stored, both pull endpoints check that since filters by modification time.
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.
What
Tests for the four gaps the mutation check on #82 found, no production code changes.
csrf_test.go: protected POST with missing / wrong / other-session token -> 403 and nothing changes. Valid form and header token still pass.TestHandleUploadEpisodes: uploaded action actually lands in the storeTestHandleGetEpisodes_Since,TestHandleGetSubscriptionChanges_Since:sincefilters by modification time, incl. removalsWhy
Follow-up from #82. Seeded these bugs into production code, the whole suite stayed green on
main:validCSRFTokenalways truesinceignored for episodessinceignored for subscription changesThe old tests only checked status codes, e.g.
"supports since query parameter"asserted200and nothing else. Against the mock nothing more was possible, it ignoredsinceand always returned empty changes. With the real store from #82 it is.CSRF is the important one, its a security check nobody tested.
Testing
Same mutations against this branch: