mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-12 21:23:45 +01:00
[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:
@@ -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'
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user