Add support for snippet spam
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.
- Snippet spam was being sent to the issue spam gRPC method.
- Public personal snippets were not being validated for spam due to not having a project association.
- 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
- Pull the current spamcheck image.
docker pull registry.gitlab.com/gitlab-com/gl-security/engineering-and-research/automation-team/spam/spamcheck@sha256:a88d04745c541cdf84aa52949b423c11e1fd60a6ae1d8bcd47bfdfafc5ca77d1
- 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
- Update the spamcheck URL in
admin/application_settings/reporting
togrpc://127.0.0.1:8001
and check the "Enable Spam Check via external API endpoint" box to enable spamcheck. - 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.
-
I have evaluated the MR acceptance checklist for this MR.
Edited by Ian Anderson