From 45ab9ae2fc865e05f99cfa5b383aecc33af160b1 Mon Sep 17 00:00:00 2001 From: Craig Smith <5344211-craigmsmith@users.noreply.gitlab.com> Date: Thu, 18 Sep 2025 16:36:26 +1000 Subject: [PATCH 1/2] Ensure old path is set on rename --- .../checks/secret_push_protection/payload_processor.rb | 6 ++++-- .../checks/secret_push_protection/payload_processor_spec.rb | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/ee/lib/gitlab/checks/secret_push_protection/payload_processor.rb b/ee/lib/gitlab/checks/secret_push_protection/payload_processor.rb index d0a7efa7b105e7..12b5a14924cade 100644 --- a/ee/lib/gitlab/checks/secret_push_protection/payload_processor.rb +++ b/ee/lib/gitlab/checks/secret_push_protection/payload_processor.rb @@ -205,7 +205,7 @@ def diff_blobs_with_raw_info(paths_slice) # old_path should only be set for file renames. # Remove this code when addressing https://gitlab.com/gitlab-org/gitlab/-/issues/568266 - params[:old_path] = path.old_path if path.old_path != path.path + params[:old_path] = path.old_path if path.status == :RENAMED Gitaly::ChangedPaths.new(params) end @@ -217,7 +217,9 @@ def diff_blobs_with_raw_info(paths_slice) ).to_a rescue StandardError secret_detection_logger.error( - "diff_blobs_with_raw_info Gitaly call failed with args: #{raw_info_data.map(&:inspect)}" + "diff_blobs_with_raw_info Gitaly call failed with args and paths " \ + "args: #{raw_info_data.map(&:inspect)} " \ + "paths: #{paths_slice.map(&:inspect)}" ) raise end diff --git a/ee/spec/lib/gitlab/checks/secret_push_protection/payload_processor_spec.rb b/ee/spec/lib/gitlab/checks/secret_push_protection/payload_processor_spec.rb index 7964af55db0dda..e9d43b86cd2d80 100644 --- a/ee/spec/lib/gitlab/checks/secret_push_protection/payload_processor_spec.rb +++ b/ee/spec/lib/gitlab/checks/secret_push_protection/payload_processor_spec.rb @@ -67,7 +67,7 @@ it 'logs the failing arguments and re-raises the error' do expect(secret_detection_logger).to receive(:error).with( - a_string_starting_with("diff_blobs_with_raw_info Gitaly call failed with args:") + a_string_starting_with("diff_blobs_with_raw_info Gitaly call failed with args and paths:") ) expect { payload_processor.standardize_payloads }.to raise_error(GRPC::Internal) -- GitLab From 831f78718275107abf8a60ded246f2b14a55f91a Mon Sep 17 00:00:00 2001 From: Craig Smith <5344211-craigmsmith@users.noreply.gitlab.com> Date: Fri, 19 Sep 2025 16:07:09 +1000 Subject: [PATCH 2/2] Fix test --- .../gitlab/checks/secret_push_protection/payload_processor.rb | 2 +- .../checks/secret_push_protection/payload_processor_spec.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ee/lib/gitlab/checks/secret_push_protection/payload_processor.rb b/ee/lib/gitlab/checks/secret_push_protection/payload_processor.rb index 12b5a14924cade..90578ea65d9e7e 100644 --- a/ee/lib/gitlab/checks/secret_push_protection/payload_processor.rb +++ b/ee/lib/gitlab/checks/secret_push_protection/payload_processor.rb @@ -217,7 +217,7 @@ def diff_blobs_with_raw_info(paths_slice) ).to_a rescue StandardError secret_detection_logger.error( - "diff_blobs_with_raw_info Gitaly call failed with args and paths " \ + "diff_blobs_with_raw_info Gitaly call failed. " \ "args: #{raw_info_data.map(&:inspect)} " \ "paths: #{paths_slice.map(&:inspect)}" ) diff --git a/ee/spec/lib/gitlab/checks/secret_push_protection/payload_processor_spec.rb b/ee/spec/lib/gitlab/checks/secret_push_protection/payload_processor_spec.rb index e9d43b86cd2d80..bd8f0cfa013d9b 100644 --- a/ee/spec/lib/gitlab/checks/secret_push_protection/payload_processor_spec.rb +++ b/ee/spec/lib/gitlab/checks/secret_push_protection/payload_processor_spec.rb @@ -67,7 +67,7 @@ it 'logs the failing arguments and re-raises the error' do expect(secret_detection_logger).to receive(:error).with( - a_string_starting_with("diff_blobs_with_raw_info Gitaly call failed with args and paths:") + a_string_starting_with("diff_blobs_with_raw_info Gitaly call failed.") ) expect { payload_processor.standardize_payloads }.to raise_error(GRPC::Internal) -- GitLab