fix(czdev): 修复 403 权限校验并改为包名先到先得的所有权模型#14
Merged
Conversation
- check_permission: query `GET /repos/{owner}/{repo}` permissions instead of
the collaborators/{user}/permission endpoint, which requires push access and
returned 403 Forbidden for external contributors — breaking the intended
fork+PR fallback (the "Error: permission status" failure).
- publish: stop requiring the deb Maintainer email to match the uploader's
GitHub verified emails. Record the uploader (`uploaded_by` login +
`uploader_email`) in the release manifest instead.
- unpublish: enforce ownership by the recorded uploader login (with a legacy
fallback deriving the login from the binary's Maintainer noreply address)
rather than email matching.
- remove the Rust czdev release workflow; publishing is Python-only now.
Co-authored-by: Cursor <cursoragent@cursor.com>
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.
背景
同事用
czdev publish上传 deb 时报错:根因:
check_permission调用的GET /repos/{owner}/{repo}/collaborators/{username}/permission端点要求调用者本身对该仓库有 push 权限,外部贡献者没有权限时返回 403(而非 404),代码只处理了 404,导致本该"fork + PR"的分支永远走不到。改动
GET /repos/{owner}/{repo}返回的permissions字段判断登录用户权限,任何能看到仓库的用户都能拿到,不需要 push 权限;403/404 一律视为无权限,正常进入 fork 流程。uploaded_by/uploader_email字段。uploaded_by时,从旧 deb 的 Maintainer noreply 邮箱反推 login)。release-czdev.yml):发布链路统一走 Python,杜绝再分发带旧 publish 逻辑的 Rust 二进制。配套 PR(跨仓库)
同一套所有权模型需要在服务端权威校验处同步(否则 CLI PR 仍会被 CI 拦):
CardputerZero/packages的validate-pr.ymlCardputerZero/dev-portal的 Worker 与packages-workflows/*Made with Cursor