[clsi] address zod violations (#36199)

* [editor-core] gracefully handle no-op TextOperation

* [web] avoid sending sync to pdf requests without a ?file

* [validation-tools] log deeper nested violations

* [editor-core] fix round trip of EditNoOperation

* [web] use custom error for sync to pdf w/o file, fix tests

* [validation-tools] include request params in log msg for violation

* Revert "[editor-core] gracefully handle no-op TextOperation"

This reverts commit c1d37261d5db72b37dbf39428c54edcfb5423f41.

* [web] gracefully handle rejected sync to pdf from context menu

GitOrigin-RevId: 21de7dc96b23575b0d67b6eb0c68ed9c2f86292b
This commit is contained in:
Jakob Ackermann
2026-09-17 11:48:12 +00:00
committed by Copybot
parent 761d4efc1f
commit 731ed50f78
14 changed files with 254 additions and 16 deletions
+7 -2
View File
@@ -179,7 +179,12 @@ function sanitizeIssues(issues, depth = 0) {
path: issue.path.map(seg => String(seg).slice(0, 64)).join('.'),
message: String(issue.message).slice(0, 200),
}
if (issue.code === 'invalid_union' && depth < 2) {
// Bounded by schema shape, not user input: each level corresponds to one
// more union nested inside a union member (e.g. rawOperation -> rawFile
// -> rawFileMetadata -> the linked-file provider discriminatedUnion), so
// raising this cannot be exploited to grow log volume from adversarial
// input the way an unbounded path/array traversal could.
if (issue.code === 'invalid_union' && depth < 5) {
sanitized.errors = issue.errors.map(nested =>
sanitizeIssues(nested, depth + 1)
)
@@ -222,7 +227,7 @@ function logSchemaFailure(req, schema, kind, issues) {
.join('\n')
logger.warn(
{ location, kind, issues: sanitizedIssues, caller },
{ location, kind, issues: sanitizedIssues, caller, req },
'req-validation: request failed schema in log-only rollout'
)
}