Documentation
¶
Overview ¶
Package gitlablifecycle implements GitLab-specific role ownership, credential attribution and trigger-owner transport. Repository policy owns elevation ordering, safety decisions, containment and project leases.
The live TriggerOwner deliberately does not implement repos.GitLabPollerQuiescenceVerifier: GitLab offers no server-side drain barrier for requests accepted with revoked credentials, so the current Poller is never re-elevated. It implements repos.GitLabPollerHandoff instead (poller_handoff.go): a fresh service account mints the webhook trigger, is demoted to Developer and verified, and only then receives a runtime credential. Any ineligible or ambiguous state defers the fast path and polling remains the dispatch path.
Index ¶
- func PollerCredentialRejected(err error) bool
- func RoleTokenName(role gitlabroles.Role) string
- type TriggerAccountAPI
- func (a TriggerAccountAPI) AccountActiveJobIDs(ctx context.Context, owner, repo string, userID int) ([]int, error)
- func (a TriggerAccountAPI) AccountSSHKeyIDs(ctx context.Context, userID int) ([]int, error)
- func (a TriggerAccountAPI) AccountScheduleIDs(ctx context.Context, owner, repo string, userID int) ([]int, error)
- func (a TriggerAccountAPI) AddProjectMember(ctx context.Context, owner, repo string, userID int64, accessLevel int) error
- func (a TriggerAccountAPI) CreateProjectServiceAccount(ctx context.Context, owner, repo, name string) (repos.GitLabServiceAccount, error)
- func (a TriggerAccountAPI) CreateServiceAccountPAT(ctx context.Context, owner, repo string, userID int, name string, ...) (*repos.ProjectAccessToken, error)
- func (a TriggerAccountAPI) DeleteProjectDeployKey(ctx context.Context, owner, repo string, keyID int) error
- func (a TriggerAccountAPI) DeleteProjectServiceAccount(ctx context.Context, owner, repo string, userID int) error
- func (a TriggerAccountAPI) GetProjectMemberAccessLevel(ctx context.Context, owner, repo string, userID int64) (int, error)
- func (a TriggerAccountAPI) GrantProtectedBranchPushDeployKey(ctx context.Context, owner, repo, branch string, deployKeyID int) error
- func (a TriggerAccountAPI) HasExactProtectedBranchRule(ctx context.Context, owner, repo, branch string) (bool, error)
- func (a TriggerAccountAPI) ListPipelineTriggerTokens(ctx context.Context, owner, repo string) ([]forge.PipelineTriggerToken, error)
- func (a TriggerAccountAPI) ListProjectDeployKeys(ctx context.Context, owner, repo string) ([]repos.GitLabDeployKey, error)
- func (a TriggerAccountAPI) ListProjectServiceAccounts(ctx context.Context, owner, repo string) ([]repos.GitLabServiceAccount, error)
- func (a TriggerAccountAPI) ListServiceAccountPATs(ctx context.Context, owner, repo string, userID int) ([]repos.ProjectAccessToken, error)
- func (a TriggerAccountAPI) ProtectedBranchPushDeployKeyEntryID(ctx context.Context, owner, repo, branch string, deployKeyID int) (int, error)
- func (a TriggerAccountAPI) RevokePipelineTriggerToken(ctx context.Context, owner, repo string, tokenID int64) error
- func (a TriggerAccountAPI) RevokeProtectedBranchPushDeployKeyEntry(ctx context.Context, owner, repo, branch string, entryID, deployKeyID int) error
- func (a TriggerAccountAPI) RevokeServiceAccountPAT(ctx context.Context, owner, repo string, userID, tokenID int) error
- func (a TriggerAccountAPI) UnknownOwnerScheduleIDs(ctx context.Context, owner, repo string) ([]int, error)
- func (a TriggerAccountAPI) UpdateProjectMemberAccessLevel(ctx context.Context, owner, repo string, userID int64, accessLevel int) error
- type TriggerOwner
- func (o *TriggerOwner) AttributeSuppliedRole(ctx context.Context, owner, repo string, role gitlabroles.Role) (int64, error)
- func (o *TriggerOwner) ContainPoller(ctx context.Context, owner, repo string, userID int64) error
- func (o *TriggerOwner) ContainmentOptions(owner, repo string, lease *repos.GitLabProjectLease) repos.GitLabTriggerAccountOptions
- func (o *TriggerOwner) CreatePipelineTriggerTokenAsPoller(ctx context.Context, owner, repo, description string, ...) (*forge.PipelineTriggerToken, error)
- func (o *TriggerOwner) CreatePipelineTriggerTokenAsReplacementPoller(ctx context.Context, owner, repo, description string, ...) (*forge.PipelineTriggerToken, error)
- func (o *TriggerOwner) CreatePollerBootstrap(ctx context.Context, owner, repo string, userID int64) (*repos.PollerBootstrap, error)
- func (o *TriggerOwner) CreatePollerRuntimeToken(ctx context.Context, owner, repo string, userID int64, expiresAt string) (*repos.PollerRuntimeToken, error)
- func (o *TriggerOwner) CreateReplacementPoller(ctx context.Context, owner, repo string) (int64, error)
- func (o *TriggerOwner) CreateReplacementPollerBootstrap(ctx context.Context, owner, repo string, userID int64) (*repos.ReplacementPollerBootstrap, error)
- func (o *TriggerOwner) CurrentSuppliedAccountIDs(ctx context.Context, owner, repo string) ([]int, error)
- func (o *TriggerOwner) EnsureReplacementPollerAccess(ctx context.Context, owner, repo string, userID int64) error
- func (o *TriggerOwner) ManagedPollerUserIDs(ctx context.Context, owner, repo string) ([]int64, error)
- func (o *TriggerOwner) PollerActiveJobIDs(ctx context.Context, owner, repo string, userID int64) ([]int, error)
- func (o *TriggerOwner) PollerSSHKeyIDs(ctx context.Context, userID int64) ([]int, error)
- func (o *TriggerOwner) PollerScheduleIDs(ctx context.Context, owner, repo string, userID int64) ([]int, error)
- func (o *TriggerOwner) PollerTriggerIDs(ctx context.Context, owner, repo string, userID int64) ([]int, error)
- func (o *TriggerOwner) PollerUserID(ctx context.Context, owner, repo string) (int64, error)
- func (o *TriggerOwner) RefuseUnknownRoleProvenance(ctx context.Context, owner, repo string, ...) error
- func (o *TriggerOwner) ResolveExcludedAccounts(ctx context.Context, owner, repo string) ([]int64, map[gitlabroles.Role]int, error)
- func (o *TriggerOwner) RevokePollerBootstrap(ctx context.Context, owner, repo string, userID int64) error
- func (o *TriggerOwner) RevokePollerRuntimeCredentials(ctx context.Context, owner, repo string, userID int64) error
- func (o *TriggerOwner) RevokeReplacementPollerBootstrap(ctx context.Context, owner, repo string, userID int64) error
- func (o *TriggerOwner) SetProjectMemberAccessLevel(ctx context.Context, owner, repo string, userID int64, accessLevel int) error
- func (o *TriggerOwner) SuppliedAccountIDs(ctx context.Context, owner, repo string) ([]int, error)
- func (o *TriggerOwner) SuppliedPollerUserID(ctx context.Context, owner, repo string) (int64, bool, error)
- func (o *TriggerOwner) SuppliedTokenIDs(ctx context.Context, owner, repo string) (map[int][]repos.SuppliedTokenRef, error)
- func (o *TriggerOwner) TriggerAccountOptions(ctx context.Context, owner, repo, branch string, ...) (repos.GitLabTriggerAccountOptions, error)
- func (o *TriggerOwner) VerifiedPollerUserIDs(ctx context.Context, owner, repo string) ([]int, error)
- func (o *TriggerOwner) VerifyPollerCredentialsRevoked(ctx context.Context, owner, repo string, userID int64) error
- func (o *TriggerOwner) VerifyPollerElevationSafe(ctx context.Context, owner, repo string, userID int64) error
- func (o *TriggerOwner) VerifyReplacementPollerCredentialsRevoked(ctx context.Context, owner, repo string, userID int64) error
- func (o *TriggerOwner) VerifyTriggerStartsProtectedPipeline(ctx context.Context, owner, repo string, trigger *forge.PipelineTriggerToken) error
- type UninstallTokenClient
- func (u UninstallTokenClient) ContainGitLabTriggerAccountForUninstall(ctx context.Context, client forge.Client, lease *repos.GitLabProjectLease, ...) error
- func (u UninstallTokenClient) ListProjectAccessTokens(ctx context.Context, owner, repo string) ([]repos.ProjectAccessToken, error)
- func (u UninstallTokenClient) ListProjectAccessTokensStrict(ctx context.Context, owner, repo string) ([]repos.ProjectAccessToken, error)
- func (u UninstallTokenClient) ReconcileGitLabPollersForUninstall(ctx context.Context, client forge.Client, owner, repo string) error
- func (u UninstallTokenClient) RemoveGitLabTriggerAccountForUninstall(ctx context.Context, client forge.Client, lease *repos.GitLabProjectLease, ...) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func PollerCredentialRejected ¶
PollerCredentialRejected reports whether GitLab refused the installed Poller credential itself (expired, revoked, or blocked account), as opposed to a transient or unrelated failure.
func RoleTokenName ¶
func RoleTokenName(role gitlabroles.Role) string
RoleTokenName is the GitLab token name a role's credential carries: the fixed name of a built-in role, or the derived name of a custom one.
Types ¶
type TriggerAccountAPI ¶ added in v0.48.0
type TriggerAccountAPI struct {
// contains filtered or unexported fields
}
TriggerAccountAPI adapts the live GitLab client to repos.GitLabTriggerAccountAPI. Every call uses installer authority.
func NewTriggerAccountAPI ¶ added in v0.48.0
func NewTriggerAccountAPI(admin *gitlab.LiveClient) TriggerAccountAPI
NewTriggerAccountAPI binds the trigger-account lifecycle to a live client.
func (TriggerAccountAPI) AccountActiveJobIDs ¶ added in v0.48.0
func (TriggerAccountAPI) AccountSSHKeyIDs ¶ added in v0.48.0
func (TriggerAccountAPI) AccountScheduleIDs ¶ added in v0.48.0
func (a TriggerAccountAPI) AccountScheduleIDs(ctx context.Context, owner, repo string, userID int) ([]int, error)
AccountScheduleIDs matches the exact owner ID only. A schedule GitLab reported without an owner is not attributed to the account here; it is reported separately by UnknownOwnerScheduleIDs.
func (TriggerAccountAPI) AddProjectMember ¶ added in v0.48.0
func (TriggerAccountAPI) CreateProjectServiceAccount ¶ added in v0.48.0
func (a TriggerAccountAPI) CreateProjectServiceAccount(ctx context.Context, owner, repo, name string) (repos.GitLabServiceAccount, error)
func (TriggerAccountAPI) CreateServiceAccountPAT ¶ added in v0.48.0
func (TriggerAccountAPI) DeleteProjectDeployKey ¶ added in v0.48.0
func (TriggerAccountAPI) DeleteProjectServiceAccount ¶ added in v0.48.0
func (TriggerAccountAPI) GetProjectMemberAccessLevel ¶ added in v0.48.0
func (TriggerAccountAPI) GrantProtectedBranchPushDeployKey ¶ added in v0.48.0
func (TriggerAccountAPI) HasExactProtectedBranchRule ¶ added in v0.48.0
func (TriggerAccountAPI) ListPipelineTriggerTokens ¶ added in v0.48.0
func (a TriggerAccountAPI) ListPipelineTriggerTokens(ctx context.Context, owner, repo string) ([]forge.PipelineTriggerToken, error)
func (TriggerAccountAPI) ListProjectDeployKeys ¶ added in v0.48.0
func (a TriggerAccountAPI) ListProjectDeployKeys(ctx context.Context, owner, repo string) ([]repos.GitLabDeployKey, error)
func (TriggerAccountAPI) ListProjectServiceAccounts ¶ added in v0.48.0
func (a TriggerAccountAPI) ListProjectServiceAccounts(ctx context.Context, owner, repo string) ([]repos.GitLabServiceAccount, error)
func (TriggerAccountAPI) ListServiceAccountPATs ¶ added in v0.48.0
func (a TriggerAccountAPI) ListServiceAccountPATs(ctx context.Context, owner, repo string, userID int) ([]repos.ProjectAccessToken, error)
func (TriggerAccountAPI) ProtectedBranchPushDeployKeyEntryID ¶ added in v0.48.0
func (TriggerAccountAPI) RevokePipelineTriggerToken ¶ added in v0.48.0
func (TriggerAccountAPI) RevokeProtectedBranchPushDeployKeyEntry ¶ added in v0.48.0
func (TriggerAccountAPI) RevokeServiceAccountPAT ¶ added in v0.48.0
func (TriggerAccountAPI) UnknownOwnerScheduleIDs ¶ added in v0.48.0
func (a TriggerAccountAPI) UnknownOwnerScheduleIDs(ctx context.Context, owner, repo string) ([]int, error)
UnknownOwnerScheduleIDs returns the schedules GitLab reported without an owner.
func (TriggerAccountAPI) UpdateProjectMemberAccessLevel ¶ added in v0.48.0
type TriggerOwner ¶
type TriggerOwner struct {
Admin *gitlab.LiveClient
// NewClient builds a client for a token; tests override it.
NewClient func(token, baseURL string) (*gitlab.LiveClient, error)
// Now is the clock for credential expiry; tests override it.
Now func() time.Time
}
TriggerOwner mints the webhook trigger token authenticated as the Poller service account and changes the Poller's membership, all with installer authority. The Poller's distributed runtime credential (FULLSEND_GITLAB_POLLER_TOKEN) is never used to create the trigger: it is revoked before the elevation, and an installer-only bootstrap personal access token, held in memory only, authenticates the trigger creation.
func NewTriggerOwner ¶
func NewTriggerOwner(admin *gitlab.LiveClient) *TriggerOwner
NewTriggerOwner binds installer-authorized GitLab transport to the lifecycle.
func (*TriggerOwner) AttributeSuppliedRole ¶
func (o *TriggerOwner) AttributeSuppliedRole(ctx context.Context, owner, repo string, role gitlabroles.Role) (int64, error)
AttributeSuppliedRole identifies the owner of a supplied non-Poller role credential enrolled without a recorded owner by authenticating with the installed secret. A credential that is no longer installed or no longer authenticates cannot be attributed, which fails closed.
func (*TriggerOwner) ContainPoller ¶
ContainPoller revokes the managed Poller service account's active personal access tokens (runtime and bootstrap) and removes the installed Poller CI/CD secret with the admin credential when that secret's credential authenticates as this account, so a Poller that could not be returned to Developer access stops authenticating. Credentials of other identities are preserved. Every step is attempted; failures are joined. Active tokens that fullsend does not manage are left untouched but reported as incomplete containment. Token revocation and secret removal each run on their own bounded context detached from ctx, so one step exhausting its budget cannot stop the other.
func (*TriggerOwner) ContainmentOptions ¶ added in v0.48.0
func (o *TriggerOwner) ContainmentOptions(owner, repo string, lease *repos.GitLabProjectLease) repos.GitLabTriggerAccountOptions
ContainmentOptions builds the options for containment-only recovery (repos.ContainGitLabTriggerAccount). It needs no Poller inventory and carries no way to create resources: no bootstrap client and no publisher. It can only remove the token sink, so a published credential whose pipeline-variable override restriction is weakened can be contained.
func (*TriggerOwner) CreatePipelineTriggerTokenAsPoller ¶
func (o *TriggerOwner) CreatePipelineTriggerTokenAsPoller(ctx context.Context, owner, repo, description string, bootstrap *repos.PollerBootstrap) (*forge.PipelineTriggerToken, error)
CreatePipelineTriggerTokenAsPoller creates the trigger token as the Poller identity by authenticating with the bootstrap credential.
func (*TriggerOwner) CreatePipelineTriggerTokenAsReplacementPoller ¶ added in v0.48.0
func (o *TriggerOwner) CreatePipelineTriggerTokenAsReplacementPoller(ctx context.Context, owner, repo, description string, bootstrap *repos.ReplacementPollerBootstrap) (*forge.PipelineTriggerToken, error)
CreatePipelineTriggerTokenAsReplacementPoller creates the trigger token as the replacement account by authenticating with its bootstrap credential.
func (*TriggerOwner) CreatePollerBootstrap ¶
func (o *TriggerOwner) CreatePollerBootstrap(ctx context.Context, owner, repo string, userID int64) (*repos.PollerBootstrap, error)
CreatePollerBootstrap creates the installer-only bootstrap personal access token for the Poller service account with the administrator credential. Any bootstrap token left by an interrupted run is revoked first, so at most one exists. The value is returned to the caller and never stored.
func (*TriggerOwner) CreatePollerRuntimeToken ¶
func (o *TriggerOwner) CreatePollerRuntimeToken(ctx context.Context, owner, repo string, userID int64, expiresAt string) (*repos.PollerRuntimeToken, error)
CreatePollerRuntimeToken creates the replacement runtime personal access token for the Poller service account. The caller stores it.
func (*TriggerOwner) CreateReplacementPoller ¶ added in v0.48.0
func (o *TriggerOwner) CreateReplacementPoller(ctx context.Context, owner, repo string) (int64, error)
CreateReplacementPoller creates a fresh fullsend-poller project service account with no personal access token and adds it to the project at Developer access. It never changes the protected-branch rule: whether the account may start pipelines on the default branch is checked read-only by EnsureReplacementPollerAccess before the account is raised. The account ID is returned whenever the account was created, even when a later step failed. A refused or unsupported create means no account was created and is reported as forge.ErrNotFound, so the handoff defers and polling continues.
func (*TriggerOwner) CreateReplacementPollerBootstrap ¶ added in v0.48.0
func (o *TriggerOwner) CreateReplacementPollerBootstrap(ctx context.Context, owner, repo string, userID int64) (*repos.ReplacementPollerBootstrap, error)
CreateReplacementPollerBootstrap creates the installer-only bootstrap personal access token for the replacement account. Any bootstrap token left by an interrupted run is revoked first. The value is returned to the caller and never stored.
func (*TriggerOwner) CurrentSuppliedAccountIDs ¶
func (o *TriggerOwner) CurrentSuppliedAccountIDs(ctx context.Context, owner, repo string) ([]int, error)
CurrentSuppliedAccountIDs lists the accounts that own a currently installed supplied credential: the subset of the exclusions that is not merely historical, for the operational token inventory.
func (*TriggerOwner) EnsureReplacementPollerAccess ¶ added in v0.48.0
func (o *TriggerOwner) EnsureReplacementPollerAccess(ctx context.Context, owner, repo string, userID int64) error
EnsureReplacementPollerAccess idempotently establishes the replacement account's Developer membership and verifies, read-only, that the existing protected-branch policy lets it start pipelines on the default branch. The handoff runs it before every elevation attempt, so a membership or policy failure in an earlier run is retried rather than left to quarantine the generation after a trigger was minted. A policy that does not admit the account is reported as a *repos.PollerGenerationUnsafeError, which defers the handoff; fullsend never writes the branch rule for a replacement.
func (*TriggerOwner) ManagedPollerUserIDs ¶
func (o *TriggerOwner) ManagedPollerUserIDs(ctx context.Context, owner, repo string) ([]int64, error)
ManagedPollerUserIDs lists every managed Poller service account, lowest ID first, so install reconciles duplicates as uninstall does. It also lists the Poller accounts recorded in the generation document (the current, retiring, and abandoned ones), because after a cutover the previous Poller is no longer the rotation state's managed account yet its runtime credential stays valid until retirement. Supplied-account exclusions apply to those as well. This inventory is for reconciliation only: selecting the runtime Poller identity still uses the rotation state's managed account alone (see managedPollerIDs).
func (*TriggerOwner) PollerActiveJobIDs ¶
func (o *TriggerOwner) PollerActiveJobIDs(ctx context.Context, owner, repo string, userID int64) ([]int, error)
PollerActiveJobIDs returns the IDs of unfinished project jobs that run as the Poller (or as a user GitLab did not report).
func (*TriggerOwner) PollerSSHKeyIDs ¶
PollerSSHKeyIDs returns the IDs of the Poller account's usable SSH authentication keys.
func (*TriggerOwner) PollerScheduleIDs ¶
func (o *TriggerOwner) PollerScheduleIDs(ctx context.Context, owner, repo string, userID int64) ([]int, error)
PollerScheduleIDs returns the IDs of pipeline schedules owned by the Poller (or by a user GitLab did not report).
func (*TriggerOwner) PollerTriggerIDs ¶
func (o *TriggerOwner) PollerTriggerIDs(ctx context.Context, owner, repo string, userID int64) ([]int, error)
PollerTriggerIDs lists all trigger resources owned by the identity, including those whose owner GitLab omits. Unlike the unmanaged query, it includes the managed webhook trigger and is suitable for account-deletion verification.
func (*TriggerOwner) PollerUserID ¶
PollerUserID identifies the fullsend-managed fullsend-poller project service account from the administrator's service-account inventory, so identification does not depend on the distributed runtime credential, which is revoked during every trigger-creation transaction. A credential that is installed and still authenticates must belong to that managed account and be its managed personal access token: a Poller enrolled as a human's personal access token (--gitlab-role-token) or a project access token bot reports forge.ErrNotFound, so install never changes a person's membership or replaces an administrator-supplied credential. A missing, expired, revoked, or blocked installed credential cannot say who it is; the managed account is then taken from the inventory alone, which is how an interrupted run is recovered.
func (*TriggerOwner) RefuseUnknownRoleProvenance ¶
func (o *TriggerOwner) RefuseUnknownRoleProvenance(ctx context.Context, owner, repo string, provs map[gitlabroles.Role]repos.RoleProvenance) error
RefuseUnknownRoleProvenance fails closed when a registered non-Poller own-credential role has an installed secret but rotation state does not establish who provisioned it. The roles come from the trusted registry, not from the rotation document, so a role with no entry at all is still examined. The Poller's own unknown provenance is handled by SuppliedPollerUserID.
func (*TriggerOwner) ResolveExcludedAccounts ¶
func (o *TriggerOwner) ResolveExcludedAccounts(ctx context.Context, owner, repo string) ([]int64, map[gitlabroles.Role]int, error)
ResolveExcludedAccounts is excludedAccountIDs that also returns the owners it attributed by authenticating, keyed by role, for supplied credentials whose rotation entry did not record one. Callers that are about to delete those credentials persist them so a retry does not need the credential again.
func (*TriggerOwner) RevokePollerBootstrap ¶
func (o *TriggerOwner) RevokePollerBootstrap(ctx context.Context, owner, repo string, userID int64) error
RevokePollerBootstrap revokes every active bootstrap personal access token of the Poller service account and verifies that none remains active. It finds orphans by token name, so no secret value has to be persisted.
func (*TriggerOwner) RevokePollerRuntimeCredentials ¶
func (o *TriggerOwner) RevokePollerRuntimeCredentials(ctx context.Context, owner, repo string, userID int64) error
RevokePollerRuntimeCredentials invalidates the distributed Poller runtime credential with installer authority. The CI/CD variable is removed first, so a run interrupted afterwards leaves the secret absent and the next install provisions a replacement instead of trusting a dead value. The managed runtime personal access tokens are then revoked and their revocation is verified: removing the variable alone would leave copies held by running jobs valid. Credentials fullsend does not manage are never touched.
func (*TriggerOwner) RevokeReplacementPollerBootstrap ¶ added in v0.48.0
func (o *TriggerOwner) RevokeReplacementPollerBootstrap(ctx context.Context, owner, repo string, userID int64) error
RevokeReplacementPollerBootstrap revokes every active bootstrap personal access token of the replacement account and verifies none remains active.
func (*TriggerOwner) SetProjectMemberAccessLevel ¶
func (o *TriggerOwner) SetProjectMemberAccessLevel(ctx context.Context, owner, repo string, userID int64, accessLevel int) error
SetProjectMemberAccessLevel changes the Poller's direct project membership with the installer credential.
func (*TriggerOwner) SuppliedAccountIDs ¶
SuppliedAccountIDs lists the service accounts that own administrator-supplied credentials, for the shared token client's exclusions.
func (*TriggerOwner) SuppliedPollerUserID ¶
func (o *TriggerOwner) SuppliedPollerUserID(ctx context.Context, owner, repo string) (int64, bool, error)
SuppliedPollerUserID returns the user that owns the installed Poller credential when rotation state records that credential as administrator-supplied. supplied is false when the credential is managed or there is no installed credential. The owner recorded at enrollment is used without authenticating, so an expired or revoked supplied credential keeps its owner's account excluded and can be replaced through the normal path. Unknown provenance is not "managed": when a Poller credential is installed but rotation state has no record of it, or a supplied credential has no recorded owner and cannot be attributed by authenticating, the result is an error wrapping repos.ErrPollerSuppliedUnresolved and the caller fails closed instead of treating a same-named account as managed.
func (*TriggerOwner) SuppliedTokenIDs ¶
func (o *TriggerOwner) SuppliedTokenIDs(ctx context.Context, owner, repo string) (map[int][]repos.SuppliedTokenRef, error)
SuppliedTokenIDs maps each supplied owner account to the token IDs of the credentials enrolled for it, from rotation state. An owner whose enrolled credential has no recorded token ID for any role is omitted, so every token of its account stands in for the credential. Each token carries the token name of the role it was enrolled for.
func (*TriggerOwner) TriggerAccountOptions ¶ added in v0.48.0
func (o *TriggerOwner) TriggerAccountOptions(ctx context.Context, owner, repo, branch string, lease *repos.GitLabProjectLease) (repos.GitLabTriggerAccountOptions, error)
TriggerAccountOptions builds the lifecycle options for one project: the live API adapter, the verified Poller inventory, the project lease the caller holds, the bootstrap client factory, and the trigger-token sink.
The sink is the masked, protected CI/CD variable FULLSEND_GITLAB_TRIGGER_ACCOUNT_TOKEN. No pipeline reads it until #8438 activates the dispatch route. A value is accepted only after GitLab reports the variable masked, protected, not file-typed and not environment-scoped; otherwise it is deleted and publication fails, so the ledger keeps the obligation and a re-run revokes the token and publishes a replacement. The name is reserved to this lifecycle and only ever deleted while the ledger exists.
func (*TriggerOwner) VerifiedPollerUserIDs ¶ added in v0.48.0
func (o *TriggerOwner) VerifiedPollerUserIDs(ctx context.Context, owner, repo string) ([]int, error)
VerifiedPollerUserIDs is the authoritative Poller identity inventory the trigger account is kept separate from: every managed Poller service account, including the current, retiring and abandoned Poller generations recorded in FULLSEND_GITLAB_POLLER_GENERATIONS, plus every account that owns an administrator-supplied role credential. A project with no Poller account at all is a verified empty inventory (ErrNotFound); any other failure to read the inventory is returned so the caller stops instead of guessing.
func (*TriggerOwner) VerifyPollerCredentialsRevoked ¶
func (o *TriggerOwner) VerifyPollerCredentialsRevoked(ctx context.Context, owner, repo string, userID int64) error
VerifyPollerCredentialsRevoked rejects every active PAT, including managed names, after runtime revocation and before bootstrap creation.
func (*TriggerOwner) VerifyPollerElevationSafe ¶
func (o *TriggerOwner) VerifyPollerElevationSafe(ctx context.Context, owner, repo string, userID int64) error
VerifyPollerElevationSafe refuses elevation unless every active credential of the Poller account is accounted for: personal access tokens must be the managed runtime credential or the installer's bootstrap credential (both revoked by the install itself before the elevation), pipeline trigger tokens must be the managed ones, and the account must have no usable SSH authentication key and no unfinished job may run as the Poller (job tokens outlive the revocation of the account's tokens). Failure containment cannot revoke credentials fullsend does not manage, and they would gain Maintainer access during the create window. An inventory that cannot be read fails closed.
func (*TriggerOwner) VerifyReplacementPollerCredentialsRevoked ¶ added in v0.48.0
func (o *TriggerOwner) VerifyReplacementPollerCredentialsRevoked(ctx context.Context, owner, repo string, userID int64) error
VerifyReplacementPollerCredentialsRevoked requires that the replacement account holds no active personal access token, no unmanaged pipeline trigger, no usable SSH key, no unfinished job, and no pipeline schedule. Managed token names are not evidence of revocation.
func (*TriggerOwner) VerifyTriggerStartsProtectedPipeline ¶ added in v0.48.0
func (o *TriggerOwner) VerifyTriggerStartsProtectedPipeline(ctx context.Context, owner, repo string, trigger *forge.PipelineTriggerToken) error
VerifyTriggerStartsProtectedPipeline proves, after demotion, that the trigger's owner is at exactly Developer access and that the existing protected-branch policy lets it start pipelines on the default branch. It reads the policy and never changes it, and it does not start a pipeline, so no dispatcher job runs as a side effect of the probe.
type UninstallTokenClient ¶
type UninstallTokenClient struct {
repos.ServiceAccountTokenClient
// contains filtered or unexported fields
}
UninstallTokenClient is the role token client for uninstall. In addition to the shared inventory it reconciles every managed Poller service account (duplicates included) before credential cleanup. It also retains, per project, the account that owns an administrator-supplied Poller credential so reconciliation and revocation leave that account and its tokens alone.
func NewUninstallTokenClient ¶
func NewUninstallTokenClient(admin *gitlab.LiveClient, role repos.ServiceAccountTokenClient) UninstallTokenClient
NewUninstallTokenClient adds uninstall reconciliation and durable supplied attribution caching to the role inventory configured by the caller.
func (UninstallTokenClient) ContainGitLabTriggerAccountForUninstall ¶ added in v0.48.0
func (u UninstallTokenClient) ContainGitLabTriggerAccountForUninstall(ctx context.Context, client forge.Client, lease *repos.GitLabProjectLease, owner, repo string) error
ContainGitLabTriggerAccountForUninstall revokes an interrupted bootstrap's tokens and restores Developer access under the project lease the uninstall holds. It needs no Poller inventory, creates nothing and removes nothing.
func (UninstallTokenClient) ListProjectAccessTokens ¶
func (u UninstallTokenClient) ListProjectAccessTokens(ctx context.Context, owner, repo string) ([]repos.ProjectAccessToken, error)
ListProjectAccessTokens is the shared inventory without the tokens of an administrator-supplied Poller account.
func (UninstallTokenClient) ListProjectAccessTokensStrict ¶
func (u UninstallTokenClient) ListProjectAccessTokensStrict(ctx context.Context, owner, repo string) ([]repos.ProjectAccessToken, error)
ListProjectAccessTokensStrict is the destructive-cleanup inventory without the tokens of an administrator-supplied Poller account.
func (UninstallTokenClient) ReconcileGitLabPollersForUninstall ¶
func (u UninstallTokenClient) ReconcileGitLabPollersForUninstall(ctx context.Context, client forge.Client, owner, repo string) error
ReconcileGitLabPollersForUninstall restores and verifies Developer access of every managed Poller service account and revokes their bootstrap credentials. Only a positively absent service-account API (not found or not supported) means there is nothing to reconcile; a forbidden or failed listing cannot establish that and fails the uninstall.
A same-named service account that owns the administrator-supplied Poller credential is not managed: it is excluded from reconciliation and its tokens from later revocation. When the supplied credential cannot be attributed the uninstall fails closed with repos.ErrPollerSuppliedUnresolved.
func (UninstallTokenClient) RemoveGitLabTriggerAccountForUninstall ¶ added in v0.48.0
func (u UninstallTokenClient) RemoveGitLabTriggerAccountForUninstall(ctx context.Context, client forge.Client, lease *repos.GitLabProjectLease, owner, repo string) error
RemoveGitLabTriggerAccountForUninstall removes the trigger account's resources under the project lease the uninstall holds. It does nothing when no ledger exists, and it fails closed, keeping FULLSEND_GITLAB_TRIGGER_ACCOUNT, when the Poller inventory cannot be verified or any removal step fails.