[GH-ISSUE #8215] Harden ordinary chat request validation while preserving data transfers #8159

Closed
opened 2026-10-25 04:03:06 +07:00 by bsakaguchi · 1 comment
Owner

Originally created by @SpicyMarinara on GitHub (Oct 23, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/8215

Originally assigned to: @SpicyMarinara on GitHub.

Description

Ordinary chat creation and settings updates should reject malformed roster data before collecting a separate schema-validation error for every invalid entry. Validation responses should also keep diagnostic output bounded.

The assessed hardening belongs on staging. Preserve valid rosters, user text, and all import/export, upload, backup and profile-transfer behavior. Do not add shared-schema collection caps or lower the application-wide upload limit.

Expected behavior

Reject malformed roster input promptly on the ordinary chat resource endpoints, retain useful validation diagnostics, and keep existing data-transfer paths working with large files and collections.

Current behavior

The ordinary create/update controllers send roster arrays directly to schema validation, and the shared error handler returns every resulting issue.

Environment

Confirmed by source inspection and bounded local validation on current staging (c97f83ffbc86ee5156903620f7a50daadb780822). Remote access remains subject to the existing host, authentication, network and CSRF policy; no authentication bypass or server crash is claimed.

Implementation ownership

@SpicyMarinara / Codex is implementing this in fix/chat-request-validation-hardening. The dependency-only update in #8210 is not a replacement for controller-level handling; Zod 4 compatibility is being assessed separately.

Originally created by @SpicyMarinara on GitHub (Oct 23, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/8215 Originally assigned to: @SpicyMarinara on GitHub. ## Description Ordinary chat creation and settings updates should reject malformed roster data before collecting a separate schema-validation error for every invalid entry. Validation responses should also keep diagnostic output bounded. The assessed hardening belongs on `staging`. Preserve valid rosters, user text, and all import/export, upload, backup and profile-transfer behavior. Do not add shared-schema collection caps or lower the application-wide upload limit. ## Expected behavior Reject malformed roster input promptly on the ordinary chat resource endpoints, retain useful validation diagnostics, and keep existing data-transfer paths working with large files and collections. ## Current behavior The ordinary create/update controllers send roster arrays directly to schema validation, and the shared error handler returns every resulting issue. ## Environment Confirmed by source inspection and bounded local validation on current `staging` (`c97f83ffbc86ee5156903620f7a50daadb780822`). Remote access remains subject to the existing host, authentication, network and CSRF policy; no authentication bypass or server crash is claimed. ## Implementation ownership @SpicyMarinara / Codex is implementing this in `fix/chat-request-validation-hardening`. The dependency-only update in #8210 is not a replacement for controller-level handling; Zod 4 compatibility is being assessed separately.
bsakaguchi 2026-10-25 04:03:06 +07:00
Author
Owner

@SpicyMarinara commented on GitHub (Oct 23, 2026):

Implemented on staging in #8216, merge cc394efd6ca5682fc3047058b99b7bf43e5bf116. Ordinary chat creation/settings reject malformed roster entries before schema validation, with at most 50 public validation details.

No import/export/upload/backup/profile or shared-schema limits were added or tightened, and no user text was shortened. The 1 MiB budget applies only to ordinary POST /api/chats and PATCH /api/chats/:id. Real native JSON and multipart character transfers preserved 5,900,833 exported bytes and the text hash; a native lorebook round trip preserved all 10,001 entries and content in 13,057,692 exported bytes.

All eight required checks and the complete Node lane passed on the exact reviewed head. Actual Dottore review completed with zero defects and one nonblocking wording note. The merge parents, tree and all five reviewed file blobs were verified. Raw validation, review and source-preservation proof has 27 files whose published bytes were checked against the local evidence.

This closes the focused controller-hardening issue. Zod remains 3.25.76; a complete major-version migration is separate compatibility work, and this patch is not presented as a version-only advisory fix. Post-merge CodeQL and the container workflow passed, as did all three Node shards and their aggregate. The Regression Checks workflow remains cancelled: both browser attempts exceeded its existing 10-minute whole-job budget. The first passed all 7 smoke assertions after 469.170 seconds of setup; its one unchanged-head retry spent 589.457 seconds still downloading Ubuntu apt packages and reached no assertions. No further retry or weakened checks were used, so this is not an all-green post-merge CI claim.

At the final recorded registry readback, staging was still cc394efd6ca5682fc3047058b99b7bf43e5bf116, and ghcr.io/pasta-devs/marinara-engine:staging resolved to sha256:5da8a514cf65a2ff2b348afbe7c7d2798593198bf1ccee3090c7f0e117359309. Both linux/amd64 and linux/arm64 revisions matched that merge. Registry publication is verified; no local Docker pull, user-device execution or main release is claimed.

<!-- gh-comment-id:6375891697 --> @SpicyMarinara commented on GitHub (Oct 23, 2026): Implemented on `staging` in #8216, merge [`cc394efd6ca5682fc3047058b99b7bf43e5bf116`](https://github.com/Pasta-Devs/Marinara-Engine/commit/cc394efd6ca5682fc3047058b99b7bf43e5bf116). Ordinary chat creation/settings reject malformed roster entries before schema validation, with at most 50 public validation details. No import/export/upload/backup/profile or shared-schema limits were added or tightened, and no user text was shortened. The 1 MiB budget applies only to ordinary `POST /api/chats` and `PATCH /api/chats/:id`. Real native JSON and multipart character transfers preserved 5,900,833 exported bytes and the text hash; a native lorebook round trip preserved all 10,001 entries and content in 13,057,692 exported bytes. All eight required checks and the complete Node lane passed on the exact reviewed head. Actual Dottore review completed with zero defects and one nonblocking wording note. The merge parents, tree and all five reviewed file blobs were verified. [Raw validation, review and source-preservation proof](https://gist.github.com/SpicyMarinara/3fc394898820ea3d792dfb5164c1a3fd) has 27 files whose published bytes were checked against the local evidence. This closes the focused controller-hardening issue. Zod remains 3.25.76; a complete major-version migration is separate compatibility work, and this patch is not presented as a version-only advisory fix. Post-merge CodeQL and the container workflow passed, as did all three Node shards and their aggregate. The Regression Checks workflow remains **cancelled**: both browser attempts exceeded its existing 10-minute whole-job budget. The first passed all 7 smoke assertions after 469.170 seconds of setup; its one unchanged-head retry spent 589.457 seconds still downloading Ubuntu apt packages and reached no assertions. No further retry or weakened checks were used, so this is **not an all-green post-merge CI claim**. At the final recorded registry readback, `staging` was still `cc394efd6ca5682fc3047058b99b7bf43e5bf116`, and `ghcr.io/pasta-devs/marinara-engine:staging` resolved to `sha256:5da8a514cf65a2ff2b348afbe7c7d2798593198bf1ccee3090c7f0e117359309`. Both linux/amd64 and linux/arm64 revisions matched that merge. Registry publication is verified; no local Docker pull, user-device execution or main release is claimed.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Pasta-Devs/Marinara-Engine#8159
No description provided.