Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

Swap away from octokit request

x032205514c7596dbad
diff --git a/backend/package-lock.json b/backend/package-lock.json
index 374b1a4d26..3109b330d9 100644
--- a/backend/package-lock.json
+++ b/backend/package-lock.json
@@ -36,9 +36,10 @@
"@node-saml/passport-saml": "^5.1.0",
"@octokit/auth-app": "^7.1.1",
"@octokit/core": "^5.2.1",
+ "@octokit/endpoint": "^11.0.0",
"@octokit/plugin-paginate-graphql": "^4.0.1",
"@octokit/plugin-retry": "^5.0.5",
- "@octokit/request": "^10.0.3",
+ "@octokit/request-error": "^7.0.0",
"@octokit/rest": "^20.0.2",
"@octokit/webhooks-types": "^7.3.1",
"@octopusdeploy/api-client": "^3.4.1",
@@ -72,6 +73,7 @@
"cron": "^3.1.7",
"dd-trace": "^5.40.0",
"dotenv": "^16.4.1",
+ "fast-content-type-parse": "^3.0.0",
"fastify": "^4.28.1",
"fastify-plugin": "^4.5.1",
"google-auth-library": "^9.9.0",
@@ -125,6 +127,7 @@
"tedious": "^18.2.1",
"tweetnacl": "^1.0.3",
"tweetnacl-util": "^0.15.1",
+ "universal-user-agent": "^7.0.3",
"uuid": "^9.0.1",
"zod": "^3.22.4",
"zod-to-json-schema": "^3.24.5"
@@ -9836,11 +9839,6 @@
"node": "14 || >=16.14"
}
},
- "node_modules/@octokit/auth-app/node_modules/universal-user-agent": {
- "version": "7.0.2",
- "resolved": "https://registry.npmjs.org/universal-user-agent/-/universal-user-agent-7.0.2.tgz",
- "integrity": "sha512-0JCqzSKnStlRRQfCdowvqy3cy0Dvtlb8xecj/H8JFZuCze4rwjPZQOgvFvn0Ws/usCHQFGpyr+pB9adaGwXn4Q=="
- },
"node_modules/@octokit/auth-oauth-app": {
"version": "8.1.1",
"resolved": "https://registry.npmjs.org/@octokit/auth-oauth-app/-/auth-oauth-app-8.1.1.tgz",
@@ -9906,11 +9904,6 @@
"@octokit/openapi-types": "^22.2.0"
}
},
- "node_modules/@octokit/auth-oauth-app/node_modules/universal-user-agent": {
- "version": "7.0.2",
- "resolved": "https://registry.npmjs.org/universal-user-agent/-/universal-user-agent-7.0.2.tgz",
- "integrity": "sha512-0JCqzSKnStlRRQfCdowvqy3cy0Dvtlb8xecj/H8JFZuCze4rwjPZQOgvFvn0Ws/usCHQFGpyr+pB9adaGwXn4Q=="
- },
"node_modules/@octokit/auth-oauth-device": {
"version": "7.1.1",
"resolved": "https://registry.npmjs.org/@octokit/auth-oauth-device/-/auth-oauth-device-7.1.1.tgz",
@@ -9975,11 +9968,6 @@
"@octokit/openapi-types": "^22.2.0"
}
},
- "node_modules/@octokit/auth-oauth-device/node_modules/universal-user-agent": {
- "version": "7.0.2",
- "resolved": "https://registry.npmjs.org/universal-user-agent/-/universal-user-agent-7.0.2.tgz",
- "integrity": "sha512-0JCqzSKnStlRRQfCdowvqy3cy0Dvtlb8xecj/H8JFZuCze4rwjPZQOgvFvn0Ws/usCHQFGpyr+pB9adaGwXn4Q=="
- },
"node_modules/@octokit/auth-oauth-user": {
"version": "5.1.1",
"resolved": "https://registry.npmjs.org/@octokit/auth-oauth-user/-/auth-oauth-user-5.1.1.tgz",
@@ -10045,11 +10033,6 @@
"@octokit/openapi-types": "^22.2.0"
}
},
- "node_modules/@octokit/auth-oauth-user/node_modules/universal-user-agent": {
- "version": "7.0.2",
- "resolved": "https://registry.npmjs.org/universal-user-agent/-/universal-user-agent-7.0.2.tgz",
- "integrity": "sha512-0JCqzSKnStlRRQfCdowvqy3cy0Dvtlb8xecj/H8JFZuCze4rwjPZQOgvFvn0Ws/usCHQFGpyr+pB9adaGwXn4Q=="
- },
"node_modules/@octokit/auth-token": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/@octokit/auth-token/-/auth-token-4.0.0.tgz",
@@ -10070,6 +10053,35 @@
"node": ">= 18"
}
},
+ "node_modules/@octokit/auth-unauthenticated/node_modules/@octokit/openapi-types": {
+ "version": "24.2.0",
+ "resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-24.2.0.tgz",
+ "integrity": "sha512-9sIH3nSUttelJSXUrmGzl7QUBFul0/mB8HRYl3fOlgHbIWG+WnYDXU3v/2zMtAvuzZ/ed00Ei6on975FhBfzrg==",
+ "license": "MIT"
+ },
+ "node_modules/@octokit/auth-unauthenticated/node_modules/@octokit/request-error": {
+ "version": "5.1.1",
+ "resolved": "https://registry.npmjs.org/@octokit/request-error/-/request-error-5.1.1.tgz",
+ "integrity": "sha512-v9iyEQJH6ZntoENr9/yXxjuezh4My67CBSu9r6Ve/05Iu5gNgnisNWOsoJHTP6k0Rr0+HQIpnH+kyammu90q/g==",
+ "license": "MIT",
+ "dependencies": {
+ "@octokit/types": "^13.1.0",
+ "deprecation": "^2.0.0",
+ "once": "^1.4.0"
+ },
+ "engines": {
+ "node": ">= 18"
+ }
+ },
+ "node_modules/@octokit/auth-unauthenticated/node_modules/@octokit/request-error/node_modules/@octokit/types": {
+ "version": "13.10.0",
+ "resolved": "https://registry.npmjs.org/@octokit/types/-/types-13.10.0.tgz",
+ "integrity": "sha512-ifLaO34EbbPj0Xgro4G5lP5asESjwHracYJvVaPIyXMuiuXLlhic3S47cBdTb+jfODkTE5YtGCLt3Ay3+J97sA==",
+ "license": "MIT",
+ "dependencies": {
+ "@octokit/openapi-types": "^24.2.0"
+ }
+ },
"node_modules/@octokit/core": {
"version": "5.2.1",
"resolved": "https://registry.npmjs.org/@octokit/core/-/core-5.2.1.tgz",
@@ -10122,6 +10134,20 @@
"node": ">= 18"
}
},
+ "node_modules/@octokit/core/node_modules/@octokit/request-error": {
+ "version": "5.1.1",
+ "resolved": "https://registry.npmjs.org/@octokit/request-error/-/request-error-5.1.1.tgz",
+ "integrity": "sha512-v9iyEQJH6ZntoENr9/yXxjuezh4My67CBSu9r6Ve/05Iu5gNgnisNWOsoJHTP6k0Rr0+HQIpnH+kyammu90q/g==",
+ "license": "MIT",
+ "dependencies": {
+ "@octokit/types": "^13.1.0",
+ "deprecation": "^2.0.0",
+ "once": "^1.4.0"
+ },
+ "engines": {
+ "node": ">= 18"
+ }
+ },
"node_modules/@octokit/core/node_modules/@octokit/types": {
"version": "13.10.0",
"resolved": "https://registry.npmjs.org/@octokit/types/-/types-13.10.0.tgz",
@@ -10131,6 +10157,12 @@
"@octokit/openapi-types": "^24.2.0"
}
},
+ "node_modules/@octokit/core/node_modules/universal-user-agent": {
+ "version": "6.0.1",
+ "resolved": "https://registry.npmjs.org/universal-user-agent/-/universal-user-agent-6.0.1.tgz",
+ "integrity": "sha512-yCzhz6FN2wU1NiiQRogkTQszlQSlpWaw8SvVegAc+bDxbzHgh1vX8uIe8OYyMH6DwH+sdTJsgMl36+mSMdRJIQ==",
+ "license": "ISC"
+ },
"node_modules/@octokit/endpoint": {
"version": "11.0.0",
"resolved": "https://registry.npmjs.org/@octokit/endpoint/-/endpoint-11.0.0.tgz",
@@ -10159,12 +10191,6 @@
"@octokit/openapi-types": "^25.1.0"
}
},
- "node_modules/@octokit/endpoint/node_modules/universal-user-agent": {
- "version": "7.0.3",
- "resolved": "https://registry.npmjs.org/universal-user-agent/-/universal-user-agent-7.0.3.tgz",
- "integrity": "sha512-TmnEAEAsBJVZM/AADELsK76llnwcf9vMKuPz8JflO1frO8Lchitr0fNaN9d+Ap0BjKtqWqd/J17qeDnXh8CL2A==",
- "license": "ISC"
- },
"node_modules/@octokit/graphql": {
"version": "7.1.1",
"resolved": "https://registry.npmjs.org/@octokit/graphql/-/graphql-7.1.1.tgz",
@@ -10213,6 +10239,20 @@
"node": ">= 18"
}
},
+ "node_modules/@octokit/graphql/node_modules/@octokit/request-error": {
+ "version": "5.1.1",
+ "resolved": "https://registry.npmjs.org/@octokit/request-error/-/request-error-5.1.1.tgz",
+ "integrity": "sha512-v9iyEQJH6ZntoENr9/yXxjuezh4My67CBSu9r6Ve/05Iu5gNgnisNWOsoJHTP6k0Rr0+HQIpnH+kyammu90q/g==",
+ "license": "MIT",
+ "dependencies": {
+ "@octokit/types": "^13.1.0",
+ "deprecation": "^2.0.0",
+ "once": "^1.4.0"
+ },
+ "engines": {
+ "node": ">= 18"
+ }
+ },
"node_modules/@octokit/graphql/node_modules/@octokit/types": {
"version": "13.10.0",
"resolved": "https://registry.npmjs.org/@octokit/types/-/types-13.10.0.tgz",
@@ -10222,6 +10262,12 @@
"@octokit/openapi-types": "^24.2.0"
}
},
+ "node_modules/@octokit/graphql/node_modules/universal-user-agent": {
+ "version": "6.0.1",
+ "resolved": "https://registry.npmjs.org/universal-user-agent/-/universal-user-agent-6.0.1.tgz",
+ "integrity": "sha512-yCzhz6FN2wU1NiiQRogkTQszlQSlpWaw8SvVegAc+bDxbzHgh1vX8uIe8OYyMH6DwH+sdTJsgMl36+mSMdRJIQ==",
+ "license": "ISC"
+ },
"node_modules/@octokit/oauth-authorization-url": {
"version": "7.1.1",
"resolved": "https://registry.npmjs.org/@octokit/oauth-authorization-url/-/oauth-authorization-url-7.1.1.tgz",
@@ -10294,11 +10340,6 @@
"@octokit/openapi-types": "^22.2.0"
}
},
- "node_modules/@octokit/oauth-methods/node_modules/universal-user-agent": {
- "version": "7.0.2",
- "resolved": "https://registry.npmjs.org/universal-user-agent/-/universal-user-agent-7.0.2.tgz",
- "integrity": "sha512-0JCqzSKnStlRRQfCdowvqy3cy0Dvtlb8xecj/H8JFZuCze4rwjPZQOgvFvn0Ws/usCHQFGpyr+pB9adaGwXn4Q=="
- },
"node_modules/@octokit/openapi-types": {
"version": "19.1.0",
"resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-19.1.0.tgz",
@@ -10316,6 +10357,35 @@
"node": ">= 18"
}
},
+ "node_modules/@octokit/plugin-enterprise-compatibility/node_modules/@octokit/openapi-types": {
+ "version": "24.2.0",
+ "resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-24.2.0.tgz",
+ "integrity": "sha512-9sIH3nSUttelJSXUrmGzl7QUBFul0/mB8HRYl3fOlgHbIWG+WnYDXU3v/2zMtAvuzZ/ed00Ei6on975FhBfzrg==",
+ "license": "MIT"
+ },
+ "node_modules/@octokit/plugin-enterprise-compatibility/node_modules/@octokit/request-error": {
+ "version": "5.1.1",
+ "resolved": "https://registry.npmjs.org/@octokit/request-error/-/request-error-5.1.1.tgz",
+ "integrity": "sha512-v9iyEQJH6ZntoENr9/yXxjuezh4My67CBSu9r6Ve/05Iu5gNgnisNWOsoJHTP6k0Rr0+HQIpnH+kyammu90q/g==",
+ "license": "MIT",
+ "dependencies": {
+ "@octokit/types": "^13.1.0",
+ "deprecation": "^2.0.0",
+ "once": "^1.4.0"
+ },
+ "engines": {
+ "node": ">= 18"
+ }
+ },
+ "node_modules/@octokit/plugin-enterprise-compatibility/node_modules/@octokit/request-error/node_modules/@octokit/types": {
+ "version": "13.10.0",
+ "resolved": "https://registry.npmjs.org/@octokit/types/-/types-13.10.0.tgz",
+ "integrity": "sha512-ifLaO34EbbPj0Xgro4G5lP5asESjwHracYJvVaPIyXMuiuXLlhic3S47cBdTb+jfODkTE5YtGCLt3Ay3+J97sA==",
+ "license": "MIT",
+ "dependencies": {
+ "@octokit/openapi-types": "^24.2.0"
+ }
+ },
"node_modules/@octokit/plugin-paginate-graphql": {
"version": "4.0.1",
"resolved": "https://registry.npmjs.org/@octokit/plugin-paginate-graphql/-/plugin-paginate-graphql-4.0.1.tgz",
@@ -10409,68 +10479,25 @@
"@octokit/openapi-types": "^18.0.0"
}
},
- "node_modules/@octokit/request": {
- "version": "10.0.3",
- "resolved": "https://registry.npmjs.org/@octokit/request/-/request-10.0.3.tgz",
- "integrity": "sha512-V6jhKokg35vk098iBqp2FBKunk3kMTXlmq+PtbV9Gl3TfskWlebSofU9uunVKhUN7xl+0+i5vt0TGTG8/p/7HA==",
- "license": "MIT",
- "dependencies": {
- "@octokit/endpoint": "^11.0.0",
- "@octokit/request-error": "^7.0.0",
- "@octokit/types": "^14.0.0",
- "fast-content-type-parse": "^3.0.0",
- "universal-user-agent": "^7.0.2"
- },
- "engines": {
- "node": ">= 20"
- }
- },
"node_modules/@octokit/request-error": {
- "version": "5.1.1",
- "resolved": "https://registry.npmjs.org/@octokit/request-error/-/request-error-5.1.1.tgz",
- "integrity": "sha512-v9iyEQJH6ZntoENr9/yXxjuezh4My67CBSu9r6Ve/05Iu5gNgnisNWOsoJHTP6k0Rr0+HQIpnH+kyammu90q/g==",
+ "version": "7.0.0",
+ "resolved": "https://registry.npmjs.org/@octokit/request-error/-/request-error-7.0.0.tgz",
+ "integrity": "sha512-KRA7VTGdVyJlh0cP5Tf94hTiYVVqmt2f3I6mnimmaVz4UG3gQV/k4mDJlJv3X67iX6rmN7gSHCF8ssqeMnmhZg==",
"license": "MIT",
"dependencies": {
- "@octokit/types": "^13.1.0",
- "deprecation": "^2.0.0",
- "once": "^1.4.0"
+ "@octokit/types": "^14.0.0"
},
"engines": {
- "node": ">= 18"
+ "node": ">= 20"
}
},
"node_modules/@octokit/request-error/node_modules/@octokit/openapi-types": {
- "version": "22.2.0",
- "resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-22.2.0.tgz",
- "integrity": "sha512-QBhVjcUa9W7Wwhm6DBFu6ZZ+1/t/oYxqc2tp81Pi41YNuJinbFRx8B133qVOrAaBbF7D/m0Et6f9/pZt9Rc+tg=="
- },
- "node_modules/@octokit/request-error/node_modules/@octokit/types": {
- "version": "13.6.1",
- "resolved": "https://registry.npmjs.org/@octokit/types/-/types-13.6.1.tgz",
- "integrity": "sha512-PHZE9Z+kWXb23Ndik8MKPirBPziOc0D2/3KH1P+6jK5nGWe96kadZuE4jev2/Jq7FvIfTlT2Ltg8Fv2x1v0a5g==",
- "dependencies": {
- "@octokit/openapi-types": "^22.2.0"
- }
- },
- "node_modules/@octokit/request/node_modules/@octokit/openapi-types": {
"version": "25.1.0",
"resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-25.1.0.tgz",
"integrity": "sha512-idsIggNXUKkk0+BExUn1dQ92sfysJrje03Q0bv0e+KPLrvyqZF8MnBpFz8UNfYDwB3Ie7Z0TByjWfzxt7vseaA==",
"license": "MIT"
},
- "node_modules/@octokit/request/node_modules/@octokit/request-error": {
- "version": "7.0.0",
- "resolved": "https://registry.npmjs.org/@octokit/request-error/-/request-error-7.0.0.tgz",
- "integrity": "sha512-KRA7VTGdVyJlh0cP5Tf94hTiYVVqmt2f3I6mnimmaVz4UG3gQV/k4mDJlJv3X67iX6rmN7gSHCF8ssqeMnmhZg==",
- "license": "MIT",
- "dependencies": {
- "@octokit/types": "^14.0.0"
- },
- "engines": {
- "node": ">= 20"
- }
- },
- "node_modules/@octokit/request/node_modules/@octokit/types": {
+ "node_modules/@octokit/request-error/node_modules/@octokit/types": {
"version": "14.1.0",
"resolved": "https://registry.npmjs.org/@octokit/types/-/types-14.1.0.tgz",
"integrity": "sha512-1y6DgTy8Jomcpu33N+p5w58l6xyt55Ar2I91RPiIA0xCJBXyUAhXCcmZaDWSANiha7R9a6qJJ2CRomGPZ6f46g==",
@@ -10479,28 +10506,6 @@
"@octokit/openapi-types": "^25.1.0"
}
},
- "node_modules/@octokit/request/node_modules/fast-content-type-parse": {
- "version": "3.0.0",
- "resolved": "https://registry.npmjs.org/fast-content-type-parse/-/fast-content-type-parse-3.0.0.tgz",
- "integrity": "sha512-ZvLdcY8P+N8mGQJahJV5G4U88CSvT1rP8ApL6uETe88MBXrBHAkZlSEySdUlyztF7ccb+Znos3TFqaepHxdhBg==",
- "funding": [
- {
- "type": "github",
- "url": "https://github.com/sponsors/fastify"
- },
- {
- "type": "opencollective",
- "url": "https://opencollective.com/fastify"
- }
- ],
- "license": "MIT"
- },
- "node_modules/@octokit/request/node_modules/universal-user-agent": {
- "version": "7.0.3",
- "resolved": "https://registry.npmjs.org/universal-user-agent/-/universal-user-agent-7.0.3.tgz",
- "integrity": "sha512-TmnEAEAsBJVZM/AADELsK76llnwcf9vMKuPz8JflO1frO8Lchitr0fNaN9d+Ap0BjKtqWqd/J17qeDnXh8CL2A==",
- "license": "ISC"
- },
"node_modules/@octokit/rest": {
"version": "20.0.2",
"resolved": "https://registry.npmjs.org/@octokit/rest/-/rest-20.0.2.tgz",
@@ -10550,6 +10555,35 @@
"resolved": "https://registry.npmjs.org/@octokit/webhooks-types/-/webhooks-types-7.3.1.tgz",
"integrity": "sha512-u6355ZsZnHwmxen30SrqnYb1pXieBFkYgkNzt+Ed4Ao5tupN1OErHfzwiV6hq6duGkDAYASbq7/uVJQ69PjLEg=="
},
+ "node_modules/@octokit/webhooks/node_modules/@octokit/openapi-types": {
+ "version": "24.2.0",
+ "resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-24.2.0.tgz",
+ "integrity": "sha512-9sIH3nSUttelJSXUrmGzl7QUBFul0/mB8HRYl3fOlgHbIWG+WnYDXU3v/2zMtAvuzZ/ed00Ei6on975FhBfzrg==",
+ "license": "MIT"
+ },
+ "node_modules/@octokit/webhooks/node_modules/@octokit/request-error": {
+ "version": "5.1.1",
+ "resolved": "https://registry.npmjs.org/@octokit/request-error/-/request-error-5.1.1.tgz",
+ "integrity": "sha512-v9iyEQJH6ZntoENr9/yXxjuezh4My67CBSu9r6Ve/05Iu5gNgnisNWOsoJHTP6k0Rr0+HQIpnH+kyammu90q/g==",
+ "license": "MIT",
+ "dependencies": {
+ "@octokit/types": "^13.1.0",
+ "deprecation": "^2.0.0",
+ "once": "^1.4.0"
+ },
+ "engines": {
+ "node": ">= 18"
+ }
+ },
+ "node_modules/@octokit/webhooks/node_modules/@octokit/types": {
+ "version": "13.10.0",
+ "resolved": "https://registry.npmjs.org/@octokit/types/-/types-13.10.0.tgz",
+ "integrity": "sha512-ifLaO34EbbPj0Xgro4G5lP5asESjwHracYJvVaPIyXMuiuXLlhic3S47cBdTb+jfODkTE5YtGCLt3Ay3+J97sA==",
+ "license": "MIT",
+ "dependencies": {
+ "@octokit/openapi-types": "^24.2.0"
+ }
+ },
"node_modules/@octokit/webhooks/node_modules/@octokit/webhooks-types": {
"version": "7.1.0",
"resolved": "https://registry.npmjs.org/@octokit/webhooks-types/-/webhooks-types-7.1.0.tgz",
@@ -18386,9 +18420,20 @@
]
},
"node_modules/fast-content-type-parse": {
- "version": "1.1.0",
- "resolved": "https://registry.npmjs.org/fast-content-type-parse/-/fast-content-type-parse-1.1.0.tgz",
- "integrity": "sha512-fBHHqSTFLVnR61C+gltJuE5GkVQMV0S2nqUO8TJ+5Z3qAKG8vAx4FKai1s5jq/inV1+sREynIWSuQ6HgoSXpDQ=="
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/fast-content-type-parse/-/fast-content-type-parse-3.0.0.tgz",
+ "integrity": "sha512-ZvLdcY8P+N8mGQJahJV5G4U88CSvT1rP8ApL6uETe88MBXrBHAkZlSEySdUlyztF7ccb+Znos3TFqaepHxdhBg==",
+ "funding": [
+ {
+ "type": "github",
+ "url": "https://github.com/sponsors/fastify"
+ },
+ {
+ "type": "opencollective",
+ "url": "https://opencollective.com/fastify"
+ }
+ ],
+ "license": "MIT"
},
"node_modules/fast-copy": {
"version": "3.0.1",
@@ -18554,6 +18599,12 @@
"resolved": "https://registry.npmjs.org/fastify-plugin/-/fastify-plugin-4.5.1.tgz",
"integrity": "sha512-stRHYGeuqpEZTL1Ef0Ovr2ltazUT9g844X5z/zEBFLG8RYlpDiOCIG+ATvYEp+/zmc7sN29mcIMp8gvYplYPIQ=="
},
+ "node_modules/fastify/node_modules/fast-content-type-parse": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/fast-content-type-parse/-/fast-content-type-parse-1.1.0.tgz",
+ "integrity": "sha512-fBHHqSTFLVnR61C+gltJuE5GkVQMV0S2nqUO8TJ+5Z3qAKG8vAx4FKai1s5jq/inV1+sREynIWSuQ6HgoSXpDQ==",
+ "license": "MIT"
+ },
"node_modules/fastify/node_modules/pino": {
"version": "9.4.0",
"resolved": "https://registry.npmjs.org/pino/-/pino-9.4.0.tgz",
@@ -24905,6 +24956,35 @@
"node": ">= 18"
}
},
+ "node_modules/octokit-auth-probot/node_modules/@octokit/request-error": {
+ "version": "5.1.1",
+ "resolved": "https://registry.npmjs.org/@octokit/request-error/-/request-error-5.1.1.tgz",
+ "integrity": "sha512-v9iyEQJH6ZntoENr9/yXxjuezh4My67CBSu9r6Ve/05Iu5gNgnisNWOsoJHTP6k0Rr0+HQIpnH+kyammu90q/g==",
+ "license": "MIT",
+ "dependencies": {
+ "@octokit/types": "^13.1.0",
+ "deprecation": "^2.0.0",
+ "once": "^1.4.0"
+ },
+ "engines": {
+ "node": ">= 18"
+ }
+ },
+ "node_modules/octokit-auth-probot/node_modules/@octokit/request-error/node_modules/@octokit/openapi-types": {
+ "version": "24.2.0",
+ "resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-24.2.0.tgz",
+ "integrity": "sha512-9sIH3nSUttelJSXUrmGzl7QUBFul0/mB8HRYl3fOlgHbIWG+WnYDXU3v/2zMtAvuzZ/ed00Ei6on975FhBfzrg==",
+ "license": "MIT"
+ },
+ "node_modules/octokit-auth-probot/node_modules/@octokit/request-error/node_modules/@octokit/types": {
+ "version": "13.10.0",
+ "resolved": "https://registry.npmjs.org/@octokit/types/-/types-13.10.0.tgz",
+ "integrity": "sha512-ifLaO34EbbPj0Xgro4G5lP5asESjwHracYJvVaPIyXMuiuXLlhic3S47cBdTb+jfODkTE5YtGCLt3Ay3+J97sA==",
+ "license": "MIT",
+ "dependencies": {
+ "@octokit/openapi-types": "^24.2.0"
+ }
+ },
"node_modules/octokit-auth-probot/node_modules/@octokit/request/node_modules/@octokit/openapi-types": {
"version": "24.2.0",
"resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-24.2.0.tgz",
@@ -24934,6 +25014,12 @@
"jsonwebtoken": "^9.0.2"
}
},
+ "node_modules/octokit-auth-probot/node_modules/universal-user-agent": {
+ "version": "6.0.1",
+ "resolved": "https://registry.npmjs.org/universal-user-agent/-/universal-user-agent-6.0.1.tgz",
+ "integrity": "sha512-yCzhz6FN2wU1NiiQRogkTQszlQSlpWaw8SvVegAc+bDxbzHgh1vX8uIe8OYyMH6DwH+sdTJsgMl36+mSMdRJIQ==",
+ "license": "ISC"
+ },
"node_modules/odbc": {
"version": "2.4.9",
"resolved": "https://registry.npmjs.org/odbc/-/odbc-2.4.9.tgz",
@@ -26307,6 +26393,29 @@
"node": ">= 18"
}
},
+ "node_modules/probot/node_modules/@octokit/request-error": {
+ "version": "5.1.1",
+ "resolved": "https://registry.npmjs.org/@octokit/request-error/-/request-error-5.1.1.tgz",
+ "integrity": "sha512-v9iyEQJH6ZntoENr9/yXxjuezh4My67CBSu9r6Ve/05Iu5gNgnisNWOsoJHTP6k0Rr0+HQIpnH+kyammu90q/g==",
+ "license": "MIT",
+ "dependencies": {
+ "@octokit/types": "^13.1.0",
+ "deprecation": "^2.0.0",
+ "once": "^1.4.0"
+ },
+ "engines": {
+ "node": ">= 18"
+ }
+ },
+ "node_modules/probot/node_modules/@octokit/request-error/node_modules/@octokit/types": {
+ "version": "13.10.0",
+ "resolved": "https://registry.npmjs.org/@octokit/types/-/types-13.10.0.tgz",
+ "integrity": "sha512-ifLaO34EbbPj0Xgro4G5lP5asESjwHracYJvVaPIyXMuiuXLlhic3S47cBdTb+jfODkTE5YtGCLt3Ay3+J97sA==",
+ "license": "MIT",
+ "dependencies": {
+ "@octokit/openapi-types": "^24.2.0"
+ }
+ },
"node_modules/probot/node_modules/@octokit/request/node_modules/@octokit/types": {
"version": "13.10.0",
"resolved": "https://registry.npmjs.org/@octokit/types/-/types-13.10.0.tgz",
@@ -26395,6 +26504,12 @@
"real-require": "^0.2.0"
}
},
+ "node_modules/probot/node_modules/universal-user-agent": {
+ "version": "6.0.1",
+ "resolved": "https://registry.npmjs.org/universal-user-agent/-/universal-user-agent-6.0.1.tgz",
+ "integrity": "sha512-yCzhz6FN2wU1NiiQRogkTQszlQSlpWaw8SvVegAc+bDxbzHgh1vX8uIe8OYyMH6DwH+sdTJsgMl36+mSMdRJIQ==",
+ "license": "ISC"
+ },
"node_modules/proc-log": {
"version": "4.2.0",
"resolved": "https://registry.npmjs.org/proc-log/-/proc-log-4.2.0.tgz",
@@ -30915,9 +31030,10 @@
"integrity": "sha512-G5o6f95b5BggDGuUfKDApKaCgNYy2x7OdHY0zSMF081O0EJobw+1130VONhrA7ezGSV2FNOGyM+KQpQZAr9bIQ=="
},
"node_modules/universal-user-agent": {
- "version": "6.0.1",
- "resolved": "https://registry.npmjs.org/universal-user-agent/-/universal-user-agent-6.0.1.tgz",
- "integrity": "sha512-yCzhz6FN2wU1NiiQRogkTQszlQSlpWaw8SvVegAc+bDxbzHgh1vX8uIe8OYyMH6DwH+sdTJsgMl36+mSMdRJIQ=="
+ "version": "7.0.3",
+ "resolved": "https://registry.npmjs.org/universal-user-agent/-/universal-user-agent-7.0.3.tgz",
+ "integrity": "sha512-TmnEAEAsBJVZM/AADELsK76llnwcf9vMKuPz8JflO1frO8Lchitr0fNaN9d+Ap0BjKtqWqd/J17qeDnXh8CL2A==",
+ "license": "ISC"
},
"node_modules/universalify": {
"version": "2.0.1",
diff --git a/backend/package.json b/backend/package.json
index 7442aa7dd9..85c1d532d5 100644
--- a/backend/package.json
+++ b/backend/package.json
@@ -156,9 +156,10 @@
"@node-saml/passport-saml": "^5.1.0",
"@octokit/auth-app": "^7.1.1",
"@octokit/core": "^5.2.1",
+ "@octokit/endpoint": "^11.0.0",
"@octokit/plugin-paginate-graphql": "^4.0.1",
"@octokit/plugin-retry": "^5.0.5",
- "@octokit/request": "^10.0.3",
+ "@octokit/request-error": "^7.0.0",
"@octokit/rest": "^20.0.2",
"@octokit/webhooks-types": "^7.3.1",
"@octopusdeploy/api-client": "^3.4.1",
@@ -192,6 +193,7 @@
"cron": "^3.1.7",
"dd-trace": "^5.40.0",
"dotenv": "^16.4.1",
+ "fast-content-type-parse": "^3.0.0",
"fastify": "^4.28.1",
"fastify-plugin": "^4.5.1",
"google-auth-library": "^9.9.0",
@@ -245,6 +247,7 @@
"tedious": "^18.2.1",
"tweetnacl": "^1.0.3",
"tweetnacl-util": "^0.15.1",
+ "universal-user-agent": "^7.0.3",
"uuid": "^9.0.1",
"zod": "^3.22.4",
"zod-to-json-schema": "^3.24.5"
diff --git a/backend/src/services/app-connection/github/github-connection-fns.ts b/backend/src/services/app-connection/github/github-connection-fns.ts
index c1542bbd9d..8ed8c46098 100644
--- a/backend/src/services/app-connection/github/github-connection-fns.ts
+++ b/backend/src/services/app-connection/github/github-connection-fns.ts
@@ -1,5 +1,4 @@
import { createAppAuth } from "@octokit/auth-app";
-import { request } from "@octokit/request";
import { AxiosError, AxiosRequestConfig, AxiosResponse } from "axios";
import https from "https";
import RE2 from "re2";
@@ -17,6 +16,7 @@ import { getAppConnectionMethodName } from "@app/services/app-connection/app-con
import { AppConnection } from "../app-connection-enums";
import { GitHubConnectionMethod } from "./github-connection-enums";
import { TGitHubConnection, TGitHubConnectionConfig } from "./github-connection-types";
+import { request } from "./octokit-request";
export const getGitHubConnectionListItem = () => {
const { INF_APP_CONNECTION_GITHUB_OAUTH_CLIENT_ID, INF_APP_CONNECTION_GITHUB_APP_SLUG } = getConfig();
diff --git a/backend/src/services/app-connection/github/octokit-request.ts b/backend/src/services/app-connection/github/octokit-request.ts
new file mode 100644
index 0000000000..8a37eacafe
--- /dev/null
+++ b/backend/src/services/app-connection/github/octokit-request.ts
@@ -0,0 +1,260 @@
+/* eslint-disable @typescript-eslint/ban-types */
+/* eslint-disable func-names */
+/* eslint-disable @typescript-eslint/no-shadow */
+/* eslint-disable @typescript-eslint/no-unsafe-call */
+/* eslint-disable prefer-destructuring */
+/* eslint-disable @typescript-eslint/no-unsafe-argument */
+/* eslint-disable @typescript-eslint/no-explicit-any */
+/* eslint-disable @typescript-eslint/no-unsafe-member-access */
+/* eslint-disable @typescript-eslint/no-unsafe-assignment */
+/* eslint-disable @typescript-eslint/restrict-template-expressions */
+/* eslint-disable @typescript-eslint/no-unsafe-return */
+
+// Credit: https://github.com/octokit/request.js
+
+import { endpoint } from "@octokit/endpoint";
+import { RequestError } from "@octokit/request-error";
+import type {
+ EndpointInterface,
+ EndpointOptions,
+ OctokitResponse,
+ RequestInterface,
+ RequestParameters,
+ Route
+} from "@octokit/types";
+import { safeParse } from "fast-content-type-parse";
+import { getUserAgent } from "universal-user-agent";
+
+type ContentType = ReturnType<typeof safeParse>;
+
+function isJSONResponse(mimetype: ContentType): boolean {
+ return mimetype.type === "application/json" || mimetype.type === "application/scim+json";
+}
+
+async function getResponseData(response: Response): Promise<any> {
+ const contentType = response.headers.get("content-type");
+
+ if (!contentType) {
+ return response.text().catch(() => "");
+ }
+
+ const mimetype = safeParse(contentType);
+
+ if (isJSONResponse(mimetype)) {
+ let text = "";
+ try {
+ text = await response.text();
+ return JSON.parse(text);
+ } catch (err) {
+ return text;
+ }
+ } else if (mimetype.type.startsWith("text/") || mimetype.parameters.charset?.toLowerCase() === "utf-8") {
+ return response.text().catch(() => "");
+ } else {
+ return response.arrayBuffer().catch(() => new ArrayBuffer(0));
+ }
+}
+
+function toErrorMessage(data: string | ArrayBuffer | Record<string, unknown>) {
+ if (typeof data === "string") {
+ return data;
+ }
+
+ if (data instanceof ArrayBuffer) {
+ return "Unknown error";
+ }
+
+ if ("message" in data) {
+ const suffix = "documentation_url" in data ? ` - ${data.documentation_url}` : "";
+
+ return Array.isArray(data.errors)
+ ? `${data.message}: ${data.errors.map((v) => JSON.stringify(v)).join(", ")}${suffix}`
+ : `${data.message}${suffix}`;
+ }
+
+ return `Unknown error: ${JSON.stringify(data)}`;
+}
+
+function isPlainObject(value: unknown): value is Object {
+ if (typeof value !== "object" || value === null) return false;
+
+ if (Object.prototype.toString.call(value) !== "[object Object]") return false;
+
+ const proto = Object.getPrototypeOf(value);
+ if (proto === null) return true;
+
+ const Ctor = Object.prototype.hasOwnProperty.call(proto, "constructor") && proto.constructor;
+ return (
+ typeof Ctor === "function" &&
+ Ctor instanceof Ctor &&
+ Function.prototype.call(Ctor) === Function.prototype.call(value)
+ );
+}
+
+async function fetchWrapper(requestOptions: ReturnType<EndpointInterface>): Promise<OctokitResponse<any>> {
+ const fetch: typeof globalThis.fetch = requestOptions.request?.fetch || globalThis.fetch;
+
+ if (!fetch) {
+ throw new Error(
+ "fetch is not set. Please pass a fetch implementation as new Octokit({ request: { fetch }}). Learn more at https://github.com/octokit/octokit.js/#fetch-missing"
+ );
+ }
+
+ const log = requestOptions.request?.log || console;
+ const parseSuccessResponseBody = requestOptions.request?.parseSuccessResponseBody !== false;
+
+ const body =
+ isPlainObject(requestOptions.body) || Array.isArray(requestOptions.body)
+ ? JSON.stringify(requestOptions.body)
+ : requestOptions.body;
+
+ // Header values must be `string`
+ const requestHeaders = Object.fromEntries(
+ Object.entries(requestOptions.headers).map(([name, value]) => [name, String(value)])
+ );
+
+ let fetchResponse: Response;
+
+ try {
+ fetchResponse = await fetch(requestOptions.url, {
+ method: requestOptions.method,
+ body,
+ redirect: requestOptions.request?.redirect,
+ headers: requestHeaders,
+ signal: requestOptions.request?.signal,
+ // duplex must be set if request.body is ReadableStream or Async Iterables.
+ // See https://fetch.spec.whatwg.org/#dom-requestinit-duplex.
+ ...(requestOptions.body && { duplex: "half" })
+ });
+ // wrap fetch errors as RequestError if it is not a AbortError
+ } catch (error) {
+ let message = "Unknown Error";
+ if (error instanceof Error) {
+ if (error.name === "AbortError") {
+ (error as RequestError).status = 500;
+ throw error;
+ }
+
+ message = error.message;
+
+ // undici throws a TypeError for network errors
+ // and puts the error message in `error.cause`
+ // https://github.com/nodejs/undici/blob/e5c9d703e63cd5ad691b8ce26e3f9a81c598f2e3/lib/fetch/index.js#L227
+ if (error.name === "TypeError" && "cause" in error) {
+ if (error.cause instanceof Error) {
+ message = error.cause.message;
+ } else if (typeof error.cause === "string") {
+ message = error.cause;
+ }
+ }
+ }
+
+ const requestError = new RequestError(message, 500, {
+ request: requestOptions
+ });
+ requestError.cause = error;
+
+ throw requestError;
+ }
+
+ const status = fetchResponse.status;
+ const url = fetchResponse.url;
+ const responseHeaders: { [header: string]: string } = {};
+
+ fetchResponse.headers.forEach((value, key) => {
+ responseHeaders[key] = value;
+ });
+
+ const octokitResponse: OctokitResponse<any> = {
+ url,
+ status,
+ headers: responseHeaders,
+ data: ""
+ };
+
+ if ("deprecation" in responseHeaders) {
+ const matches = responseHeaders.link && responseHeaders.link.match(/<([^<>]+)>; rel="deprecation"/);
+ const deprecationLink = matches && matches.pop();
+ log.warn(
+ `[@octokit/request] "${requestOptions.method} ${
+ requestOptions.url
+ }" is deprecated. It is scheduled to be removed on ${responseHeaders.sunset}${
+ deprecationLink ? `. See ${deprecationLink}` : ""
+ }`
+ );
+ }
+
+ if (status === 204 || status === 205) {
+ return octokitResponse;
+ }
+
+ // GitHub API returns 200 for HEAD requests
+ if (requestOptions.method === "HEAD") {
+ if (status < 400) {
+ return octokitResponse;
+ }
+
+ throw new RequestError(fetchResponse.statusText, status, {
+ response: octokitResponse,
+ request: requestOptions
+ });
+ }
+
+ if (status === 304) {
+ octokitResponse.data = await getResponseData(fetchResponse);
+
+ throw new RequestError("Not modified", status, {
+ response: octokitResponse,
+ request: requestOptions
+ });
+ }
+
+ if (status >= 400) {
+ octokitResponse.data = await getResponseData(fetchResponse);
+
+ throw new RequestError(toErrorMessage(octokitResponse.data), status, {
+ response: octokitResponse,
+ request: requestOptions
+ });
+ }
+
+ octokitResponse.data = parseSuccessResponseBody ? await getResponseData(fetchResponse) : fetchResponse.body;
+
+ return octokitResponse;
+}
+
+function withDefaults(oldEndpoint: EndpointInterface, newDefaults: RequestParameters): RequestInterface {
+ const endpoint = oldEndpoint.defaults(newDefaults);
+ const newApi = function (
+ route: Route | EndpointOptions,
+ parameters?: RequestParameters
+ ): Promise<OctokitResponse<any>> {
+ const endpointOptions = endpoint.merge(<Route>route, parameters);
+
+ if (!endpointOptions.request || !endpointOptions.request.hook) {
+ return fetchWrapper(endpoint.parse(endpointOptions));
+ }
+
+ const request = (route: Route | EndpointOptions, parameters?: RequestParameters) => {
+ return fetchWrapper(endpoint.parse(endpoint.merge(<Route>route, parameters)));
+ };
+
+ Object.assign(request, {
+ endpoint,
+ defaults: withDefaults.bind(null, endpoint)
+ });
+
+ return endpointOptions.request.hook(request, endpointOptions);
+ };
+
+ return Object.assign(newApi, {
+ endpoint,
+ defaults: withDefaults.bind(null, endpoint)
+ }) as RequestInterface<typeof endpoint.DEFAULTS & typeof newDefaults>;
+}
+
+export const request = withDefaults(endpoint, {
+ headers: {
+ "user-agent": `octokit-request.js/0.0.0-development ${getUserAgent()}`
+ }
+});