Skip to content

Commit

Permalink
Merge pull request #18 from TrueLayer/feature/PLUG-64
Browse files Browse the repository at this point in the history
PLUG-64: Remove client_secret from request body when logging
  • Loading branch information
lighe authored Sep 15, 2023
2 parents 5114a43 + e54e5cc commit 6aad718
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 7 deletions.
15 changes: 11 additions & 4 deletions classes/class-truelayer-logger.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,19 @@ public static function format_log( $truelayer_order_id, $method, $title, $reques
if ( ! is_wp_error( $response ) && isset( $response['OrderHtmlSnippet'] ) ) {// todo check snippet.
unset( $response['OrderHtmlSnippet'] );
}

// Unset the snippet to prevent issues in the request body.
if ( isset( $request_args['body'] ) ) {
$request_body = json_decode( $request_args['body'], true );
if ( isset( $request_body['OrderHtmlSnippet'] ) ) {
unset( $request_body['OrderHtmlSnippet'] );
$request_args['body'] = wp_json_encode( $request_body );
$request_body = json_decode($request_args['body'], true);

if (isset($request_body['OrderHtmlSnippet'])) {
unset($request_body['OrderHtmlSnippet']);
$request_args['body'] = wp_json_encode($request_body);
}

if (isset($request_body['client_secret'])) {
unset($request_body['client_secret']);
$request_args['body'] = wp_json_encode($request_body);
}
}

Expand Down
5 changes: 4 additions & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ WC requires at least: 6.0.0
WC tested up to: 7.6.1
License: GPLv3
License URI: http://www.gnu.org/licenses/gpl-3.0.html
Stable tag: 1.2.0
Stable tag: 1.2.1

TrueLayer for WooCommerce is a plugin that extends WooCommerce, allowing you to take payments via TrueLayer.

Expand Down Expand Up @@ -54,6 +54,9 @@ More information on how to get started can be found in the [plugin documentation
6. Read more about the configuration process in the [plugin documentation](https://docs.krokedil.com/truelayer-for-woocommerce/).

== CHANGELOG ==
= 2023.09.15 - version 1.2.1 =
* Fix - Remove sensitive data from logs

= 2023.05.08 - version 1.2.0 =
* Feature - Added support for embedded payment page for the checkout as a option.
* Feature - Add customer address to the create payment request if we have any.
Expand Down
4 changes: 2 additions & 2 deletions truelayer-for-woocommerce.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* Description: TrueLayer for WooCommerce.
* Author: Krokedil
* Author URI: https://krokedil.com/
* Version: 1.2.0
* Version: 1.2.1
* Text Domain: truelayer-for-woocommerce
* Domain Path: /languages
*
Expand All @@ -29,7 +29,7 @@
define( 'TRUELAYER_WC_MAIN_FILE', __FILE__ );
define( 'TRUELAYER_WC_PLUGIN_PATH', untrailingslashit( plugin_dir_path( __FILE__ ) ) );
define( 'TRUELAYER_WC_PLUGIN_URL', untrailingslashit( plugin_dir_url( __FILE__ ) ) );
define( 'TRUELAYER_WC_PLUGIN_VERSION', '1.2.0' );
define( 'TRUELAYER_WC_PLUGIN_VERSION', '1.2.1' );

if ( ! class_exists( 'TrueLayer_For_WooCommerce' ) ) {
/**
Expand Down

0 comments on commit 6aad718

Please sign in to comment.