-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #336 from Workable/PROD-30208_fix-porssible-ssrf-a…
…ttack-on-s3-url [PROD-30208] - add check on s3 url for @ after domain to prevent security risks
- Loading branch information
Showing
2 changed files
with
17 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -119,8 +119,22 @@ describe('joi extensions', function () { | |
should(underTest.error).be.undefined(); | ||
underTest.value.should.equal(url); | ||
}); | ||
it('s3 url with @ after domain should throw error', function () { | ||
const urls = [ | ||
'https://[email protected]/tmp/123-456-789', | ||
'https://[email protected]/tmp/123-456-789', | ||
'https://application-form.s3.amazonaws.com@joecup/tmp/123-456-789', | ||
'https://application-form.s3.amazonaws.com@hello', | ||
'https://application-form.s3.amazonaws.com@4nsex02yymx4wzjzc0ljcmsar1xsli97.oastify.com' | ||
]; | ||
urls.forEach(url => { | ||
const underTest = Joi.urlInOwnS3() | ||
.bucket('application-form') | ||
.validate(url); | ||
underTest.error.message.should.equal('Invalid path provided'); | ||
}); | ||
}); | ||
}); | ||
|
||
describe('url', function () { | ||
it('rejects URLs with less than two domain fragments', function () { | ||
Joi.url().validate('https://foo').error.message.should.equal('"value" must contain a valid domain name'); | ||
|