Skip to content

ProtectedBranchAuditEventService always passing in current_sign_in_ip

Summary

ProtectedBranchAuditEventService is setting details['ip_address'] to the .current_sign_in_ip for the provided author - so it's not getting the changes introduced in !46114 (merged) to make use of the ip in the GitLab::RequestContext

Other subclasses of ::AuditEventService either accept an IP address or don't set one (e.g. RepositoryPushAuditEventService)

What is the current bug behavior?

This is producing inconsistent results in the audit log where current_sign_in_ip doesn't match the GitLab::RequestContext.instance.client_ip when current_sign_in_ip hasn't updated if a user changes IP addresses within the hour limit that we've overridden for the Devise update. Some audit operations will record the request.ip, protected branch changes will get the outdated current_sign_in_ip as mentioned in #217439 (closed)

What is the expected correct behavior?

Logged IP Addresses should be consistent.

Edited by Jason Young