Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-07-27 22:06:07 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2022-07-27 22:06:32 +0300
commit62e0c3c7d73f028e4c6c8c179d6f04f811a0859f (patch)
tree69d0c42cb329dd5c64997243608e745dcef77c38 /spec/serializers
parentbbcd372db175c8f19b4b72453ff57c9a19887c5f (diff)
Add latest changes from gitlab-org/security/gitlab@15-2-stable-ee
Diffstat (limited to 'spec/serializers')
-rw-r--r--spec/serializers/build_details_entity_spec.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/spec/serializers/build_details_entity_spec.rb b/spec/serializers/build_details_entity_spec.rb
index dd8238456aa..916798c669c 100644
--- a/spec/serializers/build_details_entity_spec.rb
+++ b/spec/serializers/build_details_entity_spec.rb
@@ -170,6 +170,24 @@ RSpec.describe BuildDetailsEntity do
expect(message).to include('could not retrieve the needed artifacts.')
end
end
+
+ context 'when dependency contains invalid dependency names' do
+ invalid_name = 'XSS<a href=# data-disable-with="<img src=x onerror=alert(document.domain)>">'
+ let!(:test1) { create(:ci_build, :success, :expired, pipeline: pipeline, name: invalid_name, stage_idx: 0) }
+ let!(:build) { create(:ci_build, :pending, pipeline: pipeline, stage_idx: 1, options: { dependencies: [invalid_name] }) }
+
+ before do
+ build.pipeline.unlocked!
+ build.drop!(:missing_dependency_failure)
+ end
+
+ it { is_expected.to include(failure_reason: 'missing_dependency_failure') }
+
+ it 'escapes the invalid dependency names' do
+ escaped_name = html_escape(invalid_name)
+ expect(message).to include(escaped_name)
+ end
+ end
end
context 'when a build has environment with latest deployment' do