Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix code scanning alert #29: Incomplete URL substring sanitization #5

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion fastlane/lib/fastlane/setup/setup.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Copy link
Member

@nekrich nekrich Sep 19, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I doubt this will work since the line is not URL source 'https://rubygems.org' or source("https://rubygems.org"), plus the case difference.

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("")
Expand Down