Project Level Access Tokens and TOS

Project-level access tokens should be able to be used without the Bot User having to accept TOS.

When trying to use the project level access token you get the error below:

GitlabGetError: 403: 403 Forbidden - You (@project_64_bot1) must accept the Terms of Service in order to perform this action. Please access GitLab from a web browser to accept these terms.

I think this can be mitigated by impersonating the bot user and accepting the TOS? Though, I guess this prevents use of bot users without an admin, just how we want it.

Workaround (requires access to the GitLab Rails Console)

  1. Access the GitLab Rails Console - sudo gitlab-rails console
  2. Find the Project Access Token bot by username - user = User.find_by_username(<username>)
  3. Find the TOS - terms = ApplicationSetting::Term.latest
  4. Accept the TOS - Users::RespondToTermsService.new(user, terms).execute(accepted: true)
Edited by Peter Hegman