Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
xit('POST file type XML with Billion Laughs attack is caught by parser', () => { // FIXME fails with "socket hang up" error from node-fetch
const file = path.resolve(__dirname, '../files/xxeBillionLaughs.xml')
const form = frisby.formData()
form.append('file', fs.createReadStream(file))
return frisby.post(URL + '/file-upload', {
headers: { 'Content-Type': form.getHeaders()['content-type'] },
body: form
})
.expect('status', 410)
.expect('bodyContains', 'Detected an entity reference loop')
})
it('POST profile image file invalid type', () => {
const file = path.resolve(__dirname, '../files/invalidProfileImageType.docx')
const form = frisby.formData()
form.append('file', fs.createReadStream(file))
return frisby.post(REST_URL + '/user/login', {
headers: jsonHeader,
body: {
email: 'jim@' + config.get('application.domain'),
password: 'ncc-1701'
}
})
.expect('status', 200)
.then(({ json: jsonLogin }) => {
return frisby.post(URL + '/profile/image/file', {
headers: {
Cookie: 'token=' + jsonLogin.authentication.token,
'Content-Type': form.getHeaders()['content-type']
},
it('POST new memory with valid for JPG format image', () => {
const file = path.resolve(__dirname, '../files/validProfileImage.jpg')
const form = frisby.formData()
form.append('image', fs.createReadStream(file), 'Valid Image')
form.append('caption', 'Valid Image')
return frisby.post(REST_URL + '/user/login', {
headers: jsonHeader,
body: {
email: 'jim@' + config.get('application.domain'),
password: 'ncc-1701'
}
})
.expect('status', 200)
.then(({ json: jsonLogin }) => {
return frisby.post(API_URL + '/Memorys', {
headers: {
Authorization: 'Bearer ' + jsonLogin.authentication.token,
'Content-Type': form.getHeaders()['content-type']
var create_form = function(filePath, format) {
var html5Path = path.resolve(__dirname, filePath);
var form = frisby.formData();
form.append('outputFormat', format);
form.append('html5', fs.createReadStream(html5Path));
return form;
};