@easypost/api
Advanced tools
Comparing version 7.5.1 to 7.5.2
# CHANGELOG | ||
## v7.5.2 (2024-08-16) | ||
- Fixes webhook validation when the `weight` field contains a float by converting it back into a float after conversion from a string (closes #467) | ||
## v7.5.1 (2024-08-09) | ||
@@ -4,0 +8,0 @@ |
{ | ||
"name": "@easypost/api", | ||
"description": "EasyPost Node Client Library", | ||
"version": "7.5.1", | ||
"version": "7.5.2", | ||
"author": "Easypost Engineering <oss@easypost.com>", | ||
@@ -6,0 +6,0 @@ "homepage": "https://easypost.com", |
@@ -123,5 +123,10 @@ import Constants from '../constants'; | ||
// Fixes Javascript's float to string conversion. See https://github.com/EasyPost/easypost-node/issues/467 | ||
const correctedEventBody = Buffer.from(eventBody) | ||
.toString('utf8') | ||
.replace(/("weight":\s*)(\d+)(\s*)(?=,|\})/g, '$1$2.0'); | ||
const expectedSignature = crypto | ||
.createHmac('sha256', encodedSecret) | ||
.update(eventBody, 'utf-8') | ||
.update(correctedEventBody, 'utf-8') | ||
.digest('hex'); | ||
@@ -138,3 +143,3 @@ | ||
) { | ||
webhook = JSON.parse(eventBody.toString()); | ||
webhook = JSON.parse(correctedEventBody); | ||
} else { | ||
@@ -141,0 +146,0 @@ throw new SignatureVerificationError({ message: Constants.WEBHOOK_DOES_NOT_MATCH }); |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
858305
13145
0