feat(security): add an HTML sanitizer.
This is based on Angular 1's implementation, parsing an HTML document into an inert DOM Document implementation, and then serializing only specifically whitelisted elements. It currently does not support SVG sanitization, all SVG elements are rejected. If available, the sanitizer uses the `<template>` HTML element as an inert container. Sanitization works client and server-side. Reviewers: rjamet, tbosch , molnarg , koto Differential Revision: https://reviews.angular.io/D108
This commit is contained in:
@ -125,6 +125,9 @@ export class BrowserDomAdapter extends GenericBrowserDomAdapter {
|
||||
return evt.defaultPrevented || isPresent(evt.returnValue) && !evt.returnValue;
|
||||
}
|
||||
getInnerHTML(el): string { return el.innerHTML; }
|
||||
getTemplateContent(el): Node {
|
||||
return 'content' in el && el instanceof HTMLTemplateElement ? el.content : null;
|
||||
}
|
||||
getOuterHTML(el): string { return el.outerHTML; }
|
||||
nodeName(node: Node): string { return node.nodeName; }
|
||||
nodeValue(node: Node): string { return node.nodeValue; }
|
||||
|
Reference in New Issue
Block a user