Skip to content

Commit

Permalink
Strengthen some checks that trigger Github's CodeQL security checks (#…
Browse files Browse the repository at this point in the history
…21880)

* Strengthen some checks that trigger Github's CodeQL security checks

* Adjust code as per code review from @AliSoftware
  • Loading branch information
lacostej committed Feb 19, 2024
1 parent 8c4903c commit 6e15285
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion fastlane/helper/plugin_scores_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def initialize(hash, cache_path)
self.homepage = hash["homepage_uri"] || hash["documentation_uri"]
self.raw_hash = hash

has_github_page = self.homepage.to_s.include?("https://github.com") # Here we can add non GitHub support one day
has_github_page = self.homepage.to_s.start_with?("https://github.com") # Here we can add non GitHub support one day

self.data = {
has_homepage: self.homepage.to_s.length > 5,
Expand Down
2 changes: 1 addition & 1 deletion fastlane/spec/actions_specs/flock_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def run_flock(**arguments)
context 'options' do
before do
ENV['FL_FLOCK_BASE_URL'] = 'https://example.com'
stub_request(:any, /example.com/)
stub_request(:any, /example\.com/)
end

it 'requires message' do
Expand Down
2 changes: 1 addition & 1 deletion fastlane/spec/env_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
describe Fastlane do
describe Fastlane::EnvironmentPrinter do
before do
stub_request(:get, %r{https:\/\/rubygems.org\/api\/v1\/gems\/.*}).
stub_request(:get, %r{https://rubygems\.org\/api\/v1\/gems\/.*}).
to_return(status: 200, body: '{"version": "0.16.2"}', headers: {})
end

Expand Down
8 changes: 4 additions & 4 deletions match/spec/storage/gitlab/client_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@
{ id: 2, name: 'file2' }
].to_json

stub_request(:get, /gitlab.example.com/).
stub_request(:get, /gitlab\.example\.com/).
with(headers: { 'PRIVATE-TOKEN' => 'abc123' }).
to_return(status: 200, body: response)

Expand All @@ -111,15 +111,15 @@
end

it 'returns an empty array if there are results' do
stub_request(:get, /gitlab.example.com/).
stub_request(:get, /gitlab\.example\.com/).
with(headers: { 'PRIVATE-TOKEN' => 'abc123' }).
to_return(status: 200, body: [].to_json)

expect(subject.files.count).to be(0)
end

it 'requests 100 files from the API' do
stub_request(:get, /gitlab.example.com/).
stub_request(:get, /gitlab\.example\.com/).
to_return(status: 200, body: [].to_json)

files = subject.files
Expand All @@ -128,7 +128,7 @@
end

it 'raises an exception for a non-json response' do
stub_request(:get, /gitlab.example.com/).
stub_request(:get, /gitlab\.example\.com/).
with(headers: { 'PRIVATE-TOKEN' => 'abc123' }).
to_return(status: 200, body: 'foo')

Expand Down
6 changes: 3 additions & 3 deletions spaceship/spec/mock_servers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
config.include(WebMock::API)

config.before do
stub_request(:any, %r(appstoreconnect.apple.com/testflight/v2)).to_rack(MockAPI::TestFlightServer)
stub_request(:any, %r(developer.apple.com/services-account/QH65B2/account/auth/key)).to_rack(MockAPI::DeveloperPortalServer)
stub_request(:any, %r(developer.apple.com/services-account/QH65B2/account/ios/identifiers/.*OMC(s){0,1}\.action)).to_rack(MockAPI::DeveloperPortalServer)
stub_request(:any, %r(appstoreconnect\.apple.com/testflight/v2)).to_rack(MockAPI::TestFlightServer)
stub_request(:any, %r(developer\.apple\.com/services-account/QH65B2/account/auth/key)).to_rack(MockAPI::DeveloperPortalServer)
stub_request(:any, %r(developer\.apple\.com/services-account/QH65B2/account/ios/identifiers/.*OMC(s){0,1}\.action)).to_rack(MockAPI::DeveloperPortalServer)
end

config.after do
Expand Down
2 changes: 1 addition & 1 deletion spaceship/spec/portal/portal_client_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@
"deviceIds",
"appId",
"certificateIds")
expect(a_request(:post, /developerservices2.apple.com/)).to have_been_made
expect(a_request(:post, /developerservices2\.apple\.com/)).to have_been_made
end
end

Expand Down

0 comments on commit 6e15285

Please sign in to comment.