Skip to content

Render HTML for error messages in single file editor

Dheeraj Joshi requested to merge dj/pre-receive-update-flash-message into master

Related issue: #456547 (closed)

What does this MR do and why?

This MR updates the flash notice to render HTML content. This is primarily required to format Secret push protection (formerly known as pre-receive secret detection). In a long run, we should have a separate template for CLI messages and Web UI messages.

Please note this should only affect commits created via a single file editor.

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

Before After
image image

How to set up and validate locally

pry(main)> Gitlab::CurrentSettings.update!(pre_receive_secret_detection_enabled: true) # to ensure feature is enabled instance-wide
pry(main)> project = Project.find(PROJECT_ID)
pry(main)> Feature.enable(:pre_receive_secret_detection_push_check, project) 

OR apply this patch to disable checks

diff --git a/ee/lib/gitlab/checks/secrets_check.rb b/ee/lib/gitlab/checks/secrets_check.rb
index 00b6743998d7..810354d7889e 100644
--- a/ee/lib/gitlab/checks/secrets_check.rb
+++ b/ee/lib/gitlab/checks/secrets_check.rb
@@ -93,8 +93,7 @@ def validate!
       # GitLab.com projects. For progress, follow
       # https://gitlab.com/groups/gitlab-org/-/epics/12729
       def run_pre_receive_secret_detection?
-        Gitlab::CurrentSettings.current_application_settings.pre_receive_secret_detection_enabled &&
-          (enabled_for_gitlabcom_project? || enabled_for_dedicated_project?)
+        true
       end
 
       def enabled_for_gitlabcom_project?
  1. In your test project, make a change and commit it using the single file editor
  2. The error message should be rendered as shown in the screenshot above
Edited by Dheeraj Joshi

Merge request reports