Rename Pre-receive Secret Detection to Secret Push Protection
What does this MR do and why?
Issue: #511969 (closed)
Since we have renamed the feature from pre receive secret detection to secret push protection, we are updating the database columns application_settings.pre_receive_secret_detection_enabled -> application_settings.secret_push_protection_available and project_security_settings.pre_receive_secret_detection_enabled -> project_security_settings.secret_push_protection_enabled to reflect the new feature name. We also need to update all references in the code from the old column name to the new column name. This MR looks really big, but it's mostly just a rename with no logic changes.
Migration output:
Project security settings
main: == [advisory_lock_connection] object_id: 131400, pg_backend_pid: 74213 main: == 20250114030220 RenamePreReceiveSecretDetectionEnabledToSecretPushProtectionEnabled: migrating main: -- rename_column(:project_security_settings, :pre_receive_secret_detection_enabled, :secret_push_protection_enabled) main: -> 0.0258s main: == 20250114030220 RenamePreReceiveSecretDetectionEnabledToSecretPushProtectionEnabled: migrated (0.0320s) main: == [advisory_lock_connection] object_id: 131400, pg_backend_pid: 74213 ci: == [advisory_lock_connection] object_id: 131720, pg_backend_pid: 74289 ci: == 20250114030220 RenamePreReceiveSecretDetectionEnabledToSecretPushProtectionEnabled: migrating ci: -- rename_column(:project_security_settings, :pre_receive_secret_detection_enabled, :secret_push_protection_enabled) ci: -> 0.0034s ci: == 20250114030220 RenamePreReceiveSecretDetectionEnabledToSecretPushProtectionEnabled: migrated (0.0130s)ci: == [advisory_lock_connection] object_id: 131720, pg_backend_pid: 74289
Application settings
main: == [advisory_lock_connection] object_id: 131640, pg_backend_pid: 32848 main: == 20250114030822 RenamePreReceiveSecretDetectionEnabledToSecretPushProtectionAvailable: migrating main: -- transaction_open?(nil) main: -> 0.0000s main: -- columns(:application_settings) main: -> 1.5189s main: -- column_exists?(:application_settings, :id) main: -> 1.7729s main: -- column_exists?(:application_settings, :secret_push_protection_available) main: -> 1.2053s main: -- columns(:application_settings) main: -> 1.4036s main: -- add_column(:application_settings, :secret_push_protection_available, :boolean, {:limit=>nil, :precision=>nil, :scale=>nil}) main: -> 0.0203s main: -- change_column_default(:application_settings, :secret_push_protection_available, "false") main: -> 1.5500s main: -- transaction_open?(nil) main: -> 0.0000s main: -- exec_query("SELECT COUNT(*) AS count FROM \"application_settings\"") main: -> 0.0745s main: -- exec_query("SELECT \"application_settings\".\"id\" FROM \"application_settings\" ORDER BY \"application_settings\".\"id\" ASC LIMIT 1") main: -> 0.0225s main: -- exec_query("SELECT \"application_settings\".\"id\" FROM \"application_settings\" WHERE \"application_settings\".\"id\" >= 1 ORDER BY \"application_settings\".\"id\" ASC LIMIT 1 OFFSET 1") main: -> 0.0043s main: -- transaction(nil) main: -- execute("SELECT set_config('lock_writes.application_settings', 'false', true)") main: -> 0.0092s main: -- execute("UPDATE \"application_settings\" SET \"secret_push_protection_available\" = \"application_settings\".\"pre_receive_secret_detection_enabled\" WHERE \"application_settings\".\"id\" >= 1") main: -> 0.0087s main: -> 0.1014s main: -- current_schema(nil) main: -> 0.0045s main: -- transaction_open?(nil) main: -> 0.0000s main: -- transaction_open?(nil) main: -> 0.0000s main: -- execute("ALTER TABLE application_settings\nADD CONSTRAINT check_be6ab41dcc\nCHECK ( secret_push_protection_available IS NOT NULL )\nNOT VALID;\n") main: -> 0.0190s main: -- execute("SET statement_timeout TO 0") main: -> 0.0092s main: -- execute("ALTER TABLE application_settings VALIDATE CONSTRAINT check_be6ab41dcc;") main: -> 0.0059s main: -- execute("RESET statement_timeout") main: -> 0.0068s main: -- indexes(:application_settings) main: -> 0.0248s main: -- foreign_keys(:application_settings) main: -> 0.0309s main: -- transaction_open?(nil) main: -> 0.0000s main: -- column_exists?(:application_settings, :pre_receive_secret_detection_enabled) main: -> 1.1644s main: -- column_exists?(:application_settings, :secret_push_protection_available) main: -> 1.6219s main: -- current_schema(nil) main: -> 0.0044s main: -- transaction_open?(nil) main: -> 0.0000s main: -- quote_table_name(:application_settings) main: -> 0.0020s main: -- quote_column_name(:pre_receive_secret_detection_enabled) main: -> 0.0002s main: -- quote_column_name(:secret_push_protection_available) main: -> 0.0000s main: -- columns(:application_settings) main: -> 2.3303s main: -- execute("CREATE OR REPLACE FUNCTION function_for_trigger_b9839c6d713f()\nRETURNS trigger\nLANGUAGE plpgsql\nAS $$\nBEGIN\n IF NEW.\"pre_receive_secret_detection_enabled\" IS NOT DISTINCT FROM 'false' AND NEW.\"secret_push_protection_available\" IS DISTINCT FROM 'false' THEN\n NEW.\"pre_receive_secret_detection_enabled\" = NEW.\"secret_push_protection_available\";\n END IF;\n\n IF NEW.\"secret_push_protection_available\" IS NOT DISTINCT FROM 'false' AND NEW.\"pre_receive_secret_detection_enabled\" IS DISTINCT FROM 'false' THEN\n NEW.\"secret_push_protection_available\" = NEW.\"pre_receive_secret_detection_enabled\";\n END IF;\n\n RETURN NEW;\nEND\n$$;\n\nDROP TRIGGER IF EXISTS trigger_b9839c6d713f\nON \"application_settings\";\n\nCREATE TRIGGER trigger_b9839c6d713f\nBEFORE INSERT ON \"application_settings\"\nFOR EACH ROW EXECUTE FUNCTION function_for_trigger_b9839c6d713f();\n") main: -> 0.0742s main: -- execute("CREATE OR REPLACE FUNCTION function_for_trigger_1baf8c8e1f66()\nRETURNS trigger\nLANGUAGE plpgsql\nAS $$\nBEGIN\n NEW.\"pre_receive_secret_detection_enabled\" := NEW.\"secret_push_protection_available\";\n RETURN NEW;\nEND\n$$;\n\nDROP TRIGGER IF EXISTS trigger_1baf8c8e1f66\nON \"application_settings\";\n\nCREATE TRIGGER trigger_1baf8c8e1f66\nBEFORE UPDATE OF \"secret_push_protection_available\" ON \"application_settings\"\nFOR EACH ROW EXECUTE FUNCTION function_for_trigger_1baf8c8e1f66();\n") main: -> 0.0555s main: -- execute("CREATE OR REPLACE FUNCTION function_for_trigger_7f41427eda69()\nRETURNS trigger\nLANGUAGE plpgsql\nAS $$\nBEGIN\n NEW.\"secret_push_protection_available\" := NEW.\"pre_receive_secret_detection_enabled\";\n RETURN NEW;\nEND\n$$;\n\nDROP TRIGGER IF EXISTS trigger_7f41427eda69\nON \"application_settings\";\n\nCREATE TRIGGER trigger_7f41427eda69\nBEFORE UPDATE OF \"pre_receive_secret_detection_enabled\" ON \"application_settings\"\nFOR EACH ROW EXECUTE FUNCTION function_for_trigger_7f41427eda69();\n") main: -> 0.0207s main: == 20250114030822 RenamePreReceiveSecretDetectionEnabledToSecretPushProtectionAvailable: migrated (13.5841s)main: == [advisory_lock_connection] object_id: 131640, pg_backend_pid: 32848 ci: == [advisory_lock_connection] object_id: 132100, pg_backend_pid: 34401 ci: == 20250114030822 RenamePreReceiveSecretDetectionEnabledToSecretPushProtectionAvailable: migrating ci: -- transaction_open?(nil) ci: -> 0.0001s ci: -- columns(:application_settings) ci: -> 1.2044s ci: -- column_exists?(:application_settings, :id) ci: -> 1.4184s ci: -- column_exists?(:application_settings, :secret_push_protection_available) ci: -> 1.6353s ci: -- columns(:application_settings) ci: -> 1.6521s ci: -- add_column(:application_settings, :secret_push_protection_available, :boolean, {:limit=>nil, :precision=>nil, :scale=>nil}) ci: -> 0.0256s ci: -- change_column_default(:application_settings, :secret_push_protection_available, "false") ci: -> 1.4594s ci: -- transaction_open?(nil) ci: -> 0.0000s ci: -- exec_query("SELECT COUNT(*) AS count FROM "application_settings"") ci: -> 0.0156s ci: -- current_schema(nil) ci: -> 0.0009s ci: -- transaction_open?(nil) ci: -> 0.0000s ci: -- transaction_open?(nil) ci: -> 0.0000s ci: -- execute("ALTER TABLE application_settings\nADD CONSTRAINT check_be6ab41dcc\nCHECK ( secret_push_protection_available IS NOT NULL )\nNOT VALID;\n") ci: -> 0.0227s ci: -- execute("SET statement_timeout TO 0") ci: -> 0.0052s ci: -- execute("ALTER TABLE application_settings VALIDATE CONSTRAINT check_be6ab41dcc;") ci: -> 0.0073s ci: -- execute("RESET statement_timeout") ci: -> 0.0073s ci: -- indexes(:application_settings) ci: -> 0.0586s ci: -- foreign_keys(:application_settings) ci: -> 0.0043s ci: -- transaction_open?(nil) ci: -> 0.0000s ci: -- column_exists?(:application_settings, :pre_receive_secret_detection_enabled) ci: -> 1.7110s ci: -- column_exists?(:application_settings, :secret_push_protection_available) ci: -> 3.4741s ci: -- current_schema(nil) ci: -> 0.0019s ci: -- transaction_open?(nil) ci: -> 0.0000s ci: -- quote_table_name(:application_settings) ci: -> 0.0001s ci: -- quote_column_name(:pre_receive_secret_detection_enabled) ci: -> 0.0000s ci: -- quote_column_name(:secret_push_protection_available) ci: -> 0.0000s ci: -- columns(:application_settings) ci: -> 1.1542s ci: -- execute("CREATE OR REPLACE FUNCTION function_for_trigger_b9839c6d713f()\nRETURNS trigger\nLANGUAGE plpgsql\nAS \nBEGIN\n IF NEW.\"pre_receive_secret_detection_enabled\" IS NOT DISTINCT FROM 'false' AND NEW.\"secret_push_protection_available\" IS DISTINCT FROM 'false' THEN\n NEW.\"pre_receive_secret_detection_enabled\" = NEW.\"secret_push_protection_available\";\n END IF;\n\n IF NEW.\"secret_push_protection_available\" IS NOT DISTINCT FROM 'false' AND NEW.\"pre_receive_secret_detection_enabled\" IS DISTINCT FROM 'false' THEN\n NEW.\"secret_push_protection_available\" = NEW.\"pre_receive_secret_detection_enabled\";\n END IF;\n\n RETURN NEW;\nEND\n;\n\nDROP TRIGGER IF EXISTS trigger_b9839c6d713f\nON "application_settings";\n\nCREATE TRIGGER trigger_b9839c6d713f\nBEFORE INSERT ON "application_settings"\nFOR EACH ROW EXECUTE FUNCTION function_for_trigger_b9839c6d713f();\n") ci: -> 0.0209s ci: -- execute("CREATE OR REPLACE FUNCTION function_for_trigger_1baf8c8e1f66()\nRETURNS trigger\nLANGUAGE plpgsql\nAS \nBEGIN\n NEW.\"pre_receive_secret_detection_enabled\" := NEW.\"secret_push_protection_available\";\n RETURN NEW;\nEND\n;\n\nDROP TRIGGER IF EXISTS trigger_1baf8c8e1f66\nON "application_settings";\n\nCREATE TRIGGER trigger_1baf8c8e1f66\nBEFORE UPDATE OF "secret_push_protection_available" ON "application_settings"\nFOR EACH ROW EXECUTE FUNCTION function_for_trigger_1baf8c8e1f66();\n") ci: -> 0.0048s ci: -- execute("CREATE OR REPLACE FUNCTION function_for_trigger_7f41427eda69()\nRETURNS trigger\nLANGUAGE plpgsql\nAS \nBEGIN\n NEW.\"secret_push_protection_available\" := NEW.\"pre_receive_secret_detection_enabled\";\n RETURN NEW;\nEND\n;\n\nDROP TRIGGER IF EXISTS trigger_7f41427eda69\nON "application_settings";\n\nCREATE TRIGGER trigger_7f41427eda69\nBEFORE UPDATE OF "pre_receive_secret_detection_enabled" ON "application_settings"\nFOR EACH ROW EXECUTE FUNCTION function_for_trigger_7f41427eda69();\n") ci: -> 0.0034s ci: == 20250114030822 RenamePreReceiveSecretDetectionEnabledToSecretPushProtectionAvailable: migrated (14.3838s)
References
Please include cross links to any resources that are relevant to this MR. This will give reviewers and future readers helpful context to give an efficient review of the changes introduced.
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 |
|---|---|
How to set up and validate locally
Numbered steps to set up and validate the change are strongly suggested.