Skip to content

feat: Auto-revoke glpats within TokenRevocationService

Lucas Charles requested to merge trigger-revocation-on-secret-detection into master

What does this MR do and why?

Automatically revokes GL Personal Access Tokens on detection. This feature is currently behind a feature flag, see #382610 (closed) rollout issue.

Parent issue: #371658 (closed) and handy diagram #371658 (comment 1159759669)

How to set up and validate locally

Emphasis on locally so we don't have a leak prior to this 😬

  1. Feature.enable(:gitlab_pat_auto_revocation)
  2. ApplicationSetting.last.update(secret_detection_token_revocation_enabled: true)
  3. Create a gitlab personal access token (that hopefully relies on the default prefix if it hasn't been modified: glpat-)
  4. Commit PAT to default branch of repository
  5. Let pipeline complete (after build completes ScanSecurityReportSecretsWorker must be ran)
  6. Check if token was revoked via access tokens page

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Lucas Charles

Merge request reports