Skip to content

feat(gitlab): list the access tokens of all groups - #66

Merged
beliven-alex-zongaro merged 1 commit into
mainfrom
feat/gitlab-group-access-tokens
Oct 6, 2026
Merged

beliven-alex-zongaro merged 1 commit into
mainfrom
feat/gitlab-group-access-tokens

Conversation

@beliven-alex-zongaro

@beliven-alex-zongaro beliven-alex-zongaro commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

Summary

GitLab has no UI to see all the group access tokens at once, so renewing them means opening every group and some get forgotten. New command:

opsi gitlab group access-tokens [--expiring <days>]

For every group with tokens it prints the group (path and URL) and, for each token, name, scopes and expiration:

acme/team (https://git.example.com/groups/acme/team)
  - ci-deploy [api, read_registry] expires 2026-10-26 (in 20 days)
  - old-token [read_api] EXPIRED on 2026-09-01 (35 days ago)
  - forever [api] never expires
  • Revoked tokens are left out; groups without tokens are not printed. A summary is printed at the end.
  • --expiring <days> shows only the tokens already expired or expiring within that number of days (tokens without expiration are not shown).
  • Groups whose tokens cannot be read (no permission or error) are listed at the end instead of stopping the command.
  • Needs a token able to read the access tokens of every group: an admin token with api and admin_mode is enough, no need to be owner of each group.
  • The groups are checked 5 at a time, with progress on a single line.

Test plan

  • go vet ./... and go test ./... (expiration formatting and filter, revoked tokens excluded, group with 403 does not stop the listing)
  • Run on git.beliven.dev: 85 groups, 4 tokens, no errors. Cross-checked with a separate read-only curl/jq scan of the API: same groups, same tokens and expirations
  • opsi gitlab group access-tokens --expiring 30

🤖 Generated with Claude Code

Add `opsi gitlab group access-tokens`, which walks through every group and
prints the group (path and URL) with its access tokens: name, scopes and
expiration. Revoked tokens are left out. With --expiring <days> it shows
only the tokens already expired or expiring within that number of days.

Groups where the tokens cannot be read (no permission) are listed at the
end instead of stopping the command.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@beliven-alex-zongaro
beliven-alex-zongaro merged commit 0319763 into main Oct 6, 2026
1 check passed
@beliven-alex-zongaro
beliven-alex-zongaro deleted the feat/gitlab-group-access-tokens branch October 7, 2026 09:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant