Skip to content

Commit

Permalink
Merge pull request #303 from PerimeterX/release/v3.15.0
Browse files Browse the repository at this point in the history
Release/v3.15.0 to master
  • Loading branch information
chen-zimmer-px authored Jan 17, 2024
2 parents d333021 + 127023b commit 95b5389
Show file tree
Hide file tree
Showing 9 changed files with 13 additions and 71 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ 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/).


## [3.15.0] - 2024-01-17

### Added
- Removed support for header-based logger feature

## [3.14.0] - 2024-01-11

### Added
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
[PerimeterX](http://www.perimeterx.com) Shared base for NodeJS enforcers
=============================================================

> Latest stable version: [v3.14.0](https://www.npmjs.com/package/perimeterx-node-core)
> Latest stable version: [v3.15.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.

Expand Down
3 changes: 0 additions & 3 deletions lib/pxconfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@ class PxConfig {
['JWT_HEADER_USER_ID_FIELD_NAME', 'px_jwt_header_user_id_field_name'],
['JWT_HEADER_ADDITIONAL_FIELD_NAMES', 'px_jwt_header_additional_field_names'],
['CUSTOM_IS_SENSITIVE_REQUEST', 'px_custom_is_sensitive_request'],
['LOGGER_AUTH_TOKEN', 'px_logger_auth_token'],
['FIRST_PARTY_TIMEOUT_MS', 'px_first_party_timeout_ms'],
['URL_DECODE_RESERVED_CHARACTERS', 'px_url_decode_reserved_characters']
];
Expand Down Expand Up @@ -365,7 +364,6 @@ function pxDefaultConfig() {
JWT_HEADER_USER_ID_FIELD_NAME: '',
JWT_HEADER_ADDITIONAL_FIELD_NAMES: [],
CUSTOM_IS_SENSITIVE_REQUEST: '',
LOGGER_AUTH_TOKEN: '',
FIRST_PARTY_TIMEOUT_MS: 4000,
URL_DECODE_RESERVED_CHARACTERS: false
};
Expand Down Expand Up @@ -441,7 +439,6 @@ const allowedConfigKeys = [
'px_jwt_header_user_id_field_name',
'px_jwt_header_additional_field_names',
'px_custom_is_sensitive_request',
'px_logger_auth_token',
'px_first_party_timeout_ms'
];

Expand Down
13 changes: 3 additions & 10 deletions lib/pxenforcer.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ const {
CI_CREDENTIALS_COMPROMISED_FIELD,
} = require('./utils/constants');
const pxCors = require('./pxcors');
const { LogServiceClient } = require('./pxlogserviceclient');

class PxEnforcer {
constructor(params, client) {
Expand All @@ -48,8 +47,6 @@ class PxEnforcer {

this.reversePrefix = this.pxConfig.conf.PX_APP_ID.substring(2);
this.initializeCredentialsIntelligence(this.logger, this._config);

this.logServiceClient = new LogServiceClient(this._config, this.pxClient);
}

initializeCredentialsIntelligence(logger, config) {
Expand Down Expand Up @@ -642,13 +639,9 @@ class PxEnforcer {
cb(htmlTemplate);
});
}

sendHeaderBasedLogs(pxCtx, config, req) {
const headerValue = pxCtx ? pxCtx.headers[Constants.X_PX_ENFORCER_LOG_HEADER] : req.headers[Constants.X_PX_ENFORCER_LOG_HEADER];
if (headerValue && headerValue === config.LOGGER_AUTH_TOKEN) {
this.logServiceClient.sendLogs(pxCtx, config.logger.logs, req);
}
config.logger.logs = [];

sendHeaderBasedLogs(pxCtx, config, req) { // eslint-disable-line
// Feature has been removed, function definition for backwards compatibility.
}
}

Expand Down
8 changes: 0 additions & 8 deletions lib/pxlogger.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,26 +15,18 @@ class PxLogger {
}

debug(msg) {
this.recordLog(msg, LoggerSeverity.DEBUG);
if (this.debugMode && typeof msg === 'string') {
this.internalLogger.info(`[PerimeterX - DEBUG][${this.appId}] - ${msg}`);
}
}

error(msg) {
this.recordLog(msg, LoggerSeverity.ERROR);
if (this.loggerSeverity !== LoggerSeverity.NONE && typeof msg === 'string') {
this.internalLogger.error(
new Error(`[PerimeterX - ERROR][${this.appId}] - ${msg}`).stack
);
}
}

recordLog(message, loggerSeverity) {
const logRecord = { message: message, severity: loggerSeverity, messageTimestamp: Date.now() };
this.logs.push(logRecord);
}

}

module.exports = PxLogger;
41 changes: 0 additions & 41 deletions lib/pxlogserviceclient.js

This file was deleted.

5 changes: 0 additions & 5 deletions lib/utils/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,6 @@ const JWT_ADDITIONAL_FIELDS_FIELD_NAME = 'jwt_additional_fields';
const CROSS_TAB_SESSION = 'cross_tab_session';
const COOKIE_SEPARATOR = ';';

const X_PX_ENFORCER_LOG_HEADER = 'x-px-enforcer-log';
const EXTERNAL_LOGGER_SERVICE_PATH = '/enforcer-logs/';

module.exports = {
MILLISECONDS_IN_SECOND,
SECONDS_IN_MINUTE,
Expand Down Expand Up @@ -69,6 +66,4 @@ module.exports = {
JWT_ADDITIONAL_FIELDS_FIELD_NAME,
CROSS_TAB_SESSION,
COOKIE_SEPARATOR,
X_PX_ENFORCER_LOG_HEADER,
EXTERNAL_LOGGER_SERVICE_PATH
};
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "perimeterx-node-core",
"version": "3.14.0",
"version": "3.15.0",
"description": "PerimeterX NodeJS shared core for various applications to monitor and block traffic according to PerimeterX risk score",
"main": "index.js",
"scripts": {
Expand Down

0 comments on commit 95b5389

Please sign in to comment.