Skip to content

Commit

Permalink
Merge pull request #171 from PerimeterX/feature/added-header-based-lo…
Browse files Browse the repository at this point in the history
…gger

Feature/added header based logger + added`risk_start_time` and `enforcer_start_time` fields to activities
  • Loading branch information
chen-zimmer-px authored Dec 21, 2023
2 parents 83793ed + a21d65a commit f9e2bc8
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 3 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@ 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.X.X] - 2023-XX-XX

### Added

- Support for header-based logger
- Added `sending_risk_timestamp` and `start_enforcer_timestamp` fields to enforcer activities.

## [7.8.0] - 2023-05-16

### Changed
Expand Down
10 changes: 10 additions & 0 deletions lib/pxenforcer.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -95,8 +101,12 @@ class PerimeterXEnforcer {
enforcer.handleAdditionalS2SActivity(pxCtx, res);
}
});

enforcer.sendHeaderBasedLogs(pxContext, enforcer.config.conf, req);

next();
}

});
});
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"dependencies": {
"axios": "^0.21.1",
"cookie-parser": "^1.4.1",
"perimeterx-node-core": "^3.11.0"
"perimeterx-node-core": "^3.12.0"
},
"devDependencies": {
"chai": "^4.3.6",
Expand Down
13 changes: 11 additions & 2 deletions px_metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"bypass_monitor_header",
"client_ip_extraction",
"cors_support",
"credentials_intelligence",
"csp_support",
"css_ref",
"cookie_v3",
Expand All @@ -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",
Expand Down Expand Up @@ -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"
]
}

0 comments on commit f9e2bc8

Please sign in to comment.