Repository navigation
fix(api): name the rejected field, and answer a malformed dispute id (#612, #613) - #668
Open
praise-d-dev wants to merge 2 commits into
Conversation
The pipe rejected every bad `:address` parameter with a message beginning "address", whatever the route actually called it. On a route carrying more than one Stellar address the client cannot tell which one was refused, so a form has nowhere to attach the message and a screen reader announces "address is not a valid Stellar public key" with no way to act on it. `ArgumentMetadata.data` is the parameter's own name and was being discarded as `_metadata`. The message now leads with it, falling back to "address" for a bare `@Param()` where there is no name to use. The length error also says what the value is supposed to be rather than only how long. No route, status code or validation rule changed. Closes Refract-Protocol#612
`claim_disputes.id` is a UUID column, so a malformed `:id` never reaches a row: it fails inside the driver, and what comes back tells the client nothing about what it sent. There was no validation between the route and the query. Both `:id` routes now parse the parameter as a v4 UUID — the shape `gen_random_uuid()` produces — and refuse anything else with a message that names the field and shows the expected form, in the same style as the controller's other 400s. The routes, their status codes and the service are unchanged. Closes Refract-Protocol#613
|
@praise-d-dev Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
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.
Closes #612
Closes #613
Closes #610
Closes #611
Two of the four were real. #610 and #611 describe things the repository already has — evidence at the bottom.
#612 — the error names the parameter that was rejected
StellarAddressPiperejected every bad:addresswith a message beginning "address", whatever the route actually called it, becauseArgumentMetadatawas discarded as_metadata.On a route carrying more than one Stellar address the client cannot tell which one was refused: a form has nowhere to attach the message, and a screen reader announces "address is not a valid Stellar public key" with nothing to act on.
The message now leads with
metadata.data— the parameter's own name — falling back to "address" for a bare@Param()where there is no name to use. The length error also says what the value should be (a Stellar public key, starting with G) rather than only how long.No route, status code or validation rule changed.
#613 — a malformed dispute id gets an answer
claim_disputes.idis aUUIDcolumn (src/db/migrations/007_claim_disputes.sql:23). There was no validation between the route and the query, so a malformed:idnever reached a row — it failed inside the driver, and what came back told the client nothing about what it had sent.Both
:idroutes now parse the parameter as a v4 UUID — the shapegen_random_uuid()produces — and refuse anything else with a message naming the field and showing the expected form, in the same style as the controller's existing 400s.Routes, status codes and the service are unchanged.
Not solved — already in the tree
#610 — the threat model does cover pause and circuit breakers
docs/threat-model.mdhas several entries, not none:single_source, "satisfied only by the existing pause"POST /api/v1/oracle/pauseand theoracle_pause_audittablepausedstate in the lifecycledocs/oracle-safety-controls.mdcarries the detail, including the honest note that the contract has no pause entrypoint yet. If what is wanted is a single consolidated section rather than entries spread through the document, that is a different request and worth saying so in the issue.#611 — the lint output already leads with a severity word
formatReportinsrc/oracle/config/oracle-config.validator.ts:295builds each finding as:so every line starts with
ERRORorWARNINGin plain text. A search for✖,⚠,✓and✔acrosssrc/andscripts/returns nothing — there are no glyphs to strip, andscripts/oracle-config-lint.tsgoes through the same formatter.A note on the batch
mainwas last committed on 24 October and these issues were drafted on 21 November, so #610 and #611 describe work that was already in the tree when they were written.Not run here: written without a build environment, so
npm run lint,npm run buildand the Jest suite are the checks to apply.