Skip to content

Commit

Permalink
Merge branch 'dev' into feature/remoteConfigurationSupport
Browse files Browse the repository at this point in the history
  • Loading branch information
AsafAklerPX authored Jan 22, 2024
2 parents 2cca40b + a2a81df commit 23ffc23
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 17 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,14 @@ 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.1] - 2024-01-17

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

## [3.15.0] - 2024-01-17 (removed)

## [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.1](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 @@ -114,7 +114,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'],
['REMOTE_CONFIG_ENABLED', 'px_remote_config_enabled'],
Expand Down Expand Up @@ -380,7 +379,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,
REMOTE_CONFIG_ENABLED: false,
Expand Down Expand Up @@ -460,7 +458,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
4 changes: 4 additions & 0 deletions lib/pxenforcer.js
Original file line number Diff line number Diff line change
Expand Up @@ -639,6 +639,10 @@ class PxEnforcer {
cb(htmlTemplate);
});
}

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

module.exports = PxEnforcer;
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;
3 changes: 1 addition & 2 deletions lib/utils/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ 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/';
const INVALID_VERSION_NUMBER = -1;
const HOST_NAME = 'hostname';

module.exports = {
MILLISECONDS_IN_SECOND,
SECONDS_IN_MINUTE,
Expand Down Expand Up @@ -70,7 +70,6 @@ module.exports = {
JWT_ADDITIONAL_FIELDS_FIELD_NAME,
CROSS_TAB_SESSION,
COOKIE_SEPARATOR,
X_PX_ENFORCER_LOG_HEADER,
EXTERNAL_LOGGER_SERVICE_PATH,
INVALID_VERSION_NUMBER,
HOST_NAME
Expand Down
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.1",
"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 23ffc23

Please sign in to comment.