Skip to content

XSS vulnerability #347

@soryy708

Description

@soryy708

If you give the mdt-table directive an mdt-row with data, it will gladly turn whatever's in data in to HTML and run scripts.
Workaround:
In TableDataStorageService.prototype.addRowData, iterate rowArray and sanitize.

for(var i in rowArray) {
	if(rowArray[i].value && (typeof rowArray[i].value === 'string' || rowArray[i].value.constructor === String)) {
		rowArray[i].value = rowArray[i].value.
		replace(/<script[^>]*?>.*?<\/script>/gi, '').
		replace(/<[\/\!]*?[^<>]*?>/gi, '').
		replace(/<style[^>]*?>.*?<\/style>/gi, '').
		replace(/<![\s\S]*?--[ \t\n\r]*>/gi, '');
	}
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions