mirror of
https://github.com/discourse/discourse.git
synced 2025-05-30 15:28:37 +08:00
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:
@ -369,8 +369,7 @@ class Auth::DefaultCurrentUserProvider
|
|||||||
if api_key = ApiKey.active.with_key(api_key_value).includes(:user).first
|
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]
|
api_username = header_api_key? ? @env[HEADER_API_USERNAME] : request[API_USERNAME]
|
||||||
|
|
||||||
unless api_key.request_allowed?(@env)
|
if !api_key.request_allowed?(@env)
|
||||||
Rails.logger.warn("[Unauthorized API Access] username: #{api_username}, IP address: #{request.ip}")
|
|
||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user