diff --git a/CHANGELOG.md b/CHANGELOG.md index 680c6b9..25529dd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,18 @@ 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/). +## [7.9.0] - 2023-12-21 + +### Added + +- Support for header-based logger +- Added `risk_start_time` and `enforcer_start_time` fields to enforcer activities. +- Added `failOnEmptyBody` flag for `callServer` to specify weather or not a request should fail if it has no body. +- Updated the configuration of PX first-party requests to include a connection timeout + +### Changed +- Updated the captcha template to handle empty captcha responses + ## [7.8.0] - 2023-05-16 ### Changed diff --git a/README.md b/README.md index fbdb5e2..fdf01db 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ # [PerimeterX](http://www.perimeterx.com) Express.js Middleware -> Latest stable version: [v7.8.0](https://www.npmjs.com/package/perimeterx-node-express) +> Latest stable version: [v7.9.0](https://www.npmjs.com/package/perimeterx-node-express) ## Table of Contents diff --git a/lib/pxenforcer.js b/lib/pxenforcer.js index dcc7d0a..9746985 100644 --- a/lib/pxenforcer.js +++ b/lib/pxenforcer.js @@ -4,7 +4,7 @@ const { PxEnforcer, PxCdFirstParty } = require('perimeterx-node-core'); const PxExpressClient = require('./pxclient'); const PxCdEnforcer = require('./pxcdenforcer'); -const MODULE_VERSION = 'NodeJS Module v7.8.0'; +const MODULE_VERSION = 'NodeJS Module v7.9.0'; const MILLISECONDS_IN_MINUTE = 60000; function parseCookies(req, res) { @@ -79,8 +79,14 @@ class PerimeterXEnforcer { function pxMiddleware(req, res, next) { parseCookies(req, res).then(() => { enforcer.enforce(req, res, (err, response) => { + let pxContext = null; + if (req.locals && req.locals.pxCtx) { + pxContext = req.locals.pxCtx; + } if (!err && response) { PerimeterXEnforcer.handleCallbackResponse(err, response, res); + + enforcer.sendHeaderBasedLogs(pxContext, enforcer.config.conf, req); } else { //pass saveResponseBody(res); @@ -95,8 +101,12 @@ class PerimeterXEnforcer { enforcer.handleAdditionalS2SActivity(pxCtx, res); } }); + + enforcer.sendHeaderBasedLogs(pxContext, enforcer.config.conf, req); + next(); } + }); }); } diff --git a/package.json b/package.json index 74eba84..036bdeb 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "perimeterx-node-express", - "version": "7.8.0", + "version": "7.9.0", "description": "PerimeterX Express.js middleware to monitor and block traffic according to PerimeterX risk score", "main": "index.js", "directories": { @@ -31,7 +31,7 @@ "dependencies": { "axios": "^0.21.1", "cookie-parser": "^1.4.1", - "perimeterx-node-core": "^3.11.0" + "perimeterx-node-core": "^3.13.0" }, "devDependencies": { "chai": "^4.3.6", diff --git a/px_metadata.json b/px_metadata.json index cf5bf4d..1cb9296 100644 --- a/px_metadata.json +++ b/px_metadata.json @@ -1,5 +1,5 @@ { - "version": "7.8.0", + "version": "7.9.0", "supported_features": [ "additional_activity_handler", "advanced_blocking_response", @@ -12,6 +12,7 @@ "bypass_monitor_header", "client_ip_extraction", "cors_support", + "credentials_intelligence", "csp_support", "css_ref", "cookie_v3", @@ -27,9 +28,9 @@ "filter_by_user_agent", "filter_by_extension", "first_party", + "header_based_logger", "js_ref", "logger", - "credentials_intelligence", "mobile_support", "module_enable", "module_mode", @@ -58,6 +59,14 @@ "test_page_requested_activity_cookie_origin", "test_block_page_hard_block_response", "test_risk_api_validate_cookie_origin", - "test_risk_cookie_valid_cookie_with_user_agent_bigger_than_max_length" + "test_block_activity_headers", + "test_page_requested_activity_headers", + "test_sensitive_headers_removed_from_page_requested", + "test_sensitive_headers_removed_from_block", + "test_risk_api_schema", + "test_block_activity_schema", + "test_page_requested_activity_schema", + "test_risk_cookie_valid_cookie_with_user_agent_bigger_than_max_length", + "test_risk_cookie_validate_client_uuid_in_risk_api" ] } \ No newline at end of file