feat(web): add bounded attachment admission rules - #365
seekskyworld wants to merge 1 commit into
Conversation
tt-a1i
left a comment
There was a problem hiding this comment.
Exact-head review found no confirmed P2+ within this typed, currently unused pure validator. Focused tests passed 2/2. It limits count/MIME/per-file/aggregate bytes but has no production upload caller, so it does not yet deliver attachment admission in the product. The ASCII filename policy also excludes ordinary Chinese filenames; reconcile that policy when composing the actual attachment flow. Current Node 22/24 CI fails in formatting of tests/web/attachments.test.ts, verified from the run logs. Recommendation: defer standalone merge, retain useful validation rules for the attachment integration with author credit, and clear CI before any merge. No source edits or merge performed.
Validate count, MIME, filename, and byte limits as a pure admission contract. Allow ordinary Unicode names while rejecting traversal and control characters. This slice remains unused until staging/upload calls it.
ad0e9fd to
339198f
Compare
|
Rebased onto current
Type-safety (MIME↔extension, inherited-key rejection) stays on #380, which is rebased onto this head. |
Problem
Implements the admission-contract slice of #344. Web attachments had no shared, testable bounds for count, filename, MIME, per-file size, or aggregate size.
Value
Future file/image upload paths can fail closed before touching workspace or Session authority.
Approach
Add a pure protocol validator with explicit supported MIME types, filename traversal protection, count and UTF-8-independent byte limits. No upload storage or prompt behavior is changed.
Validation
node --test --experimental-strip-types tests/web/attachments.test.tsnpx tsc --noEmitgit diff --checkImpact