File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2525 "https-proxy-agent" : " ^5.0.0" ,
2626 "jsonwebtoken" : " ^9.0.3" ,
2727 "qs" : " ^6.14.1" ,
28- "scmp" : " ^2.1.0" ,
2928 "xmlbuilder" : " ^13.0.2"
3029 },
3130 "devDependencies" : {
Original file line number Diff line number Diff line change 1- const scmp = require ( "scmp" ) ;
21import crypto from "crypto" ;
32import urllib from "url" ;
43import { IncomingHttpHeaders } from "http2" ;
@@ -257,15 +256,15 @@ function validateSignatureWithUrl(
257256 params
258257 ) ;
259258
260- return scmp ( Buffer . from ( twilioHeader ) , Buffer . from ( signatureWithoutPort ) ) ;
259+ return crypto . timingSafeEqual ( Buffer . from ( twilioHeader ) , Buffer . from ( signatureWithoutPort ) ) ;
261260}
262261
263262export function validateBody (
264263 body : string ,
265264 bodyHash : any [ ] | string | Buffer
266265) : boolean {
267266 var expectedHash = getExpectedBodyHash ( body ) ;
268- return scmp ( Buffer . from ( bodyHash ) , Buffer . from ( expectedHash ) ) ;
267+ return crypto . timingSafeEqual ( Buffer . from ( bodyHash ) , Buffer . from ( expectedHash ) ) ;
269268}
270269
271270/**
You can’t perform that action at this time.
0 commit comments