Skip to content

Add support for snippet spam

Ian Anderson requested to merge snippet-spam into master

What does this MR do and why?

This MR adds support to check snippet spam using the spamcheck service. This also fixes two bugs in the current iteration.

  1. Snippet spam was being sent to the issue spam gRPC method.
  2. Public personal snippets were not being validated for spam due to not having a project association.
  3. Removes override for the allow_possible_spam feature flag when checking snippets.

How to set up and validate locally

The following instructions assume testing with GDK

  1. Pull the current spamcheck image.
docker pull registry.gitlab.com/gitlab-com/gl-security/engineering-and-research/automation-team/spam/spamcheck@sha256:a88d04745c541cdf84aa52949b423c11e1fd60a6ae1d8bcd47bfdfafc5ca77d1
  1. Run the spamcheck service locally.
docker run --rm -p 8001:8001 registry.gitlab.com/gitlab-com/gl-security/engineering-and-research/automation-team/spam/spamcheck@sha256:a88d04745c541cdf84aa52949b423c11e1fd60a6ae1d8bcd47bfdfafc5ca77d1
  1. Update the spamcheck URL in admin/application_settings/reporting to grpc://127.0.0.1:8001 and check the "Enable Spam Check via external API endpoint" box to enable spamcheck.
  2. Attempt to create a public snippet as a non-admin user. Logs should be generated in the locally running spamcheck service showing a request to the /spamcheck.SpamcheckService/CheckForSpamSnippet gRPC method.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Ian Anderson

Merge request reports

Loading