Skip to content

Add ability to track unique uses of API endpoints

Max Woolf requested to merge 233786-ppi-unique-audit-events-api-2 into master

What does this MR do?

  • Adds the ability to track unique uses of the audit events API.
  • Adds the ability to do this with any single API or subset of APIs too.

Another version of this MR was reverted from staging after causing this issue.. This issue has been resolved by using the current user's ID as the unique key instead of a randomly generated UUID that depends on the use of sessions.

This caused a problem whereby sometimes the context session was nil and this caused an error to be thrown. It is not currently known why context.session is nil in production but not in development (it is not reproducable using GDK).

Original MR !39616 (merged)
Revert MR !40921 (merged)
Issue Raised from sentry errors #243680 (closed)
Sentry errors https://sentry.gitlab.net/gitlab/staginggitlabcom/issues/1796070/?referrer=gitlab_integration

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 #233786 (closed)

Edited by Max Woolf

Merge request reports