@infoxchange/make-it-so 2.12.0-internal-testing-odic-verify-proxy-fix.1 → 2.12.0-internal-testing-odic-verify-proxy-fix.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"oidc.d.ts","sourceRoot":"","sources":["../../../src/lib/auth/oidc.ts"],"names":[],"mappings":"AACA,OAAO,EAAsB,UAAU,EAAa,MAAM,MAAM,CAAC;AAEjE,KAAK,uBAAuB,CAAC,UAAU,SAAS,OAAO,GAAG,KAAK,IAAI;IACjE,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,UAAU,CAAC;CACzB,CAAC;AAEF;;;;;;;;;GASG;AACH,wBAAsB,iBAAiB,CAAC,UAAU,SAAS,OAAO,GAAG,KAAK,EAAE,EAC1E,KAAK,EACL,SAAS,EACT,QAAQ,EACR,UAAU,GACX,EAAE,uBAAuB,CAAC,UAAU,CAAC,GAAG,OAAO,CAC9C,UAAU,SAAS,IAAI,GAEf;IAAE,KAAK,EAAE,KAAK,GAAG,OAAO,CAAC;IAAC,OAAO,EAAE,IAAI,CAAA;CAAE,GACzC;IAAE,KAAK,EAAE,IAAI,CAAC;IAAC,OAAO,EAAE,UAAU,CAAA;CAAE,GACxC,UAAU,CACf,
|
|
1
|
+
{"version":3,"file":"oidc.d.ts","sourceRoot":"","sources":["../../../src/lib/auth/oidc.ts"],"names":[],"mappings":"AACA,OAAO,EAAsB,UAAU,EAAa,MAAM,MAAM,CAAC;AAEjE,KAAK,uBAAuB,CAAC,UAAU,SAAS,OAAO,GAAG,KAAK,IAAI;IACjE,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,UAAU,CAAC;CACzB,CAAC;AAEF;;;;;;;;;GASG;AACH,wBAAsB,iBAAiB,CAAC,UAAU,SAAS,OAAO,GAAG,KAAK,EAAE,EAC1E,KAAK,EACL,SAAS,EACT,QAAQ,EACR,UAAU,GACX,EAAE,uBAAuB,CAAC,UAAU,CAAC,GAAG,OAAO,CAC9C,UAAU,SAAS,IAAI,GAEf;IAAE,KAAK,EAAE,KAAK,GAAG,OAAO,CAAC;IAAC,OAAO,EAAE,IAAI,CAAA;CAAE,GACzC;IAAE,KAAK,EAAE,IAAI,CAAC;IAAC,OAAO,EAAE,UAAU,CAAA;CAAE,GACxC,UAAU,CACf,CA+CA"}
|
package/dist/lib/auth/oidc.js
CHANGED
|
@@ -12,7 +12,9 @@ import { createRemoteJWKSet, jwtVerify } from "jose";
|
|
|
12
12
|
*/
|
|
13
13
|
export async function verifyAccessToken({ token, issuerUrl, audience, safeVerify, }) {
|
|
14
14
|
try {
|
|
15
|
+
console.debug("Discovered JWKS URI aa:", issuerUrl);
|
|
15
16
|
const issuer = await Issuer.discover(issuerUrl);
|
|
17
|
+
console.debug("Discovered JWKS URI aa 2");
|
|
16
18
|
const jwksUri = issuer.metadata.jwks_uri;
|
|
17
19
|
if (!jwksUri) {
|
|
18
20
|
throw new Error("JWKS URI not found in issuer metadata");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetch.d.ts","sourceRoot":"","sources":["../../../src/lib/proxy/fetch.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,IAAI,WAAW,EACrB,MAAM,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"fetch.d.ts","sourceRoot":"","sources":["../../../src/lib/proxy/fetch.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,IAAI,WAAW,EACrB,MAAM,QAAQ,CAAC;AAGhB,wBAAgB,kBAAkB,SAcjC;AAED,wBAAgB,eAAe,uBAY9B"}
|
package/dist/lib/proxy/fetch.js
CHANGED
|
@@ -1,12 +1,22 @@
|
|
|
1
1
|
import { setGlobalDispatcher, EnvHttpProxyAgent, fetch as undiciFetch, } from "undici";
|
|
2
|
+
import { bootstrap } from "global-agent";
|
|
2
3
|
export function setupProxyGlobally() {
|
|
4
|
+
// To cover libraries that use fetch
|
|
3
5
|
// See https://nodejs.org/api/globals.html#custom-dispatcher
|
|
4
6
|
// This might stop being needed at some point: https://github.com/actions/create-github-app-token/pull/143#discussion_r1747641337
|
|
5
7
|
const envHttpProxyAgent = new EnvHttpProxyAgent();
|
|
6
8
|
setGlobalDispatcher(envHttpProxyAgent);
|
|
9
|
+
// To cover libraries that use the http/https object
|
|
10
|
+
if (!process.env.GLOBAL_AGENT_HTTP_PROXY) {
|
|
11
|
+
process.env.GLOBAL_AGENT_HTTP_PROXY = process.env.HTTP_PROXY;
|
|
12
|
+
process.env.GLOBAL_AGENT_HTTPS_PROXY =
|
|
13
|
+
process.env.HTTPS_PROXY ?? process.env.HTTP_PROXY;
|
|
14
|
+
}
|
|
15
|
+
bootstrap();
|
|
7
16
|
}
|
|
8
17
|
export function getProxiedFetch() {
|
|
9
18
|
const fetch = (input, init = {}) => {
|
|
19
|
+
console.log("Using proxied fetch for request to:", input);
|
|
10
20
|
if (init.dispatcher) {
|
|
11
21
|
console.warn("A custom dispatcher was provided to fetch but this is ignored as a proxy agent is being used.");
|
|
12
22
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@infoxchange/make-it-so",
|
|
3
|
-
"version": "2.12.0-internal-testing-odic-verify-proxy-fix.
|
|
3
|
+
"version": "2.12.0-internal-testing-odic-verify-proxy-fix.2",
|
|
4
4
|
"description": "Makes deploying services to IX infra easy",
|
|
5
5
|
"repository": "github:infoxchange/make-it-so",
|
|
6
6
|
"type": "module",
|
|
@@ -33,6 +33,7 @@
|
|
|
33
33
|
"@eslint/js": "^9.3.0",
|
|
34
34
|
"@tsconfig/node21": "^21.0.3",
|
|
35
35
|
"@types/aws-cloudfront-function": "^1.0.6",
|
|
36
|
+
"@types/global-agent": "^3.0.0",
|
|
36
37
|
"@types/jsonwebtoken": "^9.0.10",
|
|
37
38
|
"aws-cdk-lib": "2.142.1",
|
|
38
39
|
"constructs": "^10.3.0",
|
|
@@ -54,6 +55,7 @@
|
|
|
54
55
|
"sst": "^2.0.0"
|
|
55
56
|
},
|
|
56
57
|
"dependencies": {
|
|
58
|
+
"global-agent": "^3.0.0",
|
|
57
59
|
"jsonwebtoken": "^9.0.2",
|
|
58
60
|
"undici": "^7.16.0",
|
|
59
61
|
"zod": "^3.24.2"
|
package/src/lib/auth/oidc.ts
CHANGED
|
@@ -31,7 +31,9 @@ export async function verifyAccessToken<SafeVerify extends boolean = false>({
|
|
|
31
31
|
: JWTPayload
|
|
32
32
|
> {
|
|
33
33
|
try {
|
|
34
|
+
console.debug("Discovered JWKS URI aa:", issuerUrl);
|
|
34
35
|
const issuer = await Issuer.discover(issuerUrl);
|
|
36
|
+
console.debug("Discovered JWKS URI aa 2");
|
|
35
37
|
const jwksUri = issuer.metadata.jwks_uri;
|
|
36
38
|
if (!jwksUri) {
|
|
37
39
|
throw new Error("JWKS URI not found in issuer metadata");
|
package/src/lib/proxy/fetch.ts
CHANGED
|
@@ -3,16 +3,27 @@ import {
|
|
|
3
3
|
EnvHttpProxyAgent,
|
|
4
4
|
fetch as undiciFetch,
|
|
5
5
|
} from "undici";
|
|
6
|
+
import { bootstrap } from "global-agent";
|
|
6
7
|
|
|
7
8
|
export function setupProxyGlobally() {
|
|
9
|
+
// To cover libraries that use fetch
|
|
8
10
|
// See https://nodejs.org/api/globals.html#custom-dispatcher
|
|
9
11
|
// This might stop being needed at some point: https://github.com/actions/create-github-app-token/pull/143#discussion_r1747641337
|
|
10
12
|
const envHttpProxyAgent = new EnvHttpProxyAgent();
|
|
11
13
|
setGlobalDispatcher(envHttpProxyAgent);
|
|
14
|
+
|
|
15
|
+
// To cover libraries that use the http/https object
|
|
16
|
+
if (!process.env.GLOBAL_AGENT_HTTP_PROXY) {
|
|
17
|
+
process.env.GLOBAL_AGENT_HTTP_PROXY = process.env.HTTP_PROXY;
|
|
18
|
+
process.env.GLOBAL_AGENT_HTTPS_PROXY =
|
|
19
|
+
process.env.HTTPS_PROXY ?? process.env.HTTP_PROXY;
|
|
20
|
+
}
|
|
21
|
+
bootstrap();
|
|
12
22
|
}
|
|
13
23
|
|
|
14
24
|
export function getProxiedFetch() {
|
|
15
25
|
const fetch: typeof undiciFetch = (input, init = {}) => {
|
|
26
|
+
console.log("Using proxied fetch for request to:", input);
|
|
16
27
|
if (init.dispatcher) {
|
|
17
28
|
console.warn(
|
|
18
29
|
"A custom dispatcher was provided to fetch but this is ignored as a proxy agent is being used.",
|