Skip to content

fix(hosting): deploy 条目数与 preview 共享 128 上限 - #148

Merged
LIghtJUNction merged 1 commit into
mainfrom
fix/hosting-slice-20260928
Sep 28, 2026
Merged

LIghtJUNction merged 1 commit into
mainfrom
fix/hosting-slice-20260928

Conversation

@LIghtJUNction

@LIghtJUNction LIghtJUNction commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

摘要

Issue #80 的一个网页托管切片(不关闭 #80)。

  • hosting.preview 已由 fix(security): repair rollback pins, lifecycle cleanup and bounded processing #142 限制为最多 128 个条目,但 hosting.deploy 仍接受任意长度的 entries:它会对每个条目做 path_name 校验、源资源读权限检查和 revision 读取,然后才进行容量检查,最后为每个条目创建一个公开文件资源。
  • 本 PR 抽出 MAX_HOSTING_ENTRIES=128,由 preview 和 deploy 共用。deploy 在当前授权与 generation 校验之后、遍历任何源资源之前拒绝超限请求,错误码为 too_many_hosting_entries。这样 deploy 的规模不会超过先前能被 preview 展示的规模。
  • 已发布的 v1 wire schema 保持不变(不加 maxItems),与 fix(security): repair rollback pins, lifecycle cleanup and bounded processing #142 对 preview 的处理方式一致。

测试

tests/test_hosting_same_origin.py 新增 test_deploy_entry_bound_matches_preview_before_any_materialization:

  • 129 个条目的请求能通过 v1 schema 校验,但运行时被 too_many_hosting_entries 拒绝;拒绝过程中没有碰内容存储(read_bytes/put_bytes 被打桩为失败),resources/revisions/settings 行数不变,站点的 revision 仍为空。
  • 128 个条目可以成功部署,且在同一 origin 下能读到第 128 个文件(带 sandbox CSP);不存在的第 129 个文件返回 404。

在真实 PostgreSQL 上运行:

  • pytest tests/test_hosting_same_origin.py:5 passed
  • pytest tests/test_security_patch_regressions.py tests/test_extensions.py -k "preview or hosting":3 passed

不在本 PR 范围

#80 其余项(Transfer、Git/LFS 真实客户端、跨实例预算、断电/备份一致性、真实浏览器渲染验收等)仍未完成。已知的相邻缺口:条目的 path 最长可达 2048 字符,因此 128 个长路径生成的 manifest 可能超过 serve_hosted 读取时 64KiB 的上限。本 PR 没有处理这一点,留作后续切片。

hosting.deploy accepted an unbounded entry list and traversed, authorized and
materialized every source before the capacity check, while preview was already
capped at 128. Share the bound so a deployment never exceeds what could have
been previewed, keeping the published v1 wire schema unchanged.

Co-authored-by: Cursor <cursoragent@cursor.com>
Copilot AI lite review requested due to automatic review settings September 28, 2026 15:53

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 28, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
🔒 Security Review ✅ Completed 2026-09-28T15:57:14.328175Z c830caa PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@LIghtJUNction
LIghtJUNction merged commit 09b961a into main Sep 28, 2026
11 checks passed
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