From 921754f813f155c2d64d4bc7fd02aef26135792f Mon Sep 17 00:00:00 2001 From: Artem Tykhonov Date: Thu, 19 Sep 2024 16:28:05 +0300 Subject: [PATCH] Fix code scanning alert #29: Incomplete URL substring sanitization Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> --- fastlane/lib/fastlane/setup/setup.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fastlane/lib/fastlane/setup/setup.rb b/fastlane/lib/fastlane/setup/setup.rb index dd6f4e5c238..6ed46b9a01b 100644 --- a/fastlane/lib/fastlane/setup/setup.rb +++ b/fastlane/lib/fastlane/setup/setup.rb @@ -244,7 +244,7 @@ def setup_gemfile! def ensure_gemfile_valid!(update_gemfile_if_needed: false) gemfile_content = File.read(gemfile_path) - unless gemfile_content.include?("https://rubygems.org") + unless gemfile_content.lines.any? { |line| URI(line.strip).host == "rubygems.org" rescue false } UI.error("You have a local Gemfile, but RubyGems isn't defined as source") UI.error("Please update your Gemfile at path `#{gemfile_path}` to include") UI.important("")