Socket
Socket
Sign inDemoInstall

node-iframe

Package Overview
Dependencies
Maintainers
1
Versions
74
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-iframe - npm Package Compare versions

Comparing version 1.7.1 to 1.7.2

7

dist/config/index.js
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {

@@ -10,2 +14,3 @@ if (k2 === undefined) k2 = k;

exports.__esModule = true;
exports.url = exports.defaultInlineConfig = exports.defaultCorsConfig = exports.defaultConfig = exports.appHeaders = void 0;
var headers_1 = require("./headers");

@@ -12,0 +17,0 @@ __createBinding(exports, headers_1, "appHeaders");

78

dist/iframe.js

@@ -49,8 +49,5 @@ "use strict";

};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
exports.__esModule = true;
exports.fetchFrame = exports.configureTemplates = exports.configureResourceControl = exports.configureAgent = exports.appSourceConfig = void 0;
var isomorphic_unfetch_1 = __importDefault(require("isomorphic-unfetch"));
var isomorphic_unfetch_1 = require("isomorphic-unfetch");
var cheerio_1 = require("cheerio");

@@ -117,3 +114,3 @@ var utils_1 = require("./utils");

_c.trys.push([1, 6, , 7]);
return [4, isomorphic_unfetch_1["default"](url + "/" + src, {
return [4, (0, isomorphic_unfetch_1["default"])("".concat(url, "/").concat(src), {
headers: headers,

@@ -144,5 +141,5 @@ agent: agent

var url = _a.url, server = _a.server, _b = _a.noPage, noPage = _b === void 0 ? false : _b;
return Object.assign(cheerio_1.load(!url
return Object.assign((0, cheerio_1.load)(!url
? templates_1.templateModel[templates_1.TemplateType.error]
: templates_1.templateModel[templates_1.TemplateType.notFound]), server ? { status: Number("" + 40 + (!url || noPage ? 4 : 0)) } : {});
: templates_1.templateModel[templates_1.TemplateType.notFound]), server ? { status: Number("".concat(40).concat(!url || noPage ? 4 : 0)) } : {});
}

@@ -153,7 +150,7 @@ function renderHtml(_a, server) {

return __awaiter(this, void 0, void 0, function () {
var _c, inline, cors, headers, response, html, $html, inlineMutations_2, _loop_1, _i, _d, key, _e, inlineMutations_1, com, key, attribute, src, element, _f, _g, key, e_2;
var _c, inline, cors, headers, response, e_2, html, $html, inlineMutations_2, _loop_1, _i, _d, key, _e, inlineMutations_1, com, key, attribute, src, element, _f, _g, key, e_3;
return __generator(this, function (_h) {
switch (_h.label) {
case 0:
if (!utils_1.isUrl(url)) {
if (!(0, utils_1.isUrl)(url)) {
return [2, renderErrorHtml({ url: url, server: server })];

@@ -168,4 +165,4 @@ }

case 1:
_h.trys.push([1, 8, , 9]);
return [4, isomorphic_unfetch_1["default"](url, {
_h.trys.push([1, 3, , 4]);
return [4, (0, isomorphic_unfetch_1["default"])(url, {
headers: head,

@@ -176,8 +173,21 @@ agent: agent

response = _h.sent();
return [3, 4];
case 3:
e_2 = _h.sent();
console.error(e_2);
return [3, 4];
case 4:
if (!(response && response.ok)) return [3, 12];
_h.label = 5;
case 5:
_h.trys.push([5, 11, , 12]);
return [4, response.text()];
case 3:
case 6:
html = _h.sent();
$html = cheerio_1.load(html);
if (!html) {
return [2, renderErrorHtml({ url: url, server: server, noPage: true })];
}
$html = (0, cheerio_1.load)(html);
if (!!baseHref) {
$html("head").prepend("<base target=\"_self\" href=\"" + url + "\">");
$html("head").prepend("<base target=\"_self\" href=\"".concat(url, "\">"));
}

@@ -201,17 +211,17 @@ inlineMutations_2 = [];

_e = 0, inlineMutations_1 = inlineMutations_2;
_h.label = 4;
case 4:
if (!(_e < inlineMutations_1.length)) return [3, 7];
_h.label = 7;
case 7:
if (!(_e < inlineMutations_1.length)) return [3, 10];
com = inlineMutations_1[_e];
key = com.key, attribute = com.attribute, src = com.src;
element = key + "[" + attribute + "=\"" + src + "\"]";
element = "".concat(key, "[").concat(attribute, "=\"").concat(src, "\"]");
return [4, mutateSource({ key: element, src: src }, url, $html, headers)];
case 5:
case 8:
_h.sent();
$html(element).removeAttr(attribute);
_h.label = 6;
case 6:
_h.label = 9;
case 9:
_e++;
return [3, 4];
case 7:
return [3, 7];
case 10:
$html("[src=\"undefined\"]").removeAttr("src");

@@ -225,7 +235,7 @@ for (_f = 0, _g = Object.keys(cors); _f < _g.length; _f++) {

return [2, $html];
case 8:
e_2 = _h.sent();
console.error(e_2);
return [3, 9];
case 9: return [2, renderErrorHtml({ url: url, server: server, noPage: true })];
case 11:
e_3 = _h.sent();
console.error(e_3);
return [3, 12];
case 12: return [2, renderErrorHtml({ url: url, server: server, noPage: true })];
}

@@ -237,3 +247,3 @@ });

return __awaiter(this, void 0, void 0, function () {
var $html, e_3;
var $html, e_4;
return __generator(this, function (_a) {

@@ -248,4 +258,4 @@ switch (_a.label) {

case 2:
e_3 = _a.sent();
console.error(e_3);
e_4 = _a.sent();
console.error(e_4);
return [3, 3];

@@ -268,3 +278,3 @@ case 3: return [2];

res.createIframe = function (model) { return __awaiter(_this, void 0, void 0, function () {
var $html, e_4;
var $html, e_5;
return __generator(this, function (_a) {

@@ -282,4 +292,4 @@ switch (_a.label) {

case 2:
e_4 = _a.sent();
console.error(e_4);
e_5 = _a.sent();
console.error(e_5);
return [3, 3];

@@ -286,0 +296,0 @@ case 3: return [2];

"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {

@@ -10,2 +14,3 @@ if (k2 === undefined) k2 = k;

exports.__esModule = true;
exports.templateModel = exports.TemplateType = exports.configureTemplates = exports.NO_URL_TEMPLATE = exports.WEBSITE_NOT_FOUND_TEMPLATE = void 0;
var pages_1 = require("./pages");

@@ -12,0 +17,0 @@ __createBinding(exports, pages_1, "WEBSITE_NOT_FOUND_TEMPLATE");

"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {

@@ -10,2 +14,3 @@ if (k2 === undefined) k2 = k;

exports.__esModule = true;
exports.WEBSITE_NOT_FOUND_TEMPLATE = exports.NO_URL_TEMPLATE = void 0;
var no_url_1 = require("./no-url");

@@ -12,0 +17,0 @@ __createBinding(exports, no_url_1, "NO_URL_TEMPLATE");

"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {

@@ -10,2 +14,3 @@ if (k2 === undefined) k2 = k;

exports.__esModule = true;
exports.URL = exports.isUrl = exports.fetchWithTimestamps = void 0;
var metrics_1 = require("./metrics");

@@ -12,0 +17,0 @@ __createBinding(exports, metrics_1, "fetchWithTimestamps");

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

var url_1 = require("./url");
exports.isUrl = function (domain) {
var isUrl = function (domain) {
if (!domain) {

@@ -20,2 +20,3 @@ return;

};
exports.isUrl = isUrl;
//# sourceMappingURL=is-url.js.map

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

_b.trys.push([1, 3, , 4]);
return [4, iframe_1.fetchFrame({ url: url })];
return [4, (0, iframe_1.fetchFrame)({ url: url })];
case 2:

@@ -63,3 +63,3 @@ res = _b.sent();

t1 = Date.now();
log && console.log((operation || "Operation") + ": " + (t1 - t0) + " milliseconds.");
log && console.log("".concat(operation || "Operation", ": ").concat(t1 - t0, " milliseconds."));
return [2, { res: res, t0: t0, t1: t1 }];

@@ -66,0 +66,0 @@ }

{
"name": "node-iframe",
"version": "1.7.1",
"description": "create a iframe on your server to bypass CORS issues. ( reverse engineer security issues )",
"version": "1.7.2",
"description": "create iframes on your server to bypass CORS issues. ( reverse engineer security issues )",
"main": "dist/iframe.js",

@@ -26,6 +26,6 @@ "scripts": {

"@types/cheerio": "^0.22.31",
"express": "^4.17.1",
"express": "^4.18.1",
"jest": "^26.6.3",
"tscpaths": "0.0.9",
"typescript": "^3.7.5"
"typescript": "4.7.4"
},

@@ -32,0 +32,0 @@ "jest": {

@@ -1,2 +0,1 @@

import { TemplateType } from "./config";
declare const templateModel: {

@@ -3,0 +2,0 @@ 0: string;

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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