Skip to content

Commit 4e6b9f2

Browse files
committed
mask access token when logging OAuth token refresh response
1 parent 0764b63 commit 4e6b9f2

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

airbyte_cdk/sources/streams/http/requests_native_auth/abstract_oauth.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,10 +217,15 @@ def _make_handled_request(self) -> Any:
217217
data=self.build_refresh_request_body(),
218218
headers=self.build_refresh_request_headers(),
219219
)
220+
response_json = response.json()
221+
# extract the access token and add to secrets to avoid logging the raw value
222+
access_key = self._extract_access_token(response_json)
223+
if access_key:
224+
add_to_secrets(access_key)
220225
# log the response even if the request failed for troubleshooting purposes
221226
self._log_response(response)
222227
response.raise_for_status()
223-
return response.json()
228+
return response_json
224229
except requests.exceptions.RequestException as e:
225230
if e.response is not None:
226231
if e.response.status_code == 429 or e.response.status_code >= 500:

0 commit comments

Comments
 (0)