Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix/security issues #978

Merged
merged 5 commits into from
Mar 29, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions config.angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"node_modules/eonasdan-bootstrap-datetimepicker/src/js/bootstrap-datetimepicker.js",
"node_modules/nouislider/distribute/nouislider.min.js",
"node_modules/bootstrap-select/dist/js/bootstrap-select.js",
"node_modules/datatables/media/js/jquery.dataTables.js",
"node_modules/datatables.net/js/jquery.dataTables.js",
"node_modules/datatables.net-bs/js/dataTables.bootstrap.js",
"node_modules/datatables.net-responsive/js/dataTables.responsive.js",
"node_modules/bootstrap-tagsinput/dist/bootstrap-tagsinput.js",
Expand Down Expand Up @@ -116,7 +116,7 @@
"node_modules/eonasdan-bootstrap-datetimepicker/src/js/bootstrap-datetimepicker.js",
"node_modules/nouislider/distribute/nouislider.min.js",
"node_modules/bootstrap-select/dist/js/bootstrap-select.js",
"node_modules/datatables/media/js/jquery.dataTables.js",
"node_modules/datatables.net/js/jquery.dataTables.js",
"node_modules/datatables.net-bs/js/dataTables.bootstrap.js",
"node_modules/datatables.net-responsive/js/dataTables.responsive.js",
"node_modules/bootstrap-tagsinput/dist/bootstrap-tagsinput.js",
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "xm-webapp",
"version": "2.0.36",
"version": "2.0.37",
"private": true,
"description": "Xm-webapp",
"homepage": "https://github.com/xm-online/xm-webapp",
Expand Down Expand Up @@ -92,8 +92,8 @@
"chartist": "0.11.4",
"chartist-plugin-zoom": "0.6.0",
"core-js": "2.4.1",
"datatables": "1.10.18",
"datatables.net-bs": "1.10.20",
"datatables.net": "^1.10.22",
"datatables.net-bs": "^1.10.22",
"datatables.net-responsive": "2.2.3",
"eonasdan-bootstrap-datetimepicker": "4.17.47",
"es6-shim": "0.35.5",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import { Component, Input, OnInit, ViewChild } from '@angular/core';
import { TdTextEditorComponent } from '@covalent/text-editor';
import { JsonSchemaFormService } from 'angular2-json-schema-form';

declare const $: any;

@Component({
selector: 'xm-ext-md-editor-widget',
templateUrl: 'ext-md-editor.component.html',
Expand All @@ -19,6 +21,19 @@ export class ExtMdEditorComponent implements OnInit {
promptURLs: true,
spellChecker: false,
showIcons: ['code', 'table'],
previewRender: (plainText, preview) => {
setTimeout(() => {
// for correct parsing in any cases we need to wrap plain text to root tag
if ($($.parseHTML(`<div>${plainText}</div>`)).find('img[onerror]').length > 0) {
// this fix need for security issue: https://github.com/sparksuite/simplemde-markdown-editor/issues/721
const errorText = 'onerror handler is not supported';
preview.innerHTML = errorText;
this._textEditor.writeValue(errorText);
} else {
preview.innerHTML = this._textEditor.simpleMDE.markdown(plainText);
}
});
}
};
@ViewChild('mdEditor', {static: false}) private _textEditor: TdTextEditorComponent;

Expand Down