Skip to content

Commit

Permalink
chore: updated dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
Jamie Peabody committed Oct 15, 2020
1 parent 5a0cd15 commit 85b02ad
Show file tree
Hide file tree
Showing 6 changed files with 76 additions and 55 deletions.
3 changes: 3 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Changes

## 4.2.1:
* chore: updated dependencies, cleared security issues

## 4.2.0:
* minor: added new option `ignoreaccents` to ignore accented characters.

Expand Down
12 changes: 7 additions & 5 deletions karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,13 @@ module.exports = function(config) {
}
},
plugins: [
new CopyWebpackPlugin([{
from: 'src/mergely.css',
to: 'mergely.css',
toType: 'file'
}])
new CopyWebpackPlugin({
patterns: [{
from: 'src/mergely.css',
to: 'mergely.css',
toType: 'file'
}]
})
]
},
webpackServer: {
Expand Down
35 changes: 17 additions & 18 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,34 +36,33 @@
"devDependencies": {
"@babel/core": "^7.1.6",
"@babel/preset-env": "^7.1.6",
"@webpack-cli/init": "^0.1.2",
"@webpack-cli/init": "^1.0.1",
"babel-loader": "^8.0.4",
"babel-plugin-syntax-dynamic-import": "^6.18.0",
"chai": "^4.1.2",
"codemirror": "^5.50.2",
"copy-webpack-plugin": "^4.6.0",
"css-loader": "^0.28.11",
"file-loader": "^1.1.5",
"html-webpack-plugin": "^3.2.0",
"image-webpack-loader": "^3.4.2",
"jquery": "^3.2.1",
"karma": "^3.1.1",
"copy-webpack-plugin": "^6.2.1",
"css-loader": "^5.0.0",
"file-loader": "^6.1.1",
"html-webpack-plugin": "^4.5.0",
"image-webpack-loader": "^7.0.1",
"jquery": "^3.5.1",
"karma": "^5.2.3",
"karma-chai": "^0.1.0",
"karma-chrome-launcher": "^2.2.0",
"karma-chrome-launcher": "^3.1.0",
"karma-coverage-istanbul-reporter": "^1.3.0",
"karma-mocha": "^1.3.0",
"karma-mocha": "^2.0.1",
"karma-mocha-reporter": "^2.2.5",
"karma-webpack": "^2.0.9",
"mocha": "^4.0.1",
"style-loader": "^0.23.0",
"uglifyjs-webpack-plugin": "^2.0.1",
"webpack": "^4.20.2",
"webpack-cli": "^3.1.2",
"webpack-dev-server": "^3.1.9"
"karma-webpack": "^4.0.2",
"mocha": "^8.1.3",
"style-loader": "^2.0.0",
"webpack": "^4.44.2",
"webpack-cli": "^4.0.0",
"webpack-dev-server": "^3.11.0"
},
"scripts": {
"build": "rm -rf lib && webpack --config ./webpack.prod.js",
"start": "webpack-dev-server -w --debug --progress --colors --config ./webpack.dev.js --content-base ./dist --inline --hot --host 0.0.0.0",
"start": "webpack serve --config webpack.dev.js",
"test": "karma start",
"test:chrome": "karma start --browsers Chrome --singleRun=false"
}
Expand Down
60 changes: 40 additions & 20 deletions tests/mergely.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -586,28 +586,48 @@ describe('mergely', function () {
done();
});
});
});

it('should not be vulnerable to XSS', function (done) {
function initXSS(options) {
$('body').get(0).innerHTML = "<!DOCTYPE html><html lang=\"en\"><body><div id='mergely<script id=\"injected\">alert(123)</script>'></div></body></html>";
const divs = document.getElementsByTagName('div');
editor = $(divs[0]);
editor.mergely(options);
return editor;
};
it('should not be vulnerable to XSS', function (done) {
function initXSS(options) {
$('body').get(0).innerHTML = "<!DOCTYPE html><html lang=\"en\"><body><div id='mergely<script id=\"injected\">alert(123)</script>'></div></body></html>";
const divs = document.getElementsByTagName('div');
editor = $(divs[0]);
editor.mergely(options);
return editor;
};

$(document).ready(() => {
const editor = initXSS({
height: 100,
viewport: true,
license: 'lgpl-separate-notice',
lhs: (setValue) => setValue(macbeth),
rhs: (setValue) => setValue(macbeth)
});
expect($('body').find('#injected')).to.have.length(0, 'expected no div with id injected');
const divs = document.getElementsByTagName('div');
expect(divs).to.have.length(1);
expect(divs[0].id).to.equal('mergely<script id="injected">alert(123)</script>');
$(document).ready(() => {
const editor = initXSS({
height: 100,
viewport: true,
license: 'lgpl-separate-notice',
lhs: (setValue) => setValue(macbeth),
rhs: (setValue) => setValue(macbeth)
});
expect($('body').find('#injected')).to.have.length(0, 'expected no div with id injected');
const divs = document.getElementsByTagName('div');
expect(divs).to.have.length(1);
expect(divs[0].id).to.equal('mergely<script id="injected">alert(123)</script>');
done();
});
});

it('should ignore accented characters', function (done) {
$(document).ready(() => {
const editor = init({
height: 100,
license: 'lgpl-separate-notice',
ignoreaccents: true,
lhs: (setValue) => setValue('comunicação'),
rhs: (setValue) => setValue('comunicacao')
});
const { mergely } = $('#mergely');

$('#mergely').on('updated', () => {
console.log('updated');
const diff = $('#mergely').mergely('diff');;
expect(diff).to.equal('');
done();
});
});
Expand Down
9 changes: 2 additions & 7 deletions webpack.dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,7 @@ module.exports = {
}, {
test: /\.css$/,
use: [{
loader: 'style-loader',
options: {
sourceMap: true
}
loader: 'style-loader'
}, {
loader: 'css-loader'
}]
Expand Down Expand Up @@ -69,11 +66,9 @@ module.exports = {
test: /[\\/]node_modules[\\/]/
}
},

chunks: 'async',
minChunks: 1,
minSize: 30000,
name: true
minSize: 30000
}
}
}
12 changes: 7 additions & 5 deletions webpack.prod.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,12 @@ module.exports = {
CodeMirror: 'CodeMirror'
},
plugins: [
new CopyWebpackPlugin([{
from: 'src/mergely.css',
to: 'mergely.css',
toType: 'file'
}])
new CopyWebpackPlugin({
patterns: [{
from: 'src/mergely.css',
to: 'mergely.css',
toType: 'file'
}]
})
]
};

0 comments on commit 85b02ad

Please sign in to comment.