mirror of
https://github.com/discourse/discourse.git
synced 2025-05-23 19:04:11 +08:00
SECURITY: Expand and improve SSRF Protections (#18815)
See https://github.com/discourse/discourse/security/advisories/GHSA-rcc5-28r3-23rr Co-authored-by: OsamaSayegh <asooomaasoooma90@gmail.com> Co-authored-by: Daniel Waterworth <me@danielwaterworth.com>
This commit is contained in:
@ -11,6 +11,22 @@ RSpec.describe Admin::ThemesController do
|
||||
sign_in(admin)
|
||||
end
|
||||
|
||||
let! :repo do
|
||||
setup_git_repo(
|
||||
"about.json" => { name: "discourse-branch-header" }.to_json,
|
||||
)
|
||||
end
|
||||
|
||||
let! :repo_url do
|
||||
MockGitImporter.register('https://github.com/discourse/discourse-brand-header.git', repo)
|
||||
end
|
||||
|
||||
around(:each) do |group|
|
||||
MockGitImporter.with_mock do
|
||||
group.run
|
||||
end
|
||||
end
|
||||
|
||||
describe '#generate_key_pair' do
|
||||
it 'can generate key pairs' do
|
||||
post "/admin/themes/generate_key_pair.json"
|
||||
@ -111,8 +127,8 @@ RSpec.describe Admin::ThemesController do
|
||||
remote: ' https://github.com/discourse/discourse-brand-header.git '
|
||||
}
|
||||
|
||||
expect(Theme.allowed_remote_theme_ids.length).to eq(1)
|
||||
expect(response.status).to eq(201)
|
||||
expect(Theme.allowed_remote_theme_ids.length).to eq(1)
|
||||
end
|
||||
|
||||
it "prevents adding disallowed themes" do
|
||||
|
Reference in New Issue
Block a user