Prevent WebIDE from crashing on message
What does this MR do and why?
Prevent WebIDE from crashing on message
The full pre-receive secret detection message was crashing in the WebIDE. This is an attempt to get it to crash less. It will still crash when there are a lot of secrets detected. I got it to crash at 8 secrets. We will be implementing a more permanent solution with Update pre-receive secret detection error messa... (#456548 - closed) • Dheeraj Joshi • 17.1
Changelog: changed
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 |
---|---|
No message shows in the WebIDE | See Screenshot |
Screenshot with fix in place:
How to set up and validate locally
- From the terminal, run
export GITLAB_SIMULATE_SAAS=1
. Alternately, you can add that line to your env.runit file (creating it if it doesn't exist). - From the terminal, run
gdk restart
- From the rails console, run the following snippet:
# This enables the feature instance wide, instead of doing [these instructions](https://docs.gitlab.com/ee/user/application_security/secret_detection/pre_receive/#enable-pre-receive-secret-detection).
Gitlab::CurrentSettings.update!(pre_receive_secret_detection_enabled: true)
# This enables the feature instance wide, but at this point pre-receive does not run for any projects
::Feature.enable(:pre_receive_secret_detection_beta_release)
# http://gdk.test:3000/flightjs/Flight
project = Project.find_by_path "Flight"
# Enable the feature flag for the project, almost there
::Feature.enable(:pre_receive_secret_detection_push_check, project)
# Enables pre-receive secret detection for the project, the same as going to [the security configuration](http://gdk.test:3000/flightjs/Flight/-/security/configuration)
project.security_setting.update!(pre_receive_secret_detection_enabled: true)
- Launch the WebIDE for the project.
- Try to commit a secret in a file, such as
glpat-12345678901234567890
- You should then see an error message similar to the one in the above screenshot.
Numbered steps to set up and validate the change are strongly suggested.