feat(web): add bounded attachment admission rules - #365
Open
seekskyworld wants to merge 1 commit into
Open
Conversation
Signed-off-by: seekskyworld <djh1813553759@gmail.com>
This was referenced Sep 4, 2026
tt-a1i
reviewed
Sep 7, 2026
tt-a1i
left a comment
Collaborator
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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