@forge/csp
Advanced tools
Comparing version 1.4.0 to 1.5.0-next.0
# @forge/csp | ||
## 1.5.0-next.0 | ||
### Minor Changes | ||
- 638194f: Fix logic to detect missing fetch egress permission | ||
## 1.4.0 | ||
@@ -4,0 +10,0 @@ |
@@ -7,6 +7,6 @@ export declare class EgressFilteringService { | ||
private safeURL; | ||
private withoutQueryString; | ||
isValidUrl(url: string): boolean; | ||
private domainCheck; | ||
private domainIsAllowed; | ||
} | ||
//# sourceMappingURL=egress-filtering-service.d.ts.map |
@@ -11,3 +11,3 @@ "use strict"; | ||
.filter((domainOrURL) => !domainOrURL.startsWith('*')) | ||
.map((url) => this.safeURL(url).toString()); | ||
.map((url) => this.safeURL(url)); | ||
this.wildcardDomains = allowList | ||
@@ -23,7 +23,2 @@ .filter((domainOrURL) => domainOrURL !== '*') | ||
} | ||
withoutQueryString(url) { | ||
const parsedURL = this.safeURL(url); | ||
parsedURL.search = ''; | ||
return parsedURL; | ||
} | ||
isValidUrl(url) { | ||
@@ -33,11 +28,7 @@ if (this.allowsEverything) { | ||
} | ||
const urlWithoutQuery = this.withoutQueryString(url); | ||
if (this.URLs.includes(url) || this.URLs.includes(urlWithoutQuery.toString())) { | ||
return true; | ||
} | ||
return this.domainIsAllowed(urlWithoutQuery); | ||
return this.domainIsAllowed(this.safeURL(url)); | ||
} | ||
domainIsAllowed(domain) { | ||
const hostnameMatchedProtocol = this.wildcardDomains | ||
.filter((wildcarded) => wildcarded.protocol === domain.protocol) | ||
domainCheck(domain, allowList) { | ||
const hostnameMatchedProtocol = allowList | ||
.filter((allowed) => allowed.protocol === domain.protocol) | ||
.map((url) => url.hostname); | ||
@@ -48,3 +39,12 @@ return (micromatch_1.default([domain.hostname], hostnameMatchedProtocol, { | ||
} | ||
domainIsAllowed(domain) { | ||
if (this.domainCheck(domain, this.URLs)) { | ||
return true; | ||
} | ||
if (this.domainCheck(domain, this.wildcardDomains)) { | ||
return true; | ||
} | ||
return false; | ||
} | ||
} | ||
exports.EgressFilteringService = EgressFilteringService; |
{ | ||
"name": "@forge/csp", | ||
"version": "1.4.0", | ||
"version": "1.5.0-next.0", | ||
"description": "Contains the CSP configuration for Custom UI resources in Forge", | ||
@@ -14,4 +14,4 @@ "main": "out/index.js", | ||
"devDependencies": { | ||
"@forge/cli-shared": "^1.1.1", | ||
"@forge/manifest": "^1.3.1", | ||
"@forge/cli-shared": "^1.2.1-next.0", | ||
"@forge/manifest": "^1.3.3-next.0", | ||
"@types/jest": "^26.0.0" | ||
@@ -18,0 +18,0 @@ }, |
Sorry, the diff of this file is not supported yet
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
21004
2