-
Notifications
You must be signed in to change notification settings - Fork 156
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] warning message dumps large amount of data to stdout #537
Comments
I think we should improve the code on our end. I am just pointing out that maybe data should not be logged out to stdout by default. |
@DavidCain do you think it will be possible to turn warnings off with a config flag? |
@george-zubrienko - oh absolutely, one could definitely make a config flag if desired. However, I think @s4ke makes a solid point though about having sensible logging as the default -- it's probably not wise to log the entirety of the payload when the warning message simply needs to say that the Just to be clear, though, I believe this is a different warning than the one I recently added. The warning message in this bug report comes from: dataclasses-json/dataclasses_json/core.py Lines 337 to 338 in 8973c33
The warning message I wrote should only ever mention the type annotation, and I would hope that PII or other sensitive information isn't in a type annotation. |
tl;dr: I imagine you could solve this concern with a smaller warning message: warnings.warn(
- f"Failed to decode {value} Union dataclasses."
+ "Failed to decode Union dataclasses. "
- f"Expected Union to include a matching dataclass and it didn't."
+ "Expected Union to include a matching dataclass and it didn't."
) |
@s4ke you'd originally commented on my PR:
I assume you deleted the comment because the warning is actually coming from a different part of the codebase? (Let me know if you'd prefer me not repeat your comments here, I can edit to delete). |
Its fine. The comment didnt make sense after all. After some digging I found that the issue was not introduced by new code but rather already existed for a while. Turns out the Code path that caused this issue was not really known yet. This was an error on my part. Sorry about that. I deleted my message because it was nonsense and completely in the wrong place. And to be fair, the tone was out of place as well. |
Description
We just ran into the case where the warnings logged out huge chunks of actual data into stdout. While I understand where this comes from, this is a bad idea because this can leak PII data into stdout/stderr by accident. Plus: The old behaviour was "just working as intended" for our usecase.
In our case, this was caused by this class: https://github.com/neuroforgede/nfcompose/blob/1ad30313e1bdbdb7c3d8e35fd74f905924e2003e/client/compose_client/library/models/definition/datapoint.py#L32
Note that we are using dataclass_json in serialization, but have extra code preventing the non primitive data reaching the actual serialization into json.
Example log (from python 3.8):
Code snippet that reproduces the issue
Describe the results you expected
The warning should not log out the data unprompted. This is a data security issue.
Python version you are using
Python 3.10.12
Environment description
certifi==2024.6.2
charset-normalizer==3.3.2
click==8.1.7
compose_client @ https://github.com/neuroforgede/nfcompose/releases/download/2.2.1/compose_client-2.2.1.tar.gz#sha256=08b5d99570e34734b1c5938c26cd57b456282443961d19a69754a096b8f8b14d
dataclasses-json==0.6.7
idna==3.7
marshmallow==3.21.3
mypy-extensions==1.0.0
packaging==24.1
requests==2.32.3
typing-inspect==0.9.0
typing_extensions==4.12.2
urllib3==2.2.2
The text was updated successfully, but these errors were encountered: