refactor(core): make HTML sanitizer return TrustedHTML (#39218)
Make Angular's HTML sanitizer return a TrustedHTML, as its output is trusted not to cause XSS vulnerabilities when used in a context where a browser may parse and evaluate HTML. Also update tests to reflect the new behaviour. PR Close #39218
This commit is contained in:
@ -162,7 +162,7 @@ export class DomSanitizerImpl extends DomSanitizer {
|
||||
if (allowSanitizationBypassOrThrow(value, BypassType.Html)) {
|
||||
return unwrapSafeValue(value);
|
||||
}
|
||||
return _sanitizeHtml(this._doc, String(value));
|
||||
return _sanitizeHtml(this._doc, String(value)).toString();
|
||||
case SecurityContext.STYLE:
|
||||
if (allowSanitizationBypassOrThrow(value, BypassType.Style)) {
|
||||
return unwrapSafeValue(value);
|
||||
|
Reference in New Issue
Block a user