Reject NUL characters in playlist names and proposal titles with a 400 - #216
Merged
Merged
Conversation
Member
Author
|
Reviewed head 643d2a0 (on main 8c5cdc8, which has #215). Approved. All 54 test files and 365 tests pass. Both new route tests fail against main's schemas. I sent 16 payloads through the real routes, with a mocked database, on main and on this head. The changes:
These are unchanged from main:
CI at the time I checked: CodeFactor and ghostdeps were green, and the TypeScript workspace job was still running, so it is not CI-green yet. |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
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.
Same class as #215. The playlist generation name and the playlist proposal title are stored in Postgres, which cannot hold NUL, so a payload containing \u0000 passed validation and answered 500. Both schemas now refuse NUL, so the request gets the existing 400 INVALID_REQUEST before any query. The shared check moves to packages/contracts/src/text.ts and the scrobble schema uses it too. Test: two cases fail with 500 on main and pass with 400, asserting the database is never called. Behaviour change: invalid payloads return 400 instead of 500.