Gitlab 私有令牌自动滚动

Gitlab private token automatic rolling

我正在尝试从代码连接 gitlab api 以下载工件。 为此,我需要生成一个私有访问令牌并将其与请求一起发送。 我不想设置永久令牌,因为它不安全,所以我试图找到一些 api 来删除并在旧令牌过期时生成新令牌,但我找不到任何东西。 我也尝试使用 deploy-tokens 但它没有 gitlab api.

的权限

有什么建议吗?

这还不可能,但他们已经打开了一个问题来添加它

你可以关注这里的讨论https://gitlab.com/gitlab-org/gitlab/-/issues/17176

I don't want to set a permanent token because it is not secure

13.3 gitlab version there is available Project access tokens, which let you opportunity to issue a token for a specific project and limit it's scope。所以这绝对比使用自己的私人令牌更好

Project level access tokens allow access to a project without the need to provision a new GitLab user. Project access tokens can be generated by project Maintainers or Owners and be used to authenticate with the GitLab API. Project access tokens will be authorized as Maintainers. This new functionality will make programmatic access to GitLab easier and more secure.


上一个回答

如果创建仅对所需存储库(我们要从中下载工件)具有权限的额外用户并为此用户发布 personal-token,可能会不那么不安全。因此,即使令牌会被泄露,攻击者也只能下载工件。