fix: validate failure status values on the PUT endpoints (#135)#161
Merged
Conversation
9d780fe to
3b123d1
Compare
Reject statuses outside pending|accepted|rejected with a 400 on both the single-failure and batch status routes, and reject a non-array filenames on the batch route, so junk values can no longer distort computeStats. Adds handler tests for both routes. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> https://claude.ai/code/session_01BxexPASV1UbMj8ede48RLu
3b123d1 to
8af2054
Compare
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.
Summary
Closes #135. The two status PUT endpoints wrote whatever string the client sent;
computeStatsonly countspending|accepted|rejected, so junk statuses silently distorted stats and hid failures from totals.Both routes now whitelist
pending|accepted|rejected(400 otherwise), and the batch route also 400s on non-arrayfilenames.Test plan
npm test→ 158/158 (5 new intests/node/handler.test.js: bogus status → 400 on both routes, non-array filenames → 400, valid statuses → 200 with updated stats).Note
Touches
tests/node/handler.test.js, as does #157 (size=0) — both append independent suites, so at most a trivial merge-resolve depending on order.Not enabling auto-merge.