Skip to content
Snippets Groups Projects
Commit c95d304d authored by Yorick Peterse's avatar Yorick Peterse
Browse files

Merge branch 'security-makrdown-release-description-vulnerability-11-7' into 'security-11-7'

[11.7] Markdown of release notes leaks confidential issue titles and MR titles to any users

See merge request gitlab/gitlabhq!2871

(cherry picked from commit f7d842f0521f6d209e1b390c9fb733c8bfe7918f)

f2e331c1 Fix Markdown of release notes
parent b02315be
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -1109,7 +1109,9 @@ module API
 
class Release < TagRelease
expose :name
expose :description_html
expose :description_html do |entity|
MarkupHelper.markdown_field(entity, :description)
end
expose :created_at
expose :author, using: Entities::UserBasic, if: -> (release, _) { release.author.present? }
expose :commit, using: Entities::Commit
Loading
Loading
Loading
Loading
@@ -127,6 +127,31 @@ describe API::Releases do
.to match_array(release.sources.map(&:url))
end
 
context "when release description contains confidential issue's link" do
let(:confidential_issue) do
create(:issue,
:confidential,
project: project,
title: 'A vulnerability')
end
let!(:release) do
create(:release,
project: project,
tag: 'v0.1',
sha: commit.id,
author: maintainer,
description: "This is confidential #{confidential_issue.to_reference}")
end
it "does not expose confidential issue's title" do
get api("/projects/#{project.id}/releases/v0.1", maintainer)
expect(json_response['description_html']).to include(confidential_issue.to_reference)
expect(json_response['description_html']).not_to include('A vulnerability')
end
end
context 'when release has link asset' do
let!(:link) do
create(:release_link,
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment