Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@forge/egress

Package Overview
Dependencies
Maintainers
2
Versions
56
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@forge/egress - npm Package Compare versions

Comparing version 1.1.2 to 1.1.3-next.0

6

CHANGELOG.md
# @forge/egress
## 1.1.3-next.0
### Patch Changes
- 0da2b48: Removed support for the CLI running on node 14
## 1.1.2

@@ -4,0 +10,0 @@

6

out/egress/egress-filtering-service.d.ts

@@ -5,8 +5,8 @@ export declare class EgressFilteringService {

private readonly allowsEverything;
private readonly DEFAULT_PROTOCOL;
constructor(allowList: string[]);
private safeURL;
private parseUrl;
isValidUrl(url: string): boolean;
private domainCheck;
private domainIsAllowed;
private allowedDomain;
}
//# sourceMappingURL=egress-filtering-service.d.ts.map

@@ -9,13 +9,14 @@ "use strict";

constructor(allowList) {
this.URLs = allowList.filter((domainOrURL) => !domainOrURL.startsWith('*')).map((url) => this.safeURL(url));
this.DEFAULT_PROTOCOL = 'https://';
this.URLs = allowList.filter((domainOrURL) => !domainOrURL.startsWith('*')).map((url) => this.parseUrl(url));
this.wildcardDomains = allowList
.filter((domainOrURL) => domainOrURL !== '*')
.map((url) => this.safeURL(url))
.map((url) => this.parseUrl(url))
.filter((url) => decodeURIComponent(url.hostname).startsWith('*'));
this.allowsEverything = allowList.includes('*');
}
safeURL(url, defaultProtocol = 'https://') {
parseUrl(url) {
const protocolRegex = /^(.*:\/\/)/;
const urlParser = url_1.URL !== null && url_1.URL !== void 0 ? url_1.URL : window.URL;
return new urlParser(protocolRegex.test(url) ? url : `${defaultProtocol}${url}`);
return new urlParser(protocolRegex.test(url) ? url : `${this.DEFAULT_PROTOCOL}${url}`);
}

@@ -26,5 +27,6 @@ isValidUrl(url) {

}
return this.domainIsAllowed(this.safeURL(url));
const parsedUrl = this.parseUrl(url);
return this.allowedDomain(parsedUrl, this.URLs) || this.allowedDomain(parsedUrl, this.wildcardDomains);
}
domainCheck(domain, allowList) {
allowedDomain(domain, allowList) {
return allowList

@@ -34,12 +36,3 @@ .filter((allowed) => allowed.protocol === domain.protocol)

}
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/egress",
"version": "1.1.2",
"version": "1.1.3-next.0",
"description": "Helpers and utils for egress implementation in Forge apps",

@@ -5,0 +5,0 @@ "main": "out/index.js",

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc