Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PW-2059] Mask encrypted/sensitive data in the logs #164

Merged
merged 11 commits into from
Feb 6, 2020
Merged

Conversation

cyattilakiss
Copy link
Contributor

Description
Mask the encrypted card details and other sensitive data from the logs of the payments requests and responses if the environment is live

attilak added 5 commits February 3, 2020 17:12
Walk through recursively in an associative array containing all the key
path combinations for the sensitive values in the request or response
parameters array
Masking is only effective in live environment

Add maskParameter() to only keep the first 10 characters of the
parameter's value and append 3 asterisks in case the value is not empty
Add parameter list that needs to be masked
Add environment as a required parameter to the logRequest() to determine
if masking needs to be done or not
Masking only needs to be done in live environment
Adjust the existing usage of the logRequest to the new parameters list
Replace the current response object logging with logResponse()
Json decode response before logging because the logResponse expects and
array
Add paymentData into the list of $paramsToMask for both request and
response logging
Copy link
Contributor

@msilvagarcia msilvagarcia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Request some changes to the curl client.

It's also missing test cases for situations when a field should be masked.

src/Adyen/Config.php Outdated Show resolved Hide resolved
src/Adyen/HttpClient/CurlClient.php Outdated Show resolved Hide resolved
src/Adyen/HttpClient/CurlClient.php Outdated Show resolved Hide resolved
@cyattilakiss cyattilakiss changed the title [PW-2059] Mask encrypted/sensitive data in the logs [WIP][PW-2059] Mask encrypted/sensitive data in the logs Feb 4, 2020
attilak added 5 commits February 4, 2020 13:16
To be able to mock not just test but live configurations as well
By default in test environment the library will not mask the parameters
only in live environment
In live environment the parameters will be masked
Make $paramsToMask in response and $paramsToMask in request to a private
static property
@cyattilakiss cyattilakiss changed the title [WIP][PW-2059] Mask encrypted/sensitive data in the logs [PW-2059] Mask encrypted/sensitive data in the logs Feb 4, 2020
msilvagarcia
msilvagarcia previously approved these changes Feb 4, 2020
Comment on lines +397 to +399
if (empty($parameter)) {
return $parameter;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the early return :)

acampos1916
acampos1916 previously approved these changes Feb 5, 2020
@cyattilakiss cyattilakiss merged commit 3a28b7e into develop Feb 6, 2020
@cyattilakiss cyattilakiss deleted the PW-2059 branch February 6, 2020 10:45
@msilvagarcia msilvagarcia mentioned this pull request Feb 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants