Skip to content

Override ip_address JSON representation for AuditEvents

What does this MR do?

AuditEvent is serialized in to JSON for the purposes of the JSON event log (log/audit_log.json) by calling as_json on the object before writing to the file.

As ip_address is now stored as an :inet in the database, the default JSON serialization is a 3-part hash:

"ip_address":{
    "family":2,
    "addr":1300105045,
    "mask_addr":4294967295
}

as opposed to the previous (much more human-friendly) behaviour:

"ip_address": "192.168.1.1"

This MR overrides as_json on AuditEvent, so that IP address is serialized in to expected format.

Screenshots

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

Mentions #231343 (closed)

Edited by Max Woolf

Merge request reports