Skip to content

Commit 8d5cd79

Browse files
committed
comments
1 parent 799c738 commit 8d5cd79

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

NEXT_CHANGELOG.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44

55
### New Features and Improvements
66

7-
* Add native support for authentication through Azure DevOps OIDC
7+
* Add native support for authentication through Azure DevOps OIDC.
88

99
### Bug Fixes
10-
* Fix bearer tokens logged in exception messages
10+
* Fix a security issue that resulted in bearer tokens being logged in exception messages.
1111

1212
### Documentation
1313

databricks/sdk/errors/parser.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def _unknown_error(response: requests.Response, debug_headers: bool = False) ->
3737
This error message includes a link to the issue tracker for the SDK for users to report the issue to us.
3838
3939
:param response: The response object from the API request.
40-
:param debug_headers: Whether to include headers in the request log. Defaults to False for security.
40+
:param debug_headers: Whether to include headers in the request log. Defaults to False to defensively handle cases where request headers might contain sensitive data (e.g. tokens).
4141
"""
4242
request_log = RoundTrip(response, debug_headers=debug_headers, debug_truncate_bytes=10 * 1024).generate()
4343
return (

tests/test_errors.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,7 @@ def test_get_api_error(test_case: TestCase):
375375

376376
def test_debug_headers_disabled_by_default():
377377
"""Test that debug_headers=False by default does not leak sensitive headers in unparseable errors."""
378-
# Create a response with Authorization header that cannot be parsed
378+
# Create a response with Authorization header that cannot be parsed.
379379
resp = requests.Response()
380380
resp.status_code = 400
381381
resp.reason = "Bad Request"
@@ -388,7 +388,7 @@ def test_debug_headers_disabled_by_default():
388388
error = parser.get_api_error(resp)
389389

390390
error_message = str(error)
391-
# Verify that sensitive tokens are NOT in the error message
391+
# Verify that sensitive tokens are NOT in the error message.
392392
assert "secret-token-12345" not in error_message
393393
assert "secret-azure-token-67890" not in error_message
394394
assert "Authorization" not in error_message
@@ -397,7 +397,7 @@ def test_debug_headers_disabled_by_default():
397397

398398
def test_debug_headers_enabled_shows_headers():
399399
"""Test that debug_headers=True includes headers in unparseable error messages."""
400-
# Create a response with Authorization header that cannot be parsed
400+
# Create a response with Authorization header that cannot be parsed.
401401
resp = requests.Response()
402402
resp.status_code = 400
403403
resp.reason = "Bad Request"
@@ -410,7 +410,7 @@ def test_debug_headers_enabled_shows_headers():
410410
error = parser.get_api_error(resp)
411411

412412
error_message = str(error)
413-
# Verify that headers ARE included when explicitly enabled
413+
# Verify that headers ARE included when explicitly enabled.
414414
assert "Authorization" in error_message
415415
assert "debug-token-12345" in error_message
416416
assert "X-Databricks-Azure-SP-Management-Token" in error_message

0 commit comments

Comments
 (0)