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

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.5.1 to 1.5.2

129

dist/iframe.js

@@ -49,2 +49,9 @@ "use strict";

};
var __asyncValues = (this && this.__asyncValues) || function (o) {
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
var m = o[Symbol.asyncIterator], i;
return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
};
var __importDefault = (this && this.__importDefault) || function (mod) {

@@ -66,3 +73,3 @@ return (mod && mod.__esModule) ? mod : { "default": mod };

var mutateSource = function (_a, url, $html) {
var key = _a.key, attribute = _a.attribute, _b = _a.src, src = _b === void 0 ? "" : _b;
var _b = _a.src, src = _b === void 0 ? "" : _b, key = _a.key;
return __awaiter(void 0, void 0, void 0, function () {

@@ -87,3 +94,3 @@ return __generator(this, function (_c) {

source = _a.sent();
$html(key + "[" + attribute + "=\"" + src + "\"]").html(source);
$html(key).html(source);
return [3, 5];

@@ -111,9 +118,9 @@ case 4:

function renderHtml(_a, server) {
var e_2, _b;
var url = _a.url, baseHref = _a.baseHref, config = _a.config;
if (server === void 0) { server = false; }
return __awaiter(this, void 0, void 0, function () {
var cachedHtml, e_2, _b, inline, cors, response, html, $html_1, inlineMutations_2, _i, inlineMutations_1, com, key, attribute, src, e_3;
var _this = this;
return __generator(this, function (_c) {
switch (_c.label) {
var cachedHtml, e_3, _c, inline, cors, response, html, $html_1, inlineMutations_2, _d, _e, key, attribute_1, e_2_1, _i, inlineMutations_1, com, key, attribute, src, element, e_4;
return __generator(this, function (_f) {
switch (_f.label) {
case 0:

@@ -123,8 +130,8 @@ if (!is_url_1["default"](url)) {

}
_c.label = 1;
_f.label = 1;
case 1:
_c.trys.push([1, 3, , 4]);
_f.trys.push([1, 3, , 4]);
return [4, cache_1.appCache.get(url)];
case 2:
cachedHtml = _c.sent();
cachedHtml = _f.sent();
if (cachedHtml) {

@@ -135,13 +142,13 @@ return [2, cheerio_1.load(cachedHtml)];

case 3:
e_2 = _c.sent();
console.error(e_2);
e_3 = _f.sent();
console.error(e_3);
return [3, 4];
case 4:
_b = {
_c = {
inline: __assign(__assign({}, appSourceConfig.inline), config === null || config === void 0 ? void 0 : config.inline),
cors: __assign(__assign({}, appSourceConfig.cors), config === null || config === void 0 ? void 0 : config.cors)
}, inline = _b.inline, cors = _b.cors;
_c.label = 5;
}, inline = _c.inline, cors = _c.cors;
_f.label = 5;
case 5:
_c.trys.push([5, 12, , 13]);
_f.trys.push([5, 25, , 26]);
return [4, isomorphic_unfetch_1["default"](url, {

@@ -151,6 +158,6 @@ headers: config_1.headers

case 6:
response = _c.sent();
response = _f.sent();
return [4, response.text()];
case 7:
html = _c.sent();
html = _f.sent();
$html_1 = cheerio_1.load(html);

@@ -161,31 +168,59 @@ if (!!baseHref) {

inlineMutations_2 = [];
Object.keys(inline).forEach(function (key) {
if (inline[key]) {
var attribute_1 = "src";
$html_1(key).attr(attribute_1, function (_, src) { return __awaiter(_this, void 0, void 0, function () {
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4, inlineMutations_2.push({ key: key, attribute: attribute_1, src: src })];
case 1:
_a.sent();
return [2, src];
}
});
}); });
}
});
_f.label = 8;
case 8:
_f.trys.push([8, 14, 15, 20]);
_d = __asyncValues(Object.keys(inline));
_f.label = 9;
case 9: return [4, _d.next()];
case 10:
if (!(_e = _f.sent(), !_e.done)) return [3, 13];
key = _e.value;
if (!inline[key]) return [3, 12];
attribute_1 = "src";
return [4, $html_1(key).attr(attribute_1, function (_, src) {
if (src) {
inlineMutations_2.push({ key: key, attribute: attribute_1, src: src });
}
return src;
})];
case 11:
_f.sent();
_f.label = 12;
case 12: return [3, 9];
case 13: return [3, 20];
case 14:
e_2_1 = _f.sent();
e_2 = { error: e_2_1 };
return [3, 20];
case 15:
_f.trys.push([15, , 18, 19]);
if (!(_e && !_e.done && (_b = _d["return"]))) return [3, 17];
return [4, _b.call(_d)];
case 16:
_f.sent();
_f.label = 17;
case 17: return [3, 19];
case 18:
if (e_2) throw e_2.error;
return [7];
case 19: return [7];
case 20:
_i = 0, inlineMutations_1 = inlineMutations_2;
_c.label = 8;
case 8:
if (!(_i < inlineMutations_1.length)) return [3, 11];
_f.label = 21;
case 21:
if (!(_i < inlineMutations_1.length)) return [3, 24];
com = inlineMutations_1[_i];
key = com.key, attribute = com.attribute, src = com.src;
return [4, mutateSource({ key: key, attribute: attribute, src: src }, url, $html_1)];
case 9:
_c.sent();
_c.label = 10;
case 10:
element = key + "[" + attribute + "=\"" + src + "\"]";
return [4, mutateSource({ key: element, src: src }, url, $html_1)];
case 22:
_f.sent();
if (attribute === "src") {
$html_1(element).removeAttr(attribute);
}
_f.label = 23;
case 23:
_i++;
return [3, 8];
case 11:
return [3, 21];
case 24:
Object.keys(cors).forEach(function (key) {

@@ -201,7 +236,7 @@ if (cors[key]) {

return [2, $html_1];
case 12:
e_3 = _c.sent();
console.error(e_3);
return [3, 13];
case 13: return [2, renderErrorHtml({ url: url, server: server, noPage: true })];
case 25:
e_4 = _f.sent();
console.error(e_4);
return [3, 26];
case 26: return [2, renderErrorHtml({ url: url, server: server, noPage: true })];
}

@@ -208,0 +243,0 @@ });

{
"name": "node-iframe",
"version": "1.5.1",
"version": "1.5.2",
"description": "create a iframe on your server to bypass CORS issues. ( reverse engineer security issues )",

@@ -5,0 +5,0 @@ "main": "dist/iframe.js",

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