From 380d19391505dff44e8c40e48a8821cedf1c926b Mon Sep 17 00:00:00 2001 From: v-thavaahariharangit <164553783+v-thavaahariharangit@users.noreply.github.com> Date: Wed, 18 Nov 2026 11:56:49 +0000 Subject: [PATCH 01/13] Initial plan From 79363f01f3e315dc433db9d1c8f4c87fbc4d3bad Mon Sep 17 00:00:00 2001 From: v-thavaahariharangit <164553783+v-thavaahariharangit@users.noreply.github.com> Date: Wed, 18 Nov 2026 12:02:56 +0000 Subject: [PATCH 02/13] Apply remaining changes Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> --- maven/lib/dependabot/maven/file_updater.rb | 29 +++++++++++++++---- .../dependabot/maven/file_updater_spec.rb | 28 ++++++++++++++++++ .../poms/plugin_config_same_version.xml | 26 +++++++++++++++++ 3 files changed, 78 insertions(+), 5 deletions(-) create mode 100644 maven/spec/fixtures/poms/plugin_config_same_version.xml diff --git a/maven/lib/dependabot/maven/file_updater.rb b/maven/lib/dependabot/maven/file_updater.rb index d8dea5a17aa..ef5c9d32933 100644 --- a/maven/lib/dependabot/maven/file_updater.rb +++ b/maven/lib/dependabot/maven/file_updater.rb @@ -11,7 +11,7 @@ module Dependabot module Maven - class FileUpdater < Dependabot::FileUpdaters::Base + class FileUpdater < Dependabot::FileUpdaters::Base # rubocop:disable Metrics/ClassLength extend T::Sig require_relative "file_updater/declaration_finder" @@ -331,10 +331,29 @@ def declaration_finder(dependency, requirement) def updated_file_declaration(old_declaration, previous_req, requirement) original_req_string = T.must(previous_req.requirement_string) - old_declaration.gsub( - /(?<=\s|>)#{Regexp.quote(original_req_string)}(?=\s|<)/, - T.must(requirement.requirement_string) - ) + own_version = %r{(\s*)#{Regexp.quote(original_req_string)}((?:\s|)*)}m + + # Only rewrite the declaration's own child; nested elements + # (e.g. plugin ) may contain the same text. + old_declaration.gsub(own_version) do + match = T.must(Regexp.last_match) + next match[0].to_s unless element_depth(old_declaration[0...match.begin(0)].to_s) == 1 + + "#{match[1]}#{requirement.requirement_string}#{match[2]}" + end + end + + sig { params(xml_prefix: String).returns(Integer) } + def element_depth(xml_prefix) + depth = 0 + xml_prefix.scan(%r{|<(/?)[^\s>/!?][^>]*?(/?)>}m) do |closing, self_closing| + next if Regexp.last_match(0).to_s.start_with?(")*)}m + own_version = %r{ + ((?:\s|)*) + #{Regexp.quote(original_req_string)} + ((?:\s|)*) + }mx # Only rewrite the declaration's own child; nested elements # (e.g. plugin ) may contain the same text. @@ -346,8 +350,8 @@ def updated_file_declaration(old_declaration, previous_req, requirement) sig { params(xml_prefix: String).returns(Integer) } def element_depth(xml_prefix) depth = 0 - xml_prefix.scan(%r{|<(/?)[^\s>/!?][^>]*?(/?)>}m) do |closing, self_closing| - next if Regexp.last_match(0).to_s.start_with?("||<(/?)[^\s>/!?][^>]*?(/?)>}m) do |closing, self_closing| + next if Regexp.last_match(0).to_s.start_with?(" Date: Wed, 18 Nov 2026 12:22:51 +0000 Subject: [PATCH 04/13] Maven: allow attributes on version tag; make element depth scan robust to quoted attrs and self-closing tags Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> --- maven/lib/dependabot/maven/file_updater.rb | 12 +++++-- .../dependabot/maven/file_updater_spec.rb | 35 +++++++++++++++++++ 2 files changed, 44 insertions(+), 3 deletions(-) diff --git a/maven/lib/dependabot/maven/file_updater.rb b/maven/lib/dependabot/maven/file_updater.rb index 727021b5a98..ce883361cd8 100644 --- a/maven/lib/dependabot/maven/file_updater.rb +++ b/maven/lib/dependabot/maven/file_updater.rb @@ -12,6 +12,12 @@ module Dependabot module Maven class FileUpdater < Dependabot::FileUpdaters::Base # rubocop:disable Metrics/ClassLength + XML_TAG_SCANNER = %r{ + + | + |<(/?)[^\s>/!?](?:"[^"]*"|'[^']*'|[^>"'])*?(/?)> + }mx + extend T::Sig require_relative "file_updater/declaration_finder" @@ -332,7 +338,7 @@ def updated_file_declaration(old_declaration, previous_req, requirement) original_req_string = T.must(previous_req.requirement_string) own_version = %r{ - ((?:\s|)*) + (]*)?>(?:\s|)*) #{Regexp.quote(original_req_string)} ((?:\s|)*) }mx @@ -350,11 +356,11 @@ def updated_file_declaration(old_declaration, previous_req, requirement) sig { params(xml_prefix: String).returns(Integer) } def element_depth(xml_prefix) depth = 0 - xml_prefix.scan(%r{||<(/?)[^\s>/!?][^>]*?(/?)>}m) do |closing, self_closing| + xml_prefix.scan(XML_TAG_SCANNER) do |closing, self_closing| next if Regexp.last_match(0).to_s.start_with?("3.6.3\n ", "") + .sub("require-maven", "require-maven") + .sub("", "\n 3.6.3") + end + let(:dependency) do + Dependabot::Dependency.new( + name: "org.apache.maven.plugins:maven-enforcer-plugin", + version: "3.7.0", + requirements: [{ + file: "pom.xml", + requirement: "3.7.0", + groups: ["plugin"], + source: nil, + metadata: { packaging_type: "jar" } + }], + previous_requirements: [{ + file: "pom.xml", + requirement: "3.6.3", + groups: ["plugin"], + source: nil, + metadata: { packaging_type: "jar" } + }], + package_manager: "maven" + ) + end + + its(:content) do + is_expected.to include('3.7.0') + is_expected.to include("3.6.3") + end + end + context "with a comment on the version" do let(:pom_body) { fixture("poms", "version_with_comment.xml") } From 114b628b5a60b49d2fc077eb126400709e2054ee Mon Sep 17 00:00:00 2001 From: v-thavaahariharangit <164553783+v-thavaahariharangit@users.noreply.github.com> Date: Wed, 18 Nov 2026 12:31:36 +0000 Subject: [PATCH 05/13] Maven: don't rewrite versions inside comments/CDATA Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> --- maven/lib/dependabot/maven/file_updater.rb | 9 +++++- .../dependabot/maven/file_updater_spec.rb | 31 +++++++++++++++++++ 2 files changed, 39 insertions(+), 1 deletion(-) diff --git a/maven/lib/dependabot/maven/file_updater.rb b/maven/lib/dependabot/maven/file_updater.rb index ce883361cd8..83694478a91 100644 --- a/maven/lib/dependabot/maven/file_updater.rb +++ b/maven/lib/dependabot/maven/file_updater.rb @@ -347,12 +347,19 @@ def updated_file_declaration(old_declaration, previous_req, requirement) # (e.g. plugin ) may contain the same text. old_declaration.gsub(own_version) do match = T.must(Regexp.last_match) - next match[0].to_s unless element_depth(old_declaration[0...match.begin(0)].to_s) == 1 + prefix = old_declaration[0...match.begin(0)].to_s + next match[0].to_s if inside_comment_or_cdata?(prefix) || element_depth(prefix) != 1 "#{match[1]}#{requirement.requirement_string}#{match[2]}" end end + sig { params(xml_prefix: String).returns(T::Boolean) } + def inside_comment_or_cdata?(xml_prefix) + stripped = xml_prefix.gsub(%r{|}m, "") + stripped.include?("" + ) + end + let(:dependency) do + Dependabot::Dependency.new( + name: "org.apache.maven.plugins:maven-enforcer-plugin", + version: "3.7.0", + requirements: [{ + file: "pom.xml", requirement: "3.7.0", groups: ["plugin"], source: nil, + metadata: { packaging_type: "jar" } + }], + previous_requirements: [{ + file: "pom.xml", requirement: "3.6.3", groups: ["plugin"], source: nil, + metadata: { packaging_type: "jar" } + }], + package_manager: "maven" + ) + end + + its(:content) do + is_expected.to include("") + is_expected.to include("").and include("3.7.0") + is_expected.to include("3.6.3") + end + end + context "with a comment on the version" do let(:pom_body) { fixture("poms", "version_with_comment.xml") } From 3456f403a423dc07e89710a600893061e2ce5f04 Mon Sep 17 00:00:00 2001 From: v-thavaahariharangit <164553783+v-thavaahariharangit@users.noreply.github.com> Date: Wed, 18 Nov 2026 12:31:45 +0000 Subject: [PATCH 06/13] Apply remaining changes Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> --- maven/lib/dependabot/maven/file_updater.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/maven/lib/dependabot/maven/file_updater.rb b/maven/lib/dependabot/maven/file_updater.rb index 83694478a91..fb6aa7dc5cf 100644 --- a/maven/lib/dependabot/maven/file_updater.rb +++ b/maven/lib/dependabot/maven/file_updater.rb @@ -356,7 +356,7 @@ def updated_file_declaration(old_declaration, previous_req, requirement) sig { params(xml_prefix: String).returns(T::Boolean) } def inside_comment_or_cdata?(xml_prefix) - stripped = xml_prefix.gsub(%r{|}m, "") + stripped = xml_prefix.gsub(/|/m, "") stripped.include?(", handle processing instructions Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> --- maven/lib/dependabot/maven/file_updater.rb | 9 ++--- .../dependabot/maven/file_updater_spec.rb | 33 +++++++++++++++++++ 2 files changed, 38 insertions(+), 4 deletions(-) diff --git a/maven/lib/dependabot/maven/file_updater.rb b/maven/lib/dependabot/maven/file_updater.rb index fb6aa7dc5cf..76ef29a304f 100644 --- a/maven/lib/dependabot/maven/file_updater.rb +++ b/maven/lib/dependabot/maven/file_updater.rb @@ -14,6 +14,7 @@ module Maven class FileUpdater < Dependabot::FileUpdaters::Base # rubocop:disable Metrics/ClassLength XML_TAG_SCANNER = %r{ + |<\?.*?\?> | |<(/?)[^\s>/!?](?:"[^"]*"|'[^']*'|[^>"'])*?(/?)> }mx @@ -338,9 +339,9 @@ def updated_file_declaration(old_declaration, previous_req, requirement) original_req_string = T.must(previous_req.requirement_string) own_version = %r{ - (]*)?>(?:\s|)*) + (]*)?>(?:\s|).)*-->)*) #{Regexp.quote(original_req_string)} - ((?:\s|)*) + ((?:\s|).)*-->)*) }mx # Only rewrite the declaration's own child; nested elements @@ -356,7 +357,7 @@ def updated_file_declaration(old_declaration, previous_req, requirement) sig { params(xml_prefix: String).returns(T::Boolean) } def inside_comment_or_cdata?(xml_prefix) - stripped = xml_prefix.gsub(/|/m, "") + stripped = xml_prefix.gsub(/|<\?.*?\?>|/m, "") stripped.include?("1.0]]>" + ) + .sub("", "\n 3.6.3") + end + let(:dependency) do + Dependabot::Dependency.new( + name: "org.apache.maven.plugins:maven-enforcer-plugin", + version: "3.7.0", + requirements: [{ + file: "pom.xml", requirement: "3.7.0", groups: ["plugin"], source: nil, + metadata: { packaging_type: "jar" } + }], + previous_requirements: [{ + file: "pom.xml", requirement: "3.6.3", groups: ["plugin"], source: nil, + metadata: { packaging_type: "jar" } + }], + package_manager: "maven" + ) + end + + its(:content) do + is_expected.to include("3.7.0") + is_expected.to include("3.6.3") + end + end + context "with a comment on the version" do let(:pom_body) { fixture("poms", "version_with_comment.xml") } From aa942f9b0949f7752c68f7d2c14360f8cd9a4d1b Mon Sep 17 00:00:00 2001 From: v-thavaahariharangit <164553783+v-thavaahariharangit@users.noreply.github.com> Date: Wed, 18 Nov 2026 12:48:32 +0000 Subject: [PATCH 08/13] Maven: don't rewrite versions inside processing instructions Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> --- maven/lib/dependabot/maven/file_updater.rb | 2 +- .../dependabot/maven/file_updater_spec.rb | 30 +++++++++++++++++++ 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/maven/lib/dependabot/maven/file_updater.rb b/maven/lib/dependabot/maven/file_updater.rb index 76ef29a304f..14010c21956 100644 --- a/maven/lib/dependabot/maven/file_updater.rb +++ b/maven/lib/dependabot/maven/file_updater.rb @@ -358,7 +358,7 @@ def updated_file_declaration(old_declaration, previous_req, requirement) sig { params(xml_prefix: String).returns(T::Boolean) } def inside_comment_or_cdata?(xml_prefix) stripped = xml_prefix.gsub(/|<\?.*?\?>|/m, "") - stripped.include?(").)*-->)*) + (<(?:[\w.-]+:)?version(?:\s[^>]*)?>(?:\s|).)*-->)*(?:).)*-->)*) + ((?:\]\]>)?(?:\s|).)*-->)*) }mx # Only rewrite the declaration's own child; nested elements diff --git a/maven/spec/dependabot/maven/file_updater_spec.rb b/maven/spec/dependabot/maven/file_updater_spec.rb index 14ae197e381..017681481af 100644 --- a/maven/spec/dependabot/maven/file_updater_spec.rb +++ b/maven/spec/dependabot/maven/file_updater_spec.rb @@ -458,6 +458,63 @@ end end + context "with a CDATA-wrapped plugin version" do + let(:pom_body) do + fixture("poms", "plugin_config_same_version.xml") + .sub( + "3.6.3\n ", + "\n " + ) + end + let(:dependency) do + Dependabot::Dependency.new( + name: "org.apache.maven.plugins:maven-enforcer-plugin", + version: "3.7.0", + requirements: [{ + file: "pom.xml", requirement: "3.7.0", groups: ["plugin"], source: nil, + metadata: { packaging_type: "jar" } + }], + previous_requirements: [{ + file: "pom.xml", requirement: "3.6.3", groups: ["plugin"], source: nil, + metadata: { packaging_type: "jar" } + }], + package_manager: "maven" + ) + end + + its(:content) do + is_expected.to include("") + is_expected.to include("3.6.3") + end + end + + context "with a namespace-prefixed plugin version" do + let(:pom_body) do + fixture("poms", "plugin_config_same_version.xml") + .sub("3.6.3\n ", "3.6.3\n ") + end + let(:dependency) do + Dependabot::Dependency.new( + name: "org.apache.maven.plugins:maven-enforcer-plugin", + version: "3.7.0", + requirements: [{ + file: "pom.xml", requirement: "3.7.0", groups: ["plugin"], source: nil, + metadata: { packaging_type: "jar" } + }], + previous_requirements: [{ + file: "pom.xml", requirement: "3.6.3", groups: ["plugin"], source: nil, + metadata: { packaging_type: "jar" } + }], + package_manager: "maven" + ) + end + + its(:content) do + is_expected.to include("3.7.0") + is_expected.to include("3.6.3") + end + end + context "with a comment on the version" do let(:pom_body) { fixture("poms", "version_with_comment.xml") } From 3a522f47e4f484e7901075a6ecd24765342fa99a Mon Sep 17 00:00:00 2001 From: v-thavaahariharangit <164553783+v-thavaahariharangit@users.noreply.github.com> Date: Wed, 18 Nov 2026 13:05:26 +0000 Subject: [PATCH 10/13] Maven: allow whitespace inside CDATA-wrapped version Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> --- maven/lib/dependabot/maven/file_updater.rb | 4 +-- .../dependabot/maven/file_updater_spec.rb | 30 +++++++++++++++++++ 2 files changed, 32 insertions(+), 2 deletions(-) diff --git a/maven/lib/dependabot/maven/file_updater.rb b/maven/lib/dependabot/maven/file_updater.rb index ac98c313039..0789535839b 100644 --- a/maven/lib/dependabot/maven/file_updater.rb +++ b/maven/lib/dependabot/maven/file_updater.rb @@ -339,9 +339,9 @@ def updated_file_declaration(old_declaration, previous_req, requirement) original_req_string = T.must(previous_req.requirement_string) own_version = %r{ - (<(?:[\w.-]+:)?version(?:\s[^>]*)?>(?:\s|).)*-->)*(?:]*)?>(?:\s|).)*-->)*(?:)?(?:\s|).)*-->)*) + ((?:\s*\]\]>)?(?:\s|).)*-->)*) }mx # Only rewrite the declaration's own child; nested elements diff --git a/maven/spec/dependabot/maven/file_updater_spec.rb b/maven/spec/dependabot/maven/file_updater_spec.rb index 017681481af..f4c6c4f3d1f 100644 --- a/maven/spec/dependabot/maven/file_updater_spec.rb +++ b/maven/spec/dependabot/maven/file_updater_spec.rb @@ -488,6 +488,36 @@ end end + context "with a whitespace-padded CDATA plugin version" do + let(:pom_body) do + fixture("poms", "plugin_config_same_version.xml") + .sub( + "3.6.3\n ", + "\n " + ) + end + let(:dependency) do + Dependabot::Dependency.new( + name: "org.apache.maven.plugins:maven-enforcer-plugin", + version: "3.7.0", + requirements: [{ + file: "pom.xml", requirement: "3.7.0", groups: ["plugin"], source: nil, + metadata: { packaging_type: "jar" } + }], + previous_requirements: [{ + file: "pom.xml", requirement: "3.6.3", groups: ["plugin"], source: nil, + metadata: { packaging_type: "jar" } + }], + package_manager: "maven" + ) + end + + its(:content) do + is_expected.to include("") + is_expected.to include("3.6.3") + end + end + context "with a namespace-prefixed plugin version" do let(:pom_body) do fixture("poms", "plugin_config_same_version.xml") From fc4c333d2226a1f75c20556dde785740e8b1de38 Mon Sep 17 00:00:00 2001 From: v-thavaahariharangit <164553783+v-thavaahariharangit@users.noreply.github.com> Date: Wed, 18 Nov 2026 13:14:24 +0000 Subject: [PATCH 11/13] Maven: allow > inside quoted attributes on version tag Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> --- maven/lib/dependabot/maven/file_updater.rb | 2 +- .../dependabot/maven/file_updater_spec.rb | 30 +++++++++++++++++++ 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/maven/lib/dependabot/maven/file_updater.rb b/maven/lib/dependabot/maven/file_updater.rb index 0789535839b..fbb9273039a 100644 --- a/maven/lib/dependabot/maven/file_updater.rb +++ b/maven/lib/dependabot/maven/file_updater.rb @@ -339,7 +339,7 @@ def updated_file_declaration(old_declaration, previous_req, requirement) original_req_string = T.must(previous_req.requirement_string) own_version = %r{ - (<(?:[\w.-]+:)?version(?:\s[^>]*)?>(?:\s|).)*-->)*(?:"'])*)?>(?:\s|).)*-->)*(?:)?(?:\s|).)*-->)*) }mx diff --git a/maven/spec/dependabot/maven/file_updater_spec.rb b/maven/spec/dependabot/maven/file_updater_spec.rb index f4c6c4f3d1f..f748ce219c0 100644 --- a/maven/spec/dependabot/maven/file_updater_spec.rb +++ b/maven/spec/dependabot/maven/file_updater_spec.rb @@ -545,6 +545,36 @@ end end + context "with a plugin version with a quoted > in an attribute" do + let(:pom_body) do + fixture("poms", "plugin_config_same_version.xml") + .sub( + "3.6.3\n ", + "3.6.3\n " + ) + end + let(:dependency) do + Dependabot::Dependency.new( + name: "org.apache.maven.plugins:maven-enforcer-plugin", + version: "3.7.0", + requirements: [{ + file: "pom.xml", requirement: "3.7.0", groups: ["plugin"], source: nil, + metadata: { packaging_type: "jar" } + }], + previous_requirements: [{ + file: "pom.xml", requirement: "3.6.3", groups: ["plugin"], source: nil, + metadata: { packaging_type: "jar" } + }], + package_manager: "maven" + ) + end + + its(:content) do + is_expected.to include("3.7.0") + is_expected.to include("3.6.3") + end + end + context "with a comment on the version" do let(:pom_body) { fixture("poms", "version_with_comment.xml") } From 463abfa1031191af739b77d0b4c133b9e54e60ff Mon Sep 17 00:00:00 2001 From: v-thavaahariharangit <164553783+v-thavaahariharangit@users.noreply.github.com> Date: Wed, 18 Nov 2026 13:24:18 +0000 Subject: [PATCH 12/13] Maven: allow processing instructions adjacent to version value Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> --- maven/lib/dependabot/maven/file_updater.rb | 5 ++-- .../dependabot/maven/file_updater_spec.rb | 30 +++++++++++++++++++ 2 files changed, 33 insertions(+), 2 deletions(-) diff --git a/maven/lib/dependabot/maven/file_updater.rb b/maven/lib/dependabot/maven/file_updater.rb index fbb9273039a..8a10570ed4e 100644 --- a/maven/lib/dependabot/maven/file_updater.rb +++ b/maven/lib/dependabot/maven/file_updater.rb @@ -338,10 +338,11 @@ def declaration_finder(dependency, requirement) def updated_file_declaration(old_declaration, previous_req, requirement) original_req_string = T.must(previous_req.requirement_string) + filler = /(?:\s|).)*-->|<\?(?:(?!\?>).)*\?>)*/m own_version = %r{ - (<(?:[\w.-]+:)?version(?:\s(?:"[^"]*"|'[^']*'|[^>"'])*)?>(?:\s|).)*-->)*(?:"'])*)?>#{filler}(?:)?(?:\s|).)*-->)*) + ((?:\s*\]\]>)?#{filler}) }mx # Only rewrite the declaration's own child; nested elements diff --git a/maven/spec/dependabot/maven/file_updater_spec.rb b/maven/spec/dependabot/maven/file_updater_spec.rb index f748ce219c0..0da90b26f87 100644 --- a/maven/spec/dependabot/maven/file_updater_spec.rb +++ b/maven/spec/dependabot/maven/file_updater_spec.rb @@ -575,6 +575,36 @@ end end + context "with a plugin version adjacent to processing instructions" do + let(:pom_body) do + fixture("poms", "plugin_config_same_version.xml") + .sub( + "3.6.3\n ", + "3.6.3\n " + ) + end + let(:dependency) do + Dependabot::Dependency.new( + name: "org.apache.maven.plugins:maven-enforcer-plugin", + version: "3.7.0", + requirements: [{ + file: "pom.xml", requirement: "3.7.0", groups: ["plugin"], source: nil, + metadata: { packaging_type: "jar" } + }], + previous_requirements: [{ + file: "pom.xml", requirement: "3.6.3", groups: ["plugin"], source: nil, + metadata: { packaging_type: "jar" } + }], + package_manager: "maven" + ) + end + + its(:content) do + is_expected.to include("3.7.0") + is_expected.to include("3.6.3") + end + end + context "with a comment on the version" do let(:pom_body) { fixture("poms", "version_with_comment.xml") } From f27b40c8341c495f6de2c1d6c6f7a63b81c98b42 Mon Sep 17 00:00:00 2001 From: v-thavaahariharangit <164553783+v-thavaahariharangit@users.noreply.github.com> Date: Wed, 18 Nov 2026 13:49:12 +0000 Subject: [PATCH 13/13] Maven: scan for open comment/CDATA/PI without regex sanitization Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> --- maven/lib/dependabot/maven/file_updater.rb | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/maven/lib/dependabot/maven/file_updater.rb b/maven/lib/dependabot/maven/file_updater.rb index 8a10570ed4e..8f6e24044c7 100644 --- a/maven/lib/dependabot/maven/file_updater.rb +++ b/maven/lib/dependabot/maven/file_updater.rb @@ -12,6 +12,11 @@ module Dependabot module Maven class FileUpdater < Dependabot::FileUpdaters::Base # rubocop:disable Metrics/ClassLength + XML_TERMINATORS = T.let( + { "", " "?>", " "]]>" }.freeze, + T::Hash[String, String] + ) + XML_TAG_SCANNER = %r{ |<\?.*?\?> @@ -358,8 +363,15 @@ def updated_file_declaration(old_declaration, previous_req, requirement) sig { params(xml_prefix: String).returns(T::Boolean) } def inside_comment_or_cdata?(xml_prefix) - stripped = xml_prefix.gsub(/|<\?.*?\?>|/m, "") - stripped.include?("