Skip to content
This repository was archived by the owner on Oct 29, 2025. It is now read-only.

Commit d85ee68

Browse files
authored
Merge pull request #178 from PerimeterX/release/v3.0.1
Release/v3.0.1
2 parents 599abb0 + fb7d818 commit d85ee68

File tree

6 files changed

+20
-3
lines changed

6 files changed

+20
-3
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](http://keepachangelog.com/)
66
and this project adheres to [Semantic Versioning](http://semver.org/).
77

8+
## [3.0.1] - 2021-10-25
9+
10+
### Added
11+
12+
- Compromised credentials header support
13+
814
## [3.0.0] - 2021-09-26
915

1016
### Changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
[PerimeterX](http://www.perimeterx.com) Shared base for NodeJS enforcers
77
=============================================================
88

9-
> Latest stable version: [v3.0.0](https://www.npmjs.com/package/perimeterx-node-core)
9+
> Latest stable version: [v3.0.1](https://www.npmjs.com/package/perimeterx-node-core)
1010
1111
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.
1212

lib/pxconfig.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ const HttpsProxyAgent = require('https-proxy-agent');
44
const pxutil = require('./pxutil');
55
const { ModuleMode } = require('./enums/ModuleMode');
66
const { LoggerSeverity } = require('./enums/LoggerSeverity');
7+
const { DEFAULT_COMPROMISED_CREDENTIALS_HEADER_NAME } = require('./utils/constants');
78

89
class PxConfig {
910
constructor(params, logger) {
@@ -74,6 +75,7 @@ class PxConfig {
7475
['CUSTOM_COOKIE_HEADER', 'px_custom_cookie_header'],
7576
['ENABLE_LOGIN_CREDS_EXTRACTION', 'px_login_credentials_extraction_enabled'],
7677
['LOGIN_CREDS_EXTRACTION', 'px_login_credentials_extraction'],
78+
['COMPROMISED_CREDENTIALS_HEADER', 'px_compromised_credentials_header'],
7779
];
7880

7981
configKeyMapping.forEach(([targetKey, sourceKey]) => {
@@ -300,6 +302,7 @@ function pxDefaultConfig() {
300302
CUSTOM_COOKIE_HEADER: '',
301303
ENABLE_LOGIN_CREDS_EXTRACTION: false,
302304
LOGIN_CREDS_EXTRACTION: [],
305+
COMPROMISED_CREDENTIALS_HEADER: DEFAULT_COMPROMISED_CREDENTIALS_HEADER_NAME,
303306
};
304307
}
305308

@@ -347,6 +350,7 @@ const allowedConfigKeys = [
347350
'px_custom_cookie_header',
348351
'px_login_credentials_extraction_enabled',
349352
'px_login_credentials_extraction',
353+
'px_compromised_credentials_header',
350354
];
351355

352356
module.exports = PxConfig;

lib/pxenforcer.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -384,6 +384,10 @@ class PxEnforcer {
384384
this.setS2SErrorInfo(details, ctx.s2sErrorInfo);
385385
}
386386

387+
if (this._config.ENABLE_LOGIN_CREDS_EXTRACTION && ctx.pxde && ctx.pxdeVerified && ctx.pxde.breached_account) {
388+
req.headers[this._config.COMPROMISED_CREDENTIALS_HEADER] = JSON.stringify(ctx.pxde.breached_account);
389+
}
390+
387391
if (this._config.EXTERNAL_ACTIVITIES && req) {
388392
req.headers['x-px-pagerequested'] = JSON.stringify(
389393
this.pxClient.generateActivity('page_requested', details, ctx, this._config),

lib/utils/constants.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,14 @@ const HOURS_IN_DAY = 24;
55
const DAYS_IN_YEAR = 365;
66
const MILLISECONDS_IN_YEAR = MILLISECONDS_IN_SECOND * SECONDS_IN_MINUTE * MINUTES_IN_HOUR * HOURS_IN_DAY * DAYS_IN_YEAR;
77

8+
const DEFAULT_COMPROMISED_CREDENTIALS_HEADER_NAME = 'px-compromised-credentials';
9+
810
module.exports = {
911
MILLISECONDS_IN_SECOND,
1012
SECONDS_IN_MINUTE,
1113
MINUTES_IN_HOUR,
1214
HOURS_IN_DAY,
1315
DAYS_IN_YEAR,
14-
MILLISECONDS_IN_YEAR
16+
MILLISECONDS_IN_YEAR,
17+
DEFAULT_COMPROMISED_CREDENTIALS_HEADER_NAME
1518
};

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "perimeterx-node-core",
3-
"version": "3.0.0",
3+
"version": "3.0.1",
44
"description": "PerimeterX NodeJS shared core for various applications to monitor and block traffic according to PerimeterX risk score",
55
"main": "index.js",
66
"scripts": {

0 commit comments

Comments
 (0)