npm package diff
Package: @forge/csp
Versions: 3.2.2-experimental-9332276 - 3.2.2-experimental-264fa0f
File: package/out/csp/csp-processing-service.js
Index: package/out/csp/csp-processing-service.js
===================================================================
--- package/out/csp/csp-processing-service.js
+++ package/out/csp/csp-processing-service.js
@@ -1,9 +1,9 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.CSPProcessingService = exports.InvalidConnectSrc = void 0;
const tslib_1 = require("tslib");
-const cheerio_1 = tslib_1.__importDefault(require("cheerio"));
+const cheerio_1 = require("cheerio");
const content_security_policy_parser_1 = tslib_1.__importDefault(require("content-security-policy-parser"));
const crypto_1 = tslib_1.__importDefault(require("crypto"));
class InvalidConnectSrc extends Error {
constructor() {
@@ -27,9 +27,9 @@
}
getCspDetails(body, permissions) {
const { scripts, styles } = permissions?.content ?? { scripts: [], styles: [] };
const external = permissions?.external ?? {};
- const $ = cheerio_1.default.load(body);
+ const $ = (0, cheerio_1.load)(body, { xml: { xmlMode: false } });
const { 'script-src': scriptSrc, 'style-src': styleSrc, ...mappedExternalCsp } = this.mapExternalPermissionsToCsp(external);
return {
'style-src': [...this.getStyleSrc($, styles), ...styleSrc],
'script-src': [...this.getScriptSrc($, scripts), ...scriptSrc],