GitHub App 多项改进:新增最小权限、安装管理、离线访问与凭据管理
GitHub App improvements for least privilege and management
GitHub 开发者与管理员注意:新增细粒度权限与安装管理 API 可显著降低 PAT 权限风险,建议评估现有自动化并迁移至最小权限模型;offline_access 支持为逐步启用令牌过期提供路径。
We’re releasing several GitHub Apps improvements today that help developers move off of classic PATs, improve GitHub App management, and request fewer sensitive permissions. We’ve also made it easier for repository administrators to use apps that their administrators have approved and updated the GitHub App credential management UI in advance of our planned workload federation features.
我们今天发布了多项 GitHub Apps 改进,帮助开发者摆脱经典 PAT,改进 GitHub App 管理,并减少敏感权限的请求。我们还让仓库管理员更容易使用其管理员已批准的应用,并在计划的工作负载联合功能之前更新了 GitHub App 凭据管理界面。
New repository creation and installation management permissions
新的仓库创建和安装管理权限
Two new repository fine-grained permissions have been added, available to both fine-grained PATs and GitHub Apps.
新增了两个仓库级细粒度权限,适用于细粒度 PAT 和 GitHub Apps。
- repository_creation:write: Allows the caller to create a repository in the account where it’s granted.
- installation_repositories: write: Allows the caller to add or remove that repository from an installation in the organization.
- repository_creation:write:允许调用者在授予该权限的账户中创建仓库。
- installation_repositories:write:允许调用者在组织中向安装添加或移除该仓库。
Create a repository without repository_administration
无需 repository_administration 即可创建仓库
You can now use the repository_creation:write permission to create repositories without needing the broader repository_administration:write permission.
现在您可以使用 repository_creation:write 权限创建仓库,而无需更广泛的 repository_administration:write 权限。
Previously, an app or PAT needed repository_administration:write to create a repository. That permission also grants other repository administration features like deletion and transfer. This could lead to administrators rejecting apps, banning PATs with this permission, or having to accept the over-privilege risk.
以前,应用或 PAT 需要 repository_administration:write 才能创建仓库。该权限还授予其他仓库管理功能,如删除和转移。这可能导致管理员拒绝应用、禁止具有此权限的 PAT,或者不得不接受过度权限的风险。
The new permission supports a least-privilege approach by granting only the ability to create repositories. When the repository is created, the app or user that created it will be given access to it. An app using this permission still requires an organization administrator to install the app.
新权限支持最小权限原则,仅授予创建仓库的能力。当仓库创建后,创建它的应用或用户将获得对该仓库的访问权限。使用此权限的应用仍需要组织管理员安装该应用。
See the API docs for repository creation in organizations, from a template, for the current user, with a fork, and via GraphQL.
请参阅 API 文档,了解在组织中、从模板、为当前用户、通过 fork 以及通过 GraphQL 创建仓库的详细信息。
Manage installation repositories with an app or fine-grained PAT
使用应用或细粒度 PAT 管理安装仓库
The Add a repository to an installation organization-level API and its corresponding removal API now support GitHub Apps and fine-grained PATs. Previously, these APIs only supported the coarse-grained repo scope.
向安装添加仓库的组织级 API 及其对应的移除 API 现在支持 GitHub Apps 和细粒度 PAT。以前,这些 API 仅支持粗粒度的 repo 范围。
These APIs support a new repository-level fine-grained permission:installation_repositories:write. Having this permission on a repository allows the caller to add or remove that repository from any installation in the organization. If the caller is a user, they must also be an organization owner or an administrator on the repository in question.
这些 API 支持新的仓库级细粒度权限:installation_repositories:write。在仓库上拥有此权限允许调用者在组织中的任何安装中添加或移除该仓库。如果调用者是用户,则他们还必须同时是组织所有者或该仓库的管理员。
This allows organizations to build automation that controls which repositories are accessible to which GitHub Apps without relying on an administrator’s PAT with broad permissions.
这使得组织能够构建自动化,控制哪些 GitHub App 可以访问哪些仓库,而无需依赖具有广泛权限的管理员 PAT。
Repository administrators can more easily add approved GitHub Apps to repositories
仓库管理员可以更轻松地将已批准的 GitHub App 添加到仓库中
Historically, all apps that requested organization-level access were blocked from being installed on a repository by a repository administrator, no matter what. This restriction has been relaxed in the case where the app is already installed in the organization, meaning it’s been approved by an organization owner for that organization-level access. Repository administrators can now edit an existing installation to add their repositories to an app without requiring organization owner approval. The apps already have the organization-level access, so adding them to another repository in the organization doesn’t increase that access or give the repository administrator additional privileges.
历史上,所有请求组织级访问权限的应用,无论何种情况,都会被仓库管理员阻止安装到仓库中。这一限制在应用已安装到组织中的情况下已放宽,这意味着组织所有者已批准该应用的组织级访问权限。仓库管理员现在可以编辑现有安装,将他们的仓库添加到应用中,而无需组织所有者批准。这些应用已经拥有组织级访问权限,因此将它们添加到组织中的另一个仓库并不会增加该访问权限,也不会给仓库管理员带来额外的特权。
With the addition of the repository_creation permission above, there are now three sensitive permission sets that require organization owner approval:
随着上述 repository_creation 权限的加入,现在有三组敏感权限需要组织所有者批准:
- All organization-level permissions
- Repository administration
- Repository creation
- 所有组织级权限
- 仓库管理
- 仓库创建
This change allows repository administrators to better use apps that are already approved for use in their organization.
这一更改使仓库管理员能够更好地使用已获准在其组织中使用的应用。
If you’d like to prevent repository administrators from adding apps to their repositories, see “Restricting GitHub App Installation to Organization Owners” in the docs. For more details on adding an app to a repository, see “Installing a GitHub App“.
如果您希望阻止仓库管理员将应用添加到他们的仓库,请参阅文档中的“将 GitHub App 安装限制为组织所有者”。有关将应用添加到仓库的更多详细信息,请参阅“安装 GitHub App”。
Use offline_access with GitHub Apps to gradually reenable short-lived, rotating tokens
使用 GitHub App 的 offline_access 逐步重新启用短期轮换令牌
GitHub Apps now support the offline_access scope, like OAuth apps. While GitHub Apps use short-lived, rotating tokens by default, some developers have disabled expiration for convenience and now struggle to reenable it.
GitHub App 现在支持 offline_access 范围,与 OAuth 应用一样。虽然 GitHub App 默认使用短期轮换令牌,但一些开发者为了方便而禁用了过期功能,现在却难以重新启用。
This support helps app developers gradually migrate to expiring user access tokens. Developers can enable token expiration for testing and rollout without having to switch every user to expiring tokens at the same time, which would break existing clients.
这一支持帮助应用开发者逐步迁移到过期的用户访问令牌。开发者可以启用令牌过期进行测试和逐步推出,而无需同时将所有用户切换到过期令牌,这可能会破坏现有客户端。
When offline_access is requested, the app receives a refresh token in addition to the expiring access token. It only changes that specific authentication and doesn’t impact future sessions.
当请求 offline_access 时,应用除了获得过期的访问令牌外,还会收到一个刷新令牌。它只改变该特定的认证,不会影响未来的会话。
The scope parameter is still otherwise unused for GitHub Apps—permissions are still statically selected on the application registration. For more details, see “Refreshing user access tokens“.
scope 参数在 GitHub App 中仍然未被使用——权限仍然在应用注册时静态选择。有关更多详细信息,请参阅“刷新用户访问令牌”。
This is available in GHES 3.23.
此功能在 GHES 3.23 中可用。
GitHub Apps can fetch details about other private and internal apps
GitHub 应用现在可以获取其他私有和内部应用的详细信息。
GitHub Apps can now use the Get an app API to fetch details about private and internal GitHub Apps, as long as they share some ownership.
GitHub 应用现在可以使用“获取应用”API 来获取私有和内部 GitHub 应用的详细信息,只要它们共享某些所有权。
The permitted access patterns are:
允许的访问模式如下:
- Public apps: Any other app can fetch the app’s details. This was the previously enabled level of access.
- Apps in the same organization: Apps can fetch each other’s details regardless of visibility, if they share the same owner.
- Internal apps in the same enterprise: An internal app’s details can be fetched by another app in the same enterprise, even across organization boundaries.
- Enterprise-to-organization access: An enterprise-owned app can fetch details about apps owned by organizations in the same enterprise.
- 公共应用:任何其他应用都可以获取该应用的详细信息。这是之前已启用的访问级别。
- 同一组织中的应用:如果应用共享同一所有者,无论可见性如何,它们都可以获取彼此的详细信息。
- 同一企业中的内部应用:同一企业中的另一个应用可以获取内部应用的详细信息,即使跨越组织边界也可以。
- 企业到组织的访问:企业拥有的应用可以获取同一企业中组织拥有的应用的详细信息。
This enables organizations and enterprises to automate more of their GitHub App auditing and administration.
这使得组织和企业能够更自动化地管理其 GitHub 应用的审计和管理工作。
For more details about app visibility, see “Making a GitHub App public or private“.
有关应用可见性的更多详细信息,请参阅“将 GitHub 应用设为公共或私有”。
A new credential management tab for GitHub Apps
GitHub 应用的新凭据管理选项卡
GitHub App credentials are now managed from a dedicated Credentials tab instead of appearing inline with the rest of the app configuration. This makes credentials easier to find and manage, and sets aside space for our upcoming workload federation credentials.
GitHub 应用凭据现在从专用的“凭据”选项卡进行管理,而不是与其余应用配置内联显示。这使得凭据更易于查找和管理,并为即将推出的工作负载联合凭据预留了空间。
These improvements will be available in GHES 3.24, with the exception of offline_access support, which will be included in GHES 3.23.
这些改进将在 GHES 3.24 中提供,但 offline_access 支持除外,该支持将包含在 GHES 3.23 中。
Let us know what you think in the GitHub Community.
请在 GitHub 社区中告诉我们您的想法。
更进一步:量化金融体系
看懂新闻只是起点——沿量化金融路径,把它变成能交付的工程能力