-
Notifications
You must be signed in to change notification settings - Fork 103
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[PW-2059] Mask encrypted/sensitive data in the logs (#164)
* Add maskParametersRecursive() to mask all the sensitive parameters 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 * Use maskParametersRecursive() in logRequest() to mask parameters 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 * Add logResponse() to log response objects Replace the current response object logging with logResponse() * Add getEnvironment() to retrieve the config environment value * fix logResponse() and logRequest() Json decode response before logging because the logResponse expects and array Add paymentData into the list of $paramsToMask for both request and response logging * Change maskParameter() to mask short parameters completely * Add environment as a parameter into the createMockClient() To be able to mock not just test but live configurations as well * Replace testAuthoriseSuccess with testAuthoriseSuccessInTestEnvironment By default in test environment the library will not mask the parameters only in live environment * Add testAuthoriseSuccessInLiveEnvironment() to test authorize in live In live environment the parameters will be masked * Resolve pull request comments Make $paramsToMask in response and $paramsToMask in request to a private static property * Switch maskParameter() from 10 char to 6 char value length
- Loading branch information
1 parent
6026900
commit 3a28b7e
Showing
4 changed files
with
187 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters