DEV: Do not log API key scope and/or source-ip mismatches (#15423)

Using an incorrectly-scoped API key is something which should be fixed by the client - no need to log errors on the server-side.
This commit is contained in:
David Taylor 2021-12-29 12:22:21 +00:00 committed by GitHub
parent ad25e4103d
commit 4f06c24a57
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -369,8 +369,7 @@ class Auth::DefaultCurrentUserProvider
if api_key = ApiKey.active.with_key(api_key_value).includes(:user).first
api_username = header_api_key? ? @env[HEADER_API_USERNAME] : request[API_USERNAME]
unless api_key.request_allowed?(@env)
Rails.logger.warn("[Unauthorized API Access] username: #{api_username}, IP address: #{request.ip}")
if !api_key.request_allowed?(@env)
return nil
end