-
Notifications
You must be signed in to change notification settings - Fork 70
[Bug] SubmitRequestSchema has no max length, unlike api-local's body limit #481
Copy link
Copy link
Closed
Labels
GrantFox OSSIssue tracked in GrantFox OSSIssue tracked in GrantFox OSSMaybe RewardedIssue may be eligible for a GrantFox rewardIssue may be eligible for a GrantFox rewardThird CampaignCampaign: Third CampaignCampaign: Third CampaignapiAdds or modifies a REST endpoint in apps/apiAdds or modifies a REST endpoint in apps/apibugSomething isn't workingSomething isn't workingtrivialSelf-contained task, completable in < 2 hours with no deep protocol knowledge requiredSelf-contained task, completable in < 2 hours with no deep protocol knowledge required
Description
Activity
Metadata
Metadata
Assignees
Labels
GrantFox OSSIssue tracked in GrantFox OSSIssue tracked in GrantFox OSSMaybe RewardedIssue may be eligible for a GrantFox rewardIssue may be eligible for a GrantFox rewardThird CampaignCampaign: Third CampaignCampaign: Third CampaignapiAdds or modifies a REST endpoint in apps/apiAdds or modifies a REST endpoint in apps/apibugSomething isn't workingSomething isn't workingtrivialSelf-contained task, completable in < 2 hours with no deep protocol knowledge requiredSelf-contained task, completable in < 2 hours with no deep protocol knowledge required
Description
SubmitRequestSchemainpackages/shared/src/schemas.tsisz.object({ xdr: z.string().min(1) }), with no maximum length.apps/api-local/src/index.ts:20already sets a deliberatebodyLimit: 10 * 1024(10 KB) on the Fastify server "to block oversized payload attacks," but the Vercel functions (api/v1/tx/submit) have no equivalent bound, since they validate against this shared schema rather than a body-limit middleware.Steps to Reproduce
POST /api/v1/tx/submitwith axdrstring far larger than any real transaction envelope could be (e.g. several MB).Expected Behavior
The Vercel path should reject oversized
xdrpayloads the same way the Fastify path does.Actual Behavior
No length bound exists on the Vercel path; an oversized payload passes schema validation and proceeds to XDR parsing.
Environment
Possible Cause / Fix
Add a
.max()toSubmitRequestSchema'sxdrfield, consistent with the existing 10 KB precedent inapps/api-local/src/index.ts:10,000 characters is generously above any real signed Stellar transaction envelope's base64 size while staying bounded, matching the same order of magnitude as the existing
apps/api-localbody limit.