Skip to content

Commit

Permalink
Prevent accidental credential logging on BindFailure. Log only a list…
Browse files Browse the repository at this point in the history
… of key names, but not the values (#10264)

Co-authored-by: LennyArdiles <[email protected]>
  • Loading branch information
LennyArdiles and LennyArdiles authored Jul 24, 2023
1 parent 77a00cf commit 26b542c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/prefect/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ def from_bind_failure(

base = f"Error binding parameters for function '{fn.__name__}': {exc}"
signature = f"Function '{fn.__name__}' has signature '{fn_signature}'"
received = f"received args: {call_args} and kwargs: {call_kwargs}"
received = f"received args: {call_args} and kwargs: {list(call_kwargs.keys())}"
msg = f"{base}.\n{signature} but {received}."
return cls(msg)

Expand Down
4 changes: 2 additions & 2 deletions tests/test_exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ def fn(a: int, b: str):
type_error = TypeError("Demo TypeError")
expected_str = (
"Error binding parameters for function 'fn': Demo TypeError.\nFunction 'fn'"
" has signature 'a: int, b: str' but received args: () and kwargs: {'c': 3,"
" 'd': 'test'}."
" has signature 'a: int, b: str' but received args: () and kwargs: ['c',"
" 'd']."
)
pbe = ParameterBindError.from_bind_failure(
fn, type_error, (), {"c": 3, "d": "test"}
Expand Down

0 comments on commit 26b542c

Please sign in to comment.