Skip to content

Update "last used" date for PATs if used in git operations

What does this MR do and why?

The last_used_at column of personal access tokens was only updated if the token was used with the REST or GraphQL API. With this change the column also gets updated if a PAT is used with a git operation like clone/pull or push.

Screenshots or screen recordings

Screenshot_2022-10-11_at_12.11.33

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

  1. Create a personal access token with a read_repository, write_repository or api scope
  2. Check the Last Used column in the "Active personal access tokens" table, it should say "Never" for this token
  3. Clone a random repository using the personal access token as a password
  4. Check the Last Used column in the "Active personal access tokens" table again, it should not say "Never" anymore

MR acceptance checklist

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

Related to #349507 (closed)

Merge request reports

Loading