add spam_check_api_key textbox to admin / application_settings / reporting
What does this MR do?
As discussed with @agroleau , @cmiskell and @cwoolley-gitlab and in accordance with @cablett 's comment on !31449 (merged) regarding future iterations for Spam Check's integration with GitLab:
The endpoint is only provided with a user ID at the moment, but that will change in a future iteration as that is developed further.
This MR adds an API key text-box to /admin/application_settings/reporting#js-spam-settings
and supporting components so that Spam Check can be provided a token which it can use to authenticate its requests while requesting verdicts from the respective Spam Check service also configured in /admin/application_settings/reporting#js-spam-settings
.
spam_verdict_service.rb
has not been modified on purpose, since in MR !52385 (merged) we transition from HTTP to GRPC communication. As GRPC-related communication and the actual outbound service request will be moved to lib/gitlab/spamcheck/client.rb
, those changes would likely be discarded.
That MR will be updated once this smaller and more simple MR is merged to leverage either the ENV['SPAM_CHECK_API_KEY']
environment variable or Gitlab::CurrentSettings.current_application_settings.spam_check_api_key
This change will likely be made to the following line !52385 (diffs) , complementing the changes already in-place / suggested there.
Screenshots (strongly suggested)
GDK path to the UI changes is http://localhost:3000/admin/application_settings/reporting#js-spam-settings
Database Migration Output
$ bundle exec rails db:migrate RAILS_ENV=development;
== 20210427125400 AddSpamcheckApiKeyToApplicationSetting: migrating ===========
-- add_column(:application_settings, :encrypted_spam_check_api_key, :text)
-> 0.0018s
-- add_column(:application_settings, :encrypted_spam_check_api_key_iv, :text)
-> 0.0007s
== 20210427125400 AddSpamcheckApiKeyToApplicationSetting: migrated (0.0025s) ==
jsalazar@shell:~/gitlab/gitlab-development-kit/gitlab$ bundle exec rails db:migrate:up VERSION=20210427125400
== 20210427125400 AddSpamcheckApiKeyToApplicationSetting: migrating ===========
-- add_column(:application_settings, :encrypted_spam_check_api_key, :text)
-> 0.0060s
-- add_column(:application_settings, :encrypted_spam_check_api_key_iv, :text)
-> 0.0010s
== 20210427125400 AddSpamcheckApiKeyToApplicationSetting: migrated (0.0072s) ==
jsalazar@shell:~/gitlab/gitlab-development-kit/gitlab$ bundle exec rails db:migrate:down VERSION=20210427125400
== 20210427125400 AddSpamcheckApiKeyToApplicationSetting: reverting ===========
-- remove_column(:application_settings, :encrypted_spam_check_api_key)
-> 0.0023s
-- remove_column(:application_settings, :encrypted_spam_check_api_key_iv)
-> 0.0008s
== 20210427125400 AddSpamcheckApiKeyToApplicationSetting: reverted (0.0032s) ==
Does this MR meet the acceptance criteria?
Conformity
-
📋 Does this MR need a changelog?-
I have included a changelog entry. -
I have not included a changelog entry because _____.
-
-
Documentation (if required) -
Code review guidelines -
Merge request performance guidelines -
Style guides -
Database guides -
Separation of EE specific content
Availability and Testing
-
Review and add/update tests for this feature/bug. Consider all test levels. See the Test Planning Process. -
Tested in all supported browsers -
Informed Infrastructure department of a default or new setting change, if applicable per definition of done
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