Skip to content

Refuse mistyped optional fields on POST /api/sandboxed with 400 - #514

Merged
davidmckayv merged 2 commits into
CopilotKit:mainfrom
Ayush7614:fix/sandboxed-save-field-validation
Sep 13, 2026
Merged

Refuse mistyped optional fields on POST /api/sandboxed with 400#514
davidmckayv merged 2 commits into
CopilotKit:mainfrom
Ayush7614:fix/sandboxed-save-field-validation

Conversation

@Ayush7614

Copy link
Copy Markdown
Contributor

Only slug and title were checked; description/html/css/jsFunctions flowed in as ?? "" and argumentSchema/sampleArguments as ?? {}, so a number, array or JSON string travelled into a text/jsonb column and came back as an unhandled 500.

Absent still means the default; a present text field must be a string (400 The component <field> must be text.) and a present schema field must be a plain object (400 The component <field> must be an object.), before the store or the database sees the values.

Tests: new server/tests/sandboxed-save-fields.test.ts (22 cases: defaults, well-typed save, 10 non-string text shapes, 9 non-object schema shapes, mixed-body atomicity). Verified: sandboxed routes + save-fields suites — 26 pass.

@davidmckayv davidmckayv left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deep-reviewed clean (validation, no secret leak, fail-closed, agrees with existing layers). CI green.

@davidmckayv
davidmckayv merged commit 915ab11 into CopilotKit:main Sep 13, 2026
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants