Skip to content

feat(web): add bounded attachment admission rules - #365

Open
seekskyworld wants to merge 1 commit into
openpi-dev:mainfrom
seekskyworld:feat/issue-344-attachment-admission
Open

feat(web): add bounded attachment admission rules#365
seekskyworld wants to merge 1 commit into
openpi-dev:mainfrom
seekskyworld:feat/issue-344-attachment-admission

Conversation

@seekskyworld

Copy link
Copy Markdown

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.ts
  • npx tsc --noEmit
  • git diff --check

Impact

  • User-visible behavior: establishes bounded attachment admission errors for future UI.
  • Model-visible context/tools: none.
  • Runtime/lifecycle: none.
  • Persisted config/data: none.
  • Compatibility/risk: additive protocol utility; upload flow remains unimplemented.

Signed-off-by: seekskyworld <djh1813553759@gmail.com>

@tt-a1i tt-a1i left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

准入边界是对的,还没接到上传,format 是红的

数量/大小/MIME/文件名边界、拒绝穿越和 octet-stream,缝是对的。但:

  • 校验器没有接到实际上传路径;#388 也不会调用它。
  • MIME 和扩展名仍可能不一致(那是 #380)。
  • CI format:check 红。

请先修 format,再和 #380 rebase 成一份,然后让 #388 走同一套规则。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants