mirror of
https://github.com/discourse/discourse.git
synced 2025-05-23 16:31:09 +08:00
SECURITY: protect upload params, only allow very strict filenames
This commit is contained in:
@ -33,6 +33,20 @@ describe UploadsController do
|
||||
})
|
||||
end
|
||||
|
||||
it 'fails if type is invalid' do
|
||||
xhr :post, :create, file: logo, type: "invalid type cause has space"
|
||||
expect(response.status).to eq 403
|
||||
|
||||
xhr :post, :create, file: logo, type: "\\invalid"
|
||||
expect(response.status).to eq 403
|
||||
|
||||
xhr :post, :create, file: logo, type: "invalid."
|
||||
expect(response.status).to eq 403
|
||||
|
||||
xhr :post, :create, file: logo, type: "toolong"*100
|
||||
expect(response.status).to eq 403
|
||||
end
|
||||
|
||||
it 'is successful with an image' do
|
||||
Jobs.expects(:enqueue).with(:create_thumbnails, anything)
|
||||
|
||||
|
Reference in New Issue
Block a user