Skip to content

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
Refract-Protocol:mainfrom
praise-d-dev:feature/name-the-rejected-field-and-the-malformed-id
Open

praise-d-dev wants to merge 2 commits into
Refract-Protocol:mainfrom
praise-d-dev:feature/name-the-rejected-field-and-the-malformed-id

Conversation

@praise-d-dev

@praise-d-dev praise-d-dev commented Nov 25, 2026 •

Copy link
Copy Markdown

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

StellarAddressPipe rejected every bad :address with a message beginning "address", whatever the route actually called it, because ArgumentMetadata was 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.id is a UUID column (src/db/migrations/007_claim_disputes.sql:23). There was no validation between the route and the query, so a malformed :id never reached a row — it failed inside the driver, and what came back told the client nothing about what it had sent.

Both :id routes now parse the parameter as a v4 UUID — the shape gen_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.md has several entries, not none:

  • line 106 — corroboration or an operator pause for payout-triggering values
  • line 114 — single_source, "satisfied only by the existing pause"
  • lines 128–131 — the operator pause endpoint POST /api/v1/oracle/pause and the oracle_pause_audit table
  • lines 136–137 — an operator pause or circuit breaker for payout-triggering values, marked PLANNED, with the manual pause documented
  • line 157 — "use circuit breakers/backoff for dependencies"
  • line 175 — the paused state in the lifecycle

docs/oracle-safety-controls.md carries 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

formatReport in src/oracle/config/oracle-config.validator.ts:295 builds each finding as:

lines.push(`  ${issue.severity.toUpperCase()} ${issue.code} [${issue.feed}] ${issue.message}`);

so every line starts with ERROR or WARNING in plain text. A search for ✖, ⚠, ✓ and ✔ across src/ and scripts/ returns nothing — there are no glyphs to strip, and scripts/oracle-config-lint.ts goes through the same formatter.

A note on the batch

main was 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 build and the Jest suite are the checks to apply.

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
@drips-wave

drips-wave Bot commented Nov 25, 2026

Copy link
Copy Markdown

@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! 🚀

Learn more about application limits

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant