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.0 to 1.1.1-next.0

6

CHANGELOG.md
# @forge/egress
## 1.1.1-next.0
### Patch Changes
- 63d168c: Fix browser compatibility
## 1.1.0

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

9

out/egress/egress-filtering-service.js

@@ -5,3 +5,3 @@ "use strict";

const tslib_1 = require("tslib");
const micromatch_1 = tslib_1.__importDefault(require("micromatch"));
const minimatch_1 = tslib_1.__importDefault(require("minimatch"));
const url_1 = require("url");

@@ -29,8 +29,5 @@ class EgressFilteringService {

domainCheck(domain, allowList) {
const hostnameMatchedProtocol = allowList
return allowList
.filter((allowed) => allowed.protocol === domain.protocol)
.map((url) => decodeURIComponent(url.hostname));
return (micromatch_1.default([domain.hostname], hostnameMatchedProtocol, {
dot: true
}).length > 0);
.some((url) => minimatch_1.default(domain.hostname, decodeURIComponent(url.hostname)));
}

@@ -37,0 +34,0 @@ domainIsAllowed(domain) {

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.sortAndGroupEgressPermissionsByDomain = void 0;
const tslib_1 = require("tslib");
const micromatch_1 = tslib_1.__importDefault(require("micromatch"));
const minimatch_1 = require("minimatch");
const url_1 = require("url");
const sortAndGroupEgressPermissionsByDomain = (egressAddresses) => {
const protocolRegex = /^(.*?:\/\/)/;
const domainSet = new Set();
const groupSet = new Set();
const removeSet = new Set();
if ((egressAddresses === null || egressAddresses === void 0 ? void 0 : egressAddresses.length) === 0) {
return [];
}
const protocolRegex = /^(.*?:\/\/)/;
const domains = new Set();
const wildcardDomains = [];
egressAddresses.forEach((item) => {

@@ -19,14 +17,16 @@ const itemWithProtocol = protocolRegex.test(item) ? item : `https://${item}`;

if (url.hostname.startsWith('*')) {
groupSet.add(url.hostname.substring(2));
removeSet.add('!' + url.hostname);
domains.add(url.hostname.substring(2));
wildcardDomains.push(minimatch_1.makeRe(url.hostname));
}
else {
domainSet.add(url.hostname);
domains.add(url.hostname);
}
});
if (removeSet.size === 0) {
return [...domainSet];
}
return [...new Set(micromatch_1.default([...domainSet], [...removeSet]).concat([...groupSet]))].sort();
return [...domains].sort().reduce((grouped, domain) => {
if (!wildcardDomains.some((wcd) => wcd.test(domain))) {
grouped.push(domain);
}
return grouped;
}, []);
};
exports.sortAndGroupEgressPermissionsByDomain = sortAndGroupEgressPermissionsByDomain;
{
"name": "@forge/egress",
"version": "1.1.0",
"version": "1.1.1-next.0",
"description": "Helpers and utils for egress implementation in Forge apps",

@@ -17,4 +17,4 @@ "main": "out/index.js",

"dependencies": {
"micromatch": "^4.0.2"
"minimatch": "^5.1.0"
}
}

Sorry, the diff of this file is not supported yet

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