Skip to content

Fix oauth failure on primary

Aakriti Gupta requested to merge ag-fix-oauth-app-for-secondary into master

What does this MR do?

This MR fixes a bug in the Geo oauth client code, where a boolean was returned on Geo primary for oauth_application, which caused a call to a method - oauth_application&.uid to fail.

This MR fixes that by returning nil instead.

Stacktrace from a user that @jonlimr reported:

Completed 200 OK in 194ms (Views: 0.8ms | ActiveRecord: 0.0ms | Elasticsearch: 0.0ms | Allocations: 1135)
Started GET "/oauth/geo/auth?state=<redacted>" for 10.22.76.30 at 2020-11-09 11:12:09 +0800
Processing by Oauth::GeoAuthController#auth as HTML
  Parameters: {"state"=>"<redacted>"}
Completed 500 Internal Server Error in 134ms (ActiveRecord: 3.4ms | Elasticsearch: 0.0ms | Allocations: 3759)
NoMethodError (undefined method `uid' for false:FalseClass):
ee/lib/gitlab/geo/oauth/session.rb:42:in `block in oauth_client'
lib/gitlab/utils/strong_memoize.rb:30:in `strong_memoize'
ee/lib/gitlab/geo/oauth/session.rb:40:in `oauth_client

Screenshots (strongly suggested)

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Security

If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:

  • Label as security and @ mention @gitlab-com/gl-security/appsec
  • The MR includes necessary changes to maintain consistency between UI, API, email, or other methods
  • Security reports checked/validated by a reviewer from the AppSec team
Edited by Aakriti Gupta

Merge request reports