4 ms·
Hm, wouldn't the proper way to defend against such mutation attacks be to run parse-then-serialize in a loop until the output stabilizes? And throw some sort o
by Sniffnoy 6y ago
Hm, wouldn't the proper way to defend against such mutation attacks be to run parse-then-serialize in a loop until the output stabilizes? And throw some sort of error if it takes too many iterations. Only after stabilization would you go making any sort of modifications.
Although, I guess, now that I think about it, the fact that you are making modifications means I guess there could still be attacks that rely on mutations that potentially happen after those modifications...
- securitymb 6y agoThis would work and this something that Angular DomSanitizer does [1]. But I personally am not a big fan of this solution as it has large performance penalty if the sanitized string is huge. [1] https://github.com/angular/angular/blob/2038568f3e631cb15e9149945692e98ad2c8729d/packages/core/src/sanitization/html_sanitizer.ts#L253 https://github.com/angular/angular/blob/2038568f3e631cb15e91...