Skip to content

Fix logging handling for API integer params

Catalin Irimie requested to merge cat-readd-logging-for-ints-273663 into master

What does this MR do?

When encoding the values to be logged with lograge we handled all cases except Integer, which means legit int parameters being sent to the API would be logged as null, this adds encoding for integer parameters as well.

Related to #273663 (closed)

Screenshots (strongly suggested)

Before:

irb(main):001:0> Gitlab::GrapeLogging::Formatters::LogrageWithTimestamp.new.send(:process_params, {"params": {"test1": 123, "test2": "123"}})
=> [{:key=>:test1, :value=>nil}, {:key=>:test2, :value=>"123"}]

After:

irb(main):001:0> Gitlab::GrapeLogging::Formatters::LogrageWithTimestamp.new.send(:process_params, {"params": {"test1": 123, "test2": "123"}})
=> [{:key=>:test1, :value=>"123"}, {:key=>:test2, :value=>"123"}]

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 Catalin Irimie

Merge request reports