Narrow GitHub access to the project's repository: GitHub App instead of OAuth 'repo' scope
维护者通常 1 天内回复
还没有人认领这个 Issue。
- #327 来自 @satyagyasingh —— 已关闭,未合并
评估
- 难度
- 5/5
- 预计耗时
- 一周以上
- 新手友好度
- 12/100
- Issue 类型
- 功能
- 描述清晰度
- 基本清楚
- 活跃度
- 活跃
- 技术栈
- github, javascript
调研方向
Start with the OAuth scope in src/oauth/provider.js, then how the lent credential (keys.projectGhCred) is read in src/oauth/member-access.js and lend-decision.js. The design choices are still open, so settle them in the thread before coding. Done means a token for project A is refused on project B, uninstalling cuts access within one request, and docs/mcp-hosted-setup.md covers app setup.
由索引模型根据 Issue 内容生成。
描述
Problem
The hosted connector signs people in through a GitHub OAuth App with scope repo read:user user:email (src/oauth/provider.js:32). GitHub OAuth Apps can't be limited to one repository: repo grants read and write on every repository the user can reach, public and private, personal and organisation.
That matters most for the credential a manager lends to the project (#50, stored as keys.projectGhCred in the deployment's KV). Google-signed-in members and agent tokens reach the project through it, so the deployment holds a long-lived token that can read and write all of that manager's repositories, not just the project's.
For a team running its own deployment this is its own infrastructure, but it's still far wider access than the product needs. It's the one place where teamctx's "data stays in storage the team controls" position depends on trusting a credential much broader than the project. A leak of the deployment's KV exposes every repository the lender can reach.
Proposed solution
Move GitHub access to a GitHub App installed on only the project's repository (or a chosen set):
- Installation tokens are short-lived (1 hour), limited to the repositories where the app is installed, with fine-grained permissions (Contents: read/write, Metadata: read, and Members: read if needed for roster checks).
- Lending becomes installing: the manager installs the app on the project repository. The deployment stores the installation ID, not a user token, and creates tokens on demand. Stopping lending means uninstalling the app on GitHub, which cuts access immediately.
- Signing in people's identity uses GitHub App user-to-server tokens, which are also limited to the installation's repositories, or stays on OAuth for identity only (
read:user user:email, norepo). - Keep the OAuth App path working during migration, and treat the
reposcope as legacy with a deprecation note on the settings page.
Existing open source first
- GitHub Apps are a GitHub platform feature, so there's nothing to build for the permission model itself.
@octokit/auth-app(MIT) handles app JWTs, installation tokens and caching.@octokit/app/octokitcover webhook and installation handling if needed. Use these instead of hand-writing JWT signing or token refresh.- What teamctx builds: the settings-page "install on this repository" step, and mapping a project to its installation ID in
src/oauth/member-access.js/lend-decision.js(replacingprojectGhCred).
Sub-questions for the plan
- Self-hosters must register their own GitHub App. That's a setup cost like the OAuth App step in
docs/mcp-hosted-setup.md, so document it the same way. - Manager checks (#86 handoff, step-out checks) currently reason about "the person lending". With an app installation, the lender is the repository, not a person, so decide how those checks apply.
- Rate limits: installation tokens have their own limit per installation. Confirm this is equal or better for busy projects.
Acceptance
- A lent project's stored credential can only reach that project's repository, and a test proves that a token created for project A is refused on project B.
- Uninstalling the app cuts off Google members' and agents' access within one request.
docs/mcp-hosted-setup.mdexplains setting up the app.
- 主要语言
- JavaScript
- 星标
- 1
- 派生
- 2
- 平均合并
- 1 天 19 小时
- 30 天内合并 PR
- 62
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
StatsLateral/teamctx 的其他 Issue
-
Sign-in page: label GitHub as for Team Managers and Google as for Team Members可能已有人在做 @StatsLateral 今天认领。 未关闭enhancement
难度 2/5 1-3 小时 新手友好度 76/100
StatsLateral/teamctx#343 · 1 条评论 ·
维护者通常 1 天内回复
-
enhancement
难度 2/5 1-3 小时 新手友好度 76/100
StatsLateral/teamctx#342 ·
维护者通常 1 天内回复
-
enhancement parked
难度 5/5 一周以上 新手友好度 35/100
StatsLateral/teamctx#341 ·
维护者通常 1 天内回复
-
Let a manager delete a task before anyone has worked on it, and archive it after可能已有人在做 @satyagyasingh 于 14 天前认领。 未关闭enhancement
难度 4/5 3-5 天 新手友好度 45/100
StatsLateral/teamctx#320 ·
维护者通常 1 天内回复
-
enhancement
难度 5/5 一周以上 新手友好度 25/100
StatsLateral/teamctx#301 ·
维护者通常 1 天内回复
查看 StatsLateral/teamctx 的全部 Issue
相似的 Issue
-
Entity picker filter keeps the first kind's groups after switching Specific Term / Specific Post未关闭bug
难度 2/5 1-3 小时 新手友好度 78/100
davidofchatham/bws-gb-dynamic-tags-extensions#177 ·
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 86/100
ioBroker/ioBroker.zigbee#3069 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
-
has-image has-license has-readme new-tool ready-to-approve repo-verified
难度 1/5 1 小时以内 新手友好度 78/100
shanselman/TinyToolTown#957 ·
维护者通常 2 天内回复
-
triage
难度 2/5 1-3 小时 新手友好度 76/100
ionic-team/capacitor#8759 ·
维护者通常 1 天内回复