Repository navigation
Conversation
…red, callbackUrl optional as documented - The required-field check tested `signature` twice and never `key`, so a missing key reached checkSignature. - checkSignature throws (not false) on a signature/key that is not decodable COSE; that surfaced as an unhandled 500. Now 400, logged. - Non-string walletId/datum/description reached Prisma or checkSignature and threw; now rejected with 400 up front (signature/key must be hex). - callbackUrl was rejected when absent, with an error naming "Datum", although the OpenAPI spec lists it as optional and the row stores null. It is optional again; when given it must be an http(s) URL <= 2048 chars. - OpenAPI: document the 400/401/403 cases. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017rkSXFzqacGdQ1YXPo25ZC
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This branch was successfully deployed
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
POST /api/v1/submitDatum(bot/JWT route that creates a signable with the caller's signature already attached) now validates its body before using it:keymissingsignaturetwice), then checkSignature threw → 500key is required and must be hexsignature/keyhex but not COSE (e.g.abcd)RangeError→ 500signature/keynot hex, odd length, or not a stringwalletId/datum/descriptionnot a stringcallbackUrlabsentMissing required field Datum!(wrong field; OpenAPI lists it as optional and the row storesnull)nullcallbackUrlgivenThe 500s were verified against the real
@meshsdk/core-cst:checkSignaturethrowsnot enough bytes(missing key),fromHex expects an hexadecimal stringandTrying to access beyond buffer lengthinstead of returningfalse.Why
Caller-controlled input should never produce a 500, and the documented contract (
callbackUrloptional) disagreed with the code. Validation is a pureparseSubmitDatumBodyexported for tests, in the style ofparseIssueReport.Behaviour changes to be aware of
callbackUrlthat is not an http(s) URL is now refused. Nothing in the app readsSignable.callbackUrltoday, so the only risk is an external caller that sent a non-URL string.scripts/ci/scenarios/steps/datum.ts) sends hex fromsignData()and an https callback, so it is unaffected. MCP does not reach this route (mcpTools.test.tslists it as forbidden).botApi.integration.test.ts: the fixturesignature: "sig", key: "key"is now hex.checkSignatureis mocked there.No changes to signing, witnesses, or what is stored for valid requests.
Tests
npx tsc --noEmitnpx jest src/__tests__/submitDatum.bot.test.tsnode scripts/run-tests.mjs(full unit run, final commit)RUN_BOT_API_INTEGRATION=true jest botApi.integration.test.ts(local Postgres)addTransactionstep beforesubmitDatumruns, and fails the same way on unmodifiedpreprod. This suite is opt-in and not part of CI. Not addressed here.A separate review agent read the diff without context. It found nothing blocking. Following its review, decode errors are now logged and the hex check requires whole bytes.
Generated by Claude Code