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

XSS vulnerability #347

Open
soryy708 opened this issue Nov 9, 2018 · 0 comments
Open

XSS vulnerability #347

soryy708 opened this issue Nov 9, 2018 · 0 comments

Comments

@soryy708
Copy link

soryy708 commented Nov 9, 2018

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, '');
	}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant