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

@authx/http-proxy-client

Package Overview
Dependencies
Maintainers
1
Versions
59
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@authx/http-proxy-client - npm Package Compare versions

Comparing version 1.0.0-beta.4 to 1.0.0-beta.5

31

dist/index.js

@@ -45,17 +45,18 @@ "use strict";

const forward = (options) => {
// Merge `set-cookie` header values with those set by the proxy. ONLY do
// this if the behavior has configured cookiePathRewrite rules, or else
// we risk leaking credentials between targets.
if (options.cookiePathRewrite) {
const setHeader = response.setHeader;
response.setHeader = function (name, value) {
if (name.toLowerCase() === "set-cookie" && Array.isArray(value)) {
const setCookie = response.getHeader("set-cookie");
if (Array.isArray(setCookie)) {
value = [...value, ...setCookie];
}
// Merge `set-cookie` header values with those set by the proxy.
const setHeader = response.setHeader;
response.setHeader = function (name, value) {
if (name.toLowerCase() === "set-cookie") {
const setCookie = response.getHeader("set-cookie");
// Only write the `set-cookie` header if cookiePathRewrite is
// configured, or else we risk leaking credentials between targets.
if (Array.isArray(value) && options.cookiePathRewrite) {
value = Array.isArray(setCookie) ? [...value, ...setCookie] : value;
}
return setHeader.call(response, name, value);
};
}
else {
value = Array.isArray(setCookie) ? setCookie : [];
}
}
return setHeader.call(response, name, value);
};
// Strip out cookies belonging to the proxy.

@@ -67,2 +68,4 @@ if (request.headers.cookie) {

.join("; ");
if (!request.headers.cookie)
delete request.headers.cookie;
}

@@ -69,0 +72,0 @@ this._proxy.web(request, response, options);

@@ -206,4 +206,4 @@ "use strict";

const headers = new node_fetch_1.Headers();
headers.append("cookie", "authx.r=9a64774762a4cdece006b0007e7795eaa1709a34; path=/; httponly");
headers.append("cookie", `authx.t.2jmj7l5rSw0yVb_vlWAYkK_YBwk=eyJhbGciOiJSUzUxMiIsInR5cCI6IkpXVCJ9.eyJzY29wZXMiOltdLCJpYXQiOjE1NTY2MDMxMTAsImV4cCI6NDcxMDIwMzExMCwiYXVkIjoiZmUyNDc4YjUtN2I2MC00Y2VkLWFhZjgtNmM5YjRhMmU3M2Y2IiwiaXNzIjoiYXV0aHgiLCJzdWIiOiIxNmE2MDcyMi1mNzJmLTQyYTEtODRmOC01YWY4MGJhYWMyODkifQ.GEd75BHZP3c4NGv3te9bDLQ9hPV0B6lFxydfuBw-4k9KNP5330xQjrAY4Wu-S9thAGS2cXfHyFWR2cKfBDDno6_NivSJHszBs_ErDSAHCJsZ4Ej1VJmPXpePfXbdAmMd6Ug6dEsmmV1lO_gpICHqnVwj2KWGUPvwbN7VVdufy7g; path=/; httponly`);
headers.append("cookie", "authx.r=9a64774762a4cdece006b0007e7795eaa1709a34");
headers.append("cookie", `authx.t.2jmj7l5rSw0yVb_vlWAYkK_YBwk=eyJhbGciOiJSUzUxMiIsInR5cCI6IkpXVCJ9.eyJzY29wZXMiOltdLCJpYXQiOjE1NTY2MDMxMTAsImV4cCI6NDcxMDIwMzExMCwiYXVkIjoiZmUyNDc4YjUtN2I2MC00Y2VkLWFhZjgtNmM5YjRhMmU3M2Y2IiwiaXNzIjoiYXV0aHgiLCJzdWIiOiIxNmE2MDcyMi1mNzJmLTQyYTEtODRmOC01YWY4MGJhYWMyODkifQ.GEd75BHZP3c4NGv3te9bDLQ9hPV0B6lFxydfuBw-4k9KNP5330xQjrAY4Wu-S9thAGS2cXfHyFWR2cKfBDDno6_NivSJHszBs_ErDSAHCJsZ4Ej1VJmPXpePfXbdAmMd6Ug6dEsmmV1lO_gpICHqnVwj2KWGUPvwbN7VVdufy7g`);
const response = await node_fetch_1.default(`http://127.0.0.1:${port}/admin`, {

@@ -222,4 +222,4 @@ redirect: "manual",

const headers = new node_fetch_1.Headers();
headers.append("cookie", "authx.r=9a64774762a4cdece006b0007e7795eaa1709a34; path=/; httponly");
headers.append("cookie", `authx.t.2jmj7l5rSw0yVb_vlWAYkK_YBwk=eyJhbGciOiJSUzUxMiIsInR5cCI6IkpXVCJ9.eyJzY29wZXMiOltdLCJpYXQiOjE1NTY2MDMxMTAsImV4cCI6NDcxMDIwMzExMCwiYXVkIjoiZmUyNDc4YjUtN2I2MC00Y2VkLWFhZjgtNmM5YjRhMmU3M2Y2IiwiaXNzIjoiYXV0aHgiLCJzdWIiOiIxNmE2MDcyMi1mNzJmLTQyYTEtODRmOC01YWY4MGJhYWMyODkifQ.GEd75BHZP3c4NGv3te9bDLQ9hPV0B6lFxydfuBw-4k9KNP5330xQjrAY4Wu-S9thAGS2cXfHyFWR2cKfBDDno6_NivSJHszBs_ErDSAHCJsZ4Ej1VJmPXpePfXbdAmMd6Ug6dEsmmV1lO_gpICHqnVwj2KWGUPvwbN7VVdufy7g; path=/; httponly`);
headers.append("cookie", "authx.r=9a64774762a4cdece006b0007e7795eaa1709a34");
headers.append("cookie", `authx.t.2jmj7l5rSw0yVb_vlWAYkK_YBwk=eyJhbGciOiJSUzUxMiIsInR5cCI6IkpXVCJ9.eyJzY29wZXMiOltdLCJpYXQiOjE1NTY2MDMxMTAsImV4cCI6NDcxMDIwMzExMCwiYXVkIjoiZmUyNDc4YjUtN2I2MC00Y2VkLWFhZjgtNmM5YjRhMmU3M2Y2IiwiaXNzIjoiYXV0aHgiLCJzdWIiOiIxNmE2MDcyMi1mNzJmLTQyYTEtODRmOC01YWY4MGJhYWMyODkifQ.GEd75BHZP3c4NGv3te9bDLQ9hPV0B6lFxydfuBw-4k9KNP5330xQjrAY4Wu-S9thAGS2cXfHyFWR2cKfBDDno6_NivSJHszBs_ErDSAHCJsZ4Ej1VJmPXpePfXbdAmMd6Ug6dEsmmV1lO_gpICHqnVwj2KWGUPvwbN7VVdufy7g`);
const response = await node_fetch_1.default(`http://127.0.0.1:${port}/api/authx`, {

@@ -226,0 +226,0 @@ method: "POST",

@@ -58,3 +58,3 @@ {

"types": "./dist/index.d.ts",
"version": "1.0.0-beta.4"
"version": "1.0.0-beta.5"
}

@@ -251,10 +251,7 @@ import test from "ava";

const headers = new Headers();
headers.append("cookie", "authx.r=9a64774762a4cdece006b0007e7795eaa1709a34");
headers.append(
"cookie",
"authx.r=9a64774762a4cdece006b0007e7795eaa1709a34; path=/; httponly"
`authx.t.2jmj7l5rSw0yVb_vlWAYkK_YBwk=eyJhbGciOiJSUzUxMiIsInR5cCI6IkpXVCJ9.eyJzY29wZXMiOltdLCJpYXQiOjE1NTY2MDMxMTAsImV4cCI6NDcxMDIwMzExMCwiYXVkIjoiZmUyNDc4YjUtN2I2MC00Y2VkLWFhZjgtNmM5YjRhMmU3M2Y2IiwiaXNzIjoiYXV0aHgiLCJzdWIiOiIxNmE2MDcyMi1mNzJmLTQyYTEtODRmOC01YWY4MGJhYWMyODkifQ.GEd75BHZP3c4NGv3te9bDLQ9hPV0B6lFxydfuBw-4k9KNP5330xQjrAY4Wu-S9thAGS2cXfHyFWR2cKfBDDno6_NivSJHszBs_ErDSAHCJsZ4Ej1VJmPXpePfXbdAmMd6Ug6dEsmmV1lO_gpICHqnVwj2KWGUPvwbN7VVdufy7g`
);
headers.append(
"cookie",
`authx.t.2jmj7l5rSw0yVb_vlWAYkK_YBwk=eyJhbGciOiJSUzUxMiIsInR5cCI6IkpXVCJ9.eyJzY29wZXMiOltdLCJpYXQiOjE1NTY2MDMxMTAsImV4cCI6NDcxMDIwMzExMCwiYXVkIjoiZmUyNDc4YjUtN2I2MC00Y2VkLWFhZjgtNmM5YjRhMmU3M2Y2IiwiaXNzIjoiYXV0aHgiLCJzdWIiOiIxNmE2MDcyMi1mNzJmLTQyYTEtODRmOC01YWY4MGJhYWMyODkifQ.GEd75BHZP3c4NGv3te9bDLQ9hPV0B6lFxydfuBw-4k9KNP5330xQjrAY4Wu-S9thAGS2cXfHyFWR2cKfBDDno6_NivSJHszBs_ErDSAHCJsZ4Ej1VJmPXpePfXbdAmMd6Ug6dEsmmV1lO_gpICHqnVwj2KWGUPvwbN7VVdufy7g; path=/; httponly`
);
const response = await fetch(`http://127.0.0.1:${port}/admin`, {

@@ -277,10 +274,7 @@ redirect: "manual",

const headers = new Headers();
headers.append("cookie", "authx.r=9a64774762a4cdece006b0007e7795eaa1709a34");
headers.append(
"cookie",
"authx.r=9a64774762a4cdece006b0007e7795eaa1709a34; path=/; httponly"
`authx.t.2jmj7l5rSw0yVb_vlWAYkK_YBwk=eyJhbGciOiJSUzUxMiIsInR5cCI6IkpXVCJ9.eyJzY29wZXMiOltdLCJpYXQiOjE1NTY2MDMxMTAsImV4cCI6NDcxMDIwMzExMCwiYXVkIjoiZmUyNDc4YjUtN2I2MC00Y2VkLWFhZjgtNmM5YjRhMmU3M2Y2IiwiaXNzIjoiYXV0aHgiLCJzdWIiOiIxNmE2MDcyMi1mNzJmLTQyYTEtODRmOC01YWY4MGJhYWMyODkifQ.GEd75BHZP3c4NGv3te9bDLQ9hPV0B6lFxydfuBw-4k9KNP5330xQjrAY4Wu-S9thAGS2cXfHyFWR2cKfBDDno6_NivSJHszBs_ErDSAHCJsZ4Ej1VJmPXpePfXbdAmMd6Ug6dEsmmV1lO_gpICHqnVwj2KWGUPvwbN7VVdufy7g`
);
headers.append(
"cookie",
`authx.t.2jmj7l5rSw0yVb_vlWAYkK_YBwk=eyJhbGciOiJSUzUxMiIsInR5cCI6IkpXVCJ9.eyJzY29wZXMiOltdLCJpYXQiOjE1NTY2MDMxMTAsImV4cCI6NDcxMDIwMzExMCwiYXVkIjoiZmUyNDc4YjUtN2I2MC00Y2VkLWFhZjgtNmM5YjRhMmU3M2Y2IiwiaXNzIjoiYXV0aHgiLCJzdWIiOiIxNmE2MDcyMi1mNzJmLTQyYTEtODRmOC01YWY4MGJhYWMyODkifQ.GEd75BHZP3c4NGv3te9bDLQ9hPV0B6lFxydfuBw-4k9KNP5330xQjrAY4Wu-S9thAGS2cXfHyFWR2cKfBDDno6_NivSJHszBs_ErDSAHCJsZ4Ej1VJmPXpePfXbdAmMd6Ug6dEsmmV1lO_gpICHqnVwj2KWGUPvwbN7VVdufy7g; path=/; httponly`
);
const response = await fetch(`http://127.0.0.1:${port}/api/authx`, {

@@ -287,0 +281,0 @@ method: "POST",

@@ -199,18 +199,20 @@ import { createHash, randomBytes } from "crypto";

const forward = (options: ServerOptions): void => {
// Merge `set-cookie` header values with those set by the proxy. ONLY do
// this if the behavior has configured cookiePathRewrite rules, or else
// we risk leaking credentials between targets.
if (options.cookiePathRewrite) {
const setHeader = response.setHeader;
response.setHeader = function(name, value) {
if (name.toLowerCase() === "set-cookie" && Array.isArray(value)) {
const setCookie = response.getHeader("set-cookie");
if (Array.isArray(setCookie)) {
value = [...value, ...setCookie];
}
// Merge `set-cookie` header values with those set by the proxy.
const setHeader = response.setHeader;
response.setHeader = function(name, value) {
if (name.toLowerCase() === "set-cookie") {
const setCookie = response.getHeader("set-cookie");
// Only write the `set-cookie` header if cookiePathRewrite is
// configured, or else we risk leaking credentials between targets.
if (Array.isArray(value) && options.cookiePathRewrite) {
value = Array.isArray(setCookie) ? [...value, ...setCookie] : value;
} else {
value = Array.isArray(setCookie) ? setCookie : [];
}
}
return setHeader.call(response, name, value);
};
}
return setHeader.call(response, name, value);
};

@@ -223,2 +225,4 @@ // Strip out cookies belonging to the proxy.

.join("; ");
if (!request.headers.cookie) delete request.headers.cookie;
}

@@ -225,0 +229,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