@ng-prism/core 22.1.2 → 22.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -301,6 +301,10 @@ export class PrismRendererComponent {
|
|
|
301
301
|
read: ViewContainerRef,
|
|
302
302
|
}, isSignal: true }] }] }); })();
|
|
303
303
|
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(PrismRendererComponent, { className: "PrismRendererComponent", filePath: "app/renderer/prism-renderer.component.ts", lineNumber: 180 }); })();
|
|
304
|
+
// SAFETY: `content` originates from `@Showcase({ variants: [{ content }] })`
|
|
305
|
+
// in developer-authored source code. It is trusted by ng-prism's threat model
|
|
306
|
+
// (see SECURITY.md). Sanitization would strip the Angular component/directive
|
|
307
|
+
// selectors that variant content is meant to project.
|
|
304
308
|
function parseContentToNodes(content) {
|
|
305
309
|
if (typeof content === 'string') {
|
|
306
310
|
return [htmlToNodes(content)];
|
|
@@ -313,10 +317,12 @@ function parseContentToNodes(content) {
|
|
|
313
317
|
if (selector === 'default')
|
|
314
318
|
continue;
|
|
315
319
|
const wrapper = document.createElement('div');
|
|
320
|
+
// SAFETY: trusted developer-authored HTML — see SECURITY.md.
|
|
316
321
|
wrapper.innerHTML = html;
|
|
317
322
|
const nodes = [];
|
|
318
323
|
for (const child of Array.from(wrapper.childNodes)) {
|
|
319
324
|
const el = document.createElement('div');
|
|
325
|
+
// SAFETY: trusted developer-authored HTML — see SECURITY.md.
|
|
320
326
|
el.innerHTML = child.outerHTML ?? child.textContent ?? '';
|
|
321
327
|
const projected = el.firstChild;
|
|
322
328
|
if (projected && projected instanceof Element) {
|
|
@@ -334,6 +340,8 @@ function parseContentToNodes(content) {
|
|
|
334
340
|
}
|
|
335
341
|
return result;
|
|
336
342
|
}
|
|
343
|
+
// SAFETY: see `parseContentToNodes` above and SECURITY.md — `html` is trusted
|
|
344
|
+
// developer-authored variant content from the `@Showcase` decorator.
|
|
337
345
|
function htmlToNodes(html) {
|
|
338
346
|
const wrapper = document.createElement('div');
|
|
339
347
|
wrapper.innerHTML = html;
|
package/package.json
CHANGED