diff --git a/CHANGELOG.md b/CHANGELOG.md index a9c4d07..3080962 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,7 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/). -## [x.x.x] - xxx-x-x +## [3.14.0] - 2024-01-11 ### Added - Support for url decode reserved characters feature diff --git a/README.md b/README.md index 6a55b46..63edc48 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ [PerimeterX](http://www.perimeterx.com) Shared base for NodeJS enforcers ============================================================= -> Latest stable version: [v3.13.0](https://www.npmjs.com/package/perimeterx-node-core) +> Latest stable version: [v3.14.0](https://www.npmjs.com/package/perimeterx-node-core) This is a shared base implementation for PerimeterX Express enforcer and future NodeJS enforcers. For a fully functioning implementation example, see the [Node-Express enforcer](https://github.com/PerimeterX/perimeterx-node-express/) implementation. diff --git a/lib/pxutil.js b/lib/pxutil.js index 6cd7592..e032990 100644 --- a/lib/pxutil.js +++ b/lib/pxutil.js @@ -21,7 +21,7 @@ const { EMAIL_ADDRESS_REGEX, HASH_ALGORITHM } = require('./utils/constants'); */ function getFullUrlFromRequest(req) { - return `${req.protocol}://${req.hostname}${req.originalUrl}`; + return `${req.protocol}://${req.get('host')}${req.originalUrl}`; } function formatHeaders(headers, sensitiveHeaders) { diff --git a/package-lock.json b/package-lock.json index 1947f49..88c7e76 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "perimeterx-node-core", - "version": "3.13.0", + "version": "3.14.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "perimeterx-node-core", - "version": "3.13.0", + "version": "3.14.0", "license": "ISC", "dependencies": { "agent-phin": "^1.0.4", diff --git a/package.json b/package.json index 536b288..6bdf02d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "perimeterx-node-core", - "version": "3.13.0", + "version": "3.14.0", "description": "PerimeterX NodeJS shared core for various applications to monitor and block traffic according to PerimeterX risk score", "main": "index.js", "scripts": { diff --git a/test/pxcors.test.js b/test/pxcors.test.js index ba1c0e1..f3218d2 100644 --- a/test/pxcors.test.js +++ b/test/pxcors.test.js @@ -37,7 +37,11 @@ describe('PX Cors - pxCors.js', () => { req.protocol = 'http'; req.ip = '1.2.3.4'; req.hostname = 'example.com'; + req.host = 'example.com'; req.get = (key) => { + if (key === 'host') { + return req.host; + } return req.headers[key] || ''; }; diff --git a/test/pxenforcer.test.js b/test/pxenforcer.test.js index 50ac461..5c43868 100644 --- a/test/pxenforcer.test.js +++ b/test/pxenforcer.test.js @@ -40,6 +40,9 @@ describe('PX Enforcer - pxenforcer.js', () => { req.ip = '1.2.3.4'; req.hostname = 'example.com'; req.get = (key) => { + if (key === 'host') { + return req.host; + } return req.headers[key] || ''; };