From 7594f962e36e86144b8a2e031ec8b51fe5a4b357 Mon Sep 17 00:00:00 2001 From: Aashish Date: Mon, 29 Aug 2022 11:20:41 +0545 Subject: [PATCH] [ENGA3-297]: Fixed the issue of logging secret key in clear text. --- .github/CODEOWNERS | 10 ++++++++++ omise/request.py | 6 +++++- 2 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 .github/CODEOWNERS diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 0000000..68f4125 --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1,10 @@ +# Lines starting with '#' are comments. +# Each line is a file pattern followed by one or more owners. + +# Order is important. The last matching pattern has the most precedence. +# So if a pull request only touches javascript files, only these owners +# will be requested to review. +# example: *.js @octocat @github/js + +# These owners will be the default owners for everything in the repo. +* @aashishgurung @ajzkk \ No newline at end of file diff --git a/omise/request.py b/omise/request.py index 0d08145..329a917 100644 --- a/omise/request.py +++ b/omise/request.py @@ -85,7 +85,11 @@ def send(self, method, path, payload=None, headers=None): request_headers = self._build_headers(headers) logger.info('Sending HTTP request: %s %s', method.upper(), request_path) - logger.debug('Authorization: %s', self.api_key) + + # Replacing characters with * other than the first 4 characters + display_key = self.api_key[:4] + (len(self.api_key) - 4)*'*' + + logger.debug('Authorization: %s', display_key) logger.debug('Payload: %s', request_payload) logger.debug('Headers: %s', request_headers)