Skip to content

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

Open
Ayush7614 wants to merge 1 commit into
CopilotKit:mainfrom
Ayush7614:fix/sandboxed-save-field-validation
Open

Refuse mistyped optional fields on POST /api/sandboxed with 400#514
Ayush7614 wants to merge 1 commit 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.

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.

1 participant