diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-09-29 01:05:12 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-09-29 01:05:22 +0300 |
commit | 10d9a3bf50cca85dd857c5306a34d7a6032580e6 (patch) | |
tree | 9ecd7fbf59c0e43c143c1d46fd437a9810aa6067 /spec/lib | |
parent | 6ed97cad88c8518155867b9a6a7896d7085a2f4e (diff) |
Add latest changes from gitlab-org/security/gitlab@15-4-stable-ee
Diffstat (limited to 'spec/lib')
-rw-r--r-- | spec/lib/error_tracking/sentry_client/event_spec.rb | 8 | ||||
-rw-r--r-- | spec/lib/error_tracking/sentry_client/issue_spec.rb | 19 | ||||
-rw-r--r-- | spec/lib/gitlab/checks/tag_check_spec.rb | 8 |
3 files changed, 34 insertions, 1 deletions
diff --git a/spec/lib/error_tracking/sentry_client/event_spec.rb b/spec/lib/error_tracking/sentry_client/event_spec.rb index d65bfa31018..e7a9db771b6 100644 --- a/spec/lib/error_tracking/sentry_client/event_spec.rb +++ b/spec/lib/error_tracking/sentry_client/event_spec.rb @@ -72,5 +72,13 @@ RSpec.describe ErrorTracking::SentryClient do end end end + + it_behaves_like 'non-numeric input handling in Sentry response', 'issue_id' do + let(:sentry_api_response) do + sample_response.tap do |event| + event[:groupID] = id_input + end + end + end end end diff --git a/spec/lib/error_tracking/sentry_client/issue_spec.rb b/spec/lib/error_tracking/sentry_client/issue_spec.rb index 1468a1ff7eb..ac6a4b9e8cd 100644 --- a/spec/lib/error_tracking/sentry_client/issue_spec.rb +++ b/spec/lib/error_tracking/sentry_client/issue_spec.rb @@ -199,6 +199,15 @@ RSpec.describe ErrorTracking::SentryClient::Issue do it_behaves_like 'issues have correct return type', Gitlab::ErrorTracking::Error it_behaves_like 'issues have correct length', 3 end + + it_behaves_like 'non-numeric input handling in Sentry response', 'id' do + let(:sentry_api_response) do + issues_sample_response.first(1).map do |issue| + issue[:id] = id_input + issue + end + end + end end describe '#issue_details' do @@ -208,8 +217,8 @@ RSpec.describe ErrorTracking::SentryClient::Issue do ) end - let(:sentry_request_url) { "#{sentry_url}/issues/#{issue_id}/" } let(:sentry_api_response) { issue_sample_response } + let(:sentry_request_url) { "#{sentry_url}/issues/#{issue_id}/" } let!(:sentry_api_request) { stub_sentry_request(sentry_request_url, body: sentry_api_response) } subject { client.issue_details(issue_id: issue_id) } @@ -298,6 +307,14 @@ RSpec.describe ErrorTracking::SentryClient::Issue do expect(subject.tags).to eq({ level: issue_sample_response['level'], logger: issue_sample_response['logger'] }) end end + + it_behaves_like 'non-numeric input handling in Sentry response', 'id' do + let(:sentry_api_response) do + issue_sample_response.tap do |issue| + issue[:id] = id_input + end + end + end end describe '#update_issue' do diff --git a/spec/lib/gitlab/checks/tag_check_spec.rb b/spec/lib/gitlab/checks/tag_check_spec.rb index 6cd3a2d1c07..50ffa5fad10 100644 --- a/spec/lib/gitlab/checks/tag_check_spec.rb +++ b/spec/lib/gitlab/checks/tag_check_spec.rb @@ -81,6 +81,14 @@ RSpec.describe Gitlab::Checks::TagCheck do it 'allows tag creation' do expect { subject.validate! }.not_to raise_error end + + context 'when tag name is the same as default branch' do + let(:ref) { "refs/tags/#{project.default_branch}" } + + it 'is prevented' do + expect { subject.validate! }.to raise_error(Gitlab::GitAccess::ForbiddenError, /cannot use default branch name to create a tag/) + end + end end end end |