Skip to content

OAuth logging improvement

What does this MR do and why?

solves https://gitlab.com/gitlab-org/gitlab/-/issues/440203.

authorizations_controller.rb does not have information like remote_ip, username, user_ip logged as part of controller payload. This makes it difficult to debug the issues.

This MR uses the existing append_info_to_payload method to add custom logging. This method is already used in spec/controllers/oauth/tokens_controller_spec.rb,

References

Please include cross links to any resources that are relevant to this MR. This will give reviewers and future readers helpful context to give an efficient review of the changes introduced.

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

Before After
Screenshot_2025-01-09_at_17.26.36 Screenshot_2025-01-09_at_17.26.46

How to set up and validate locally

On local GDK setup:

  • Go to User Settings-->Applications
  • Click on Add new application
  • Give application a desired name and add http://localhost:3000/auth/gitlab/callback as the redirect URI.
  • Choose openid and profile as scope.
  • Make a note of Application ID
  • Send a web-request to http://localhost:3000/oauth/authorize?client_id=<app-id>&redirect_uri=http://localhost:3000/auth/gitlab/callback&response_type=code&state=STATE&scope=profile
  • Check the logs under gitlab-development-kit/gitlab/log folder , greping on authorize and POST on file development_json.log.
Edited by Harjeet Sharma

Merge request reports

Loading