Skip to content

Commit

Permalink
chore: Update axios to 1.6 to pull in fix for CVE 2023 45857 (#971)
Browse files Browse the repository at this point in the history
* Update axios to 1.6.0

Fixes CVE-2023-45857

* Explicit type return on Promise

TypeScript's automatic type resolution for the promise returned by the
function in getExponentialBackoffResponseHandler determines that it
returns a Promise<unknown>. This commit forces TypeScript to recognize
that the resolved object is of type Promise<AxiosResponse>.

---------

Co-authored-by: Shubham <tiwarishubham635@gmail.com>
  • Loading branch information
kitu-apietila and tiwarishubham635 committed Nov 9, 2023
1 parent e7bbeb1 commit a981eb0
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"url": "https://github.com/twilio/twilio-node.git"
},
"dependencies": {
"axios": "^0.26.1",
"axios": "^1.6.0",
"dayjs": "^1.11.9",
"https-proxy-agent": "^5.0.0",
"jsonwebtoken": "^9.0.0",
Expand Down
2 changes: 1 addition & 1 deletion src/base/RequestClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ function getExponentialBackoffResponseHandler(
);
const delay = Math.floor(baseDelay * Math.random()); // Full jitter backoff

return new Promise((resolve) => {
return new Promise((resolve: (value: Promise<AxiosResponse>) => void) => {
setTimeout(() => resolve(axios(config)), delay);
});
}
Expand Down

0 comments on commit a981eb0

Please sign in to comment.