Add optional service-account-backed dynamic tokens to avoid per-request bot users

未关闭
#126 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
5/5
预计耗时
一周以上
新手友好度
35/100
Issue 类型
功能
描述清晰度
基本清楚
活跃度
活跃
技术栈
gitlab, go

调研方向

Start by reviewing the existing role lifecycle, project/group token issuance, lease revocation, and deletion behavior, then compare the constraints with related issue #117. Done means an explicit service-account mode supports idempotent provisioning, independent tokens, preserved scopes and TTLs, documented prerequisites and lifecycle behavior, and tests and documentation covering the acceptance criteria.

由索引模型根据 Issue 内容生成。

描述

enhancement

Problem

The plugin currently creates a GitLab project or group access token for every dynamic credential request. GitLab creates a new bot user for each of those tokens and retains the user for a configurable period after the token becomes inactive. Repeated credential requests therefore create identity churn and can clutter project or group membership.

Token rotation, as proposed in #117, does not fully solve this use case because rotating a token immediately revokes its predecessor. Concurrent jobs reading the same Vault role need independently revocable credentials that remain valid for their own leases.

Proposed feature

Add an opt-in role mode that uses a stable GitLab service account as the identity for dynamic credentials.

When a role is created or updated, the plugin should be able to:

  1. Create or locate a service account for the configured project or group.
  2. Persist the service account identifier with the role.
  3. Ensure that the service account has the configured project/group membership and access level.

When credentials are requested from that role, the plugin should create a new short-lived token for the existing service account rather than creating a new project/group access token and bot user.

The existing project/group access-token behavior should remain the default for backward compatibility.

An illustrative configuration could be:

token_type = "project-service-account"
service_account_name = "vault-{{ .role_name }}"

The exact option names and role schema are open for discussion.

Required behavior

  • Service-account provisioning is idempotent. Reapplying or updating a role reuses the same account.
  • Concurrent credential requests create independent tokens under the same service account.
  • Issuing or revoking one leased token does not revoke tokens held by other jobs.
  • Generated tokens preserve the configured scopes, TTL, and lease revocation behavior.
  • The plugin handles create/update races without producing duplicate service accounts.
  • Existing roles continue to use project/group access tokens unless the new mode is explicitly selected.
  • Errors clearly identify missing GitLab version, license, or permission prerequisites.
  • Role reads expose the managed service account identity without exposing secrets.
  • Role deletion has documented service-account lifecycle behavior. Destructive cleanup should require an explicit option or separate operation.

Acceptance criteria

  • Project-backed service-account tokens are supported on compatible GitLab versions.
  • Group-backed service-account tokens are supported where the GitLab API permits them.
  • Multiple simultaneous reads of one role return usable tokens associated with one service-account user.
  • Revoking one Vault lease leaves other active leases usable.
  • Reapplying the same role does not create another service account.
  • Unit and acceptance tests cover provisioning, concurrent issuance, revocation, updates, and deletion behavior.
  • Documentation covers permissions, GitLab-version requirements, migration, and rollback.

Design considerations

  • Should the plugin create the service account itself, or optionally accept the username/ID of a pre-provisioned account?
  • How should membership/access-level drift be reconciled?
  • What should happen if the configured account name already exists but was not created by this plugin?
  • Can this share a common token_type model with user, project, and group service accounts?

Related

  • #117 proposes rotating an existing project access token. Rotation is useful for other cases, but its immediate revocation semantics make it unsafe as the sole solution for parallel CI jobs.
主要语言
Go
星标
63
派生
12
PR 合并指标
30 天内没有已合并 PR

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

splunk/vault-plugin-secrets-gitlab 的其他 Issue

查看 splunk/vault-plugin-secrets-gitlab 的全部 Issue

相似的 Issue

更多 Go Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。