Skip to content

gh-112997: Don't log arguments in asyncio unless debugging #115667

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

Merged
merged 3 commits into from
Feb 28, 2024

Conversation

CendioOssman
Copy link
Contributor

@CendioOssman CendioOssman commented Feb 19, 2024

Nothing else in Python generally logs the contents of variables, so this can be very unexpected for developers and could leak sensitive information in to terminals and log files.

Nothing else in Python generally logs the contents of variables, so this
can be very unexpected for developers and could leak sensitive
information in to terminals and log files.
Copy link
Member

@gvanrossum gvanrossum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about the calls to some of the modified functions in base_futures.py and futures.py?

"""Format function arguments and keyword arguments.

Special case for a single parameter: ('hello',) is formatted as ('hello').
"""
# Avoid printing sensitive argument contents unless debugging
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This behavior should be mentioned in the docstring, not just in a comment.

@CendioOssman
Copy link
Contributor Author

What about the calls to some of the modified functions in base_futures.py and futures.py?

There were no arguments included in the call in base_futures.py, so I let that be.

I can't see any calls for this in futures.py?

So that this information is more readily available.
@gvanrossum
Copy link
Member

What about the calls to some of the modified functions in base_futures.py and futures.py?

There were no arguments included in the call in base_futures.py, so I let that be.

It's a fair cop.

I can't see any calls for this in futures.py?

I was thinking of this:

        if self._loop.get_debug():
            self._source_traceback = format_helpers.extract_stack(
                sys._getframe(1))

but since that's already wrapped in get_debug() it's irrelevant. It also doesn't seem to be doing anything with args.

I'm happy with this now, so I'll merge. Congrats!

@gvanrossum gvanrossum merged commit 5a1559d into python:main Feb 28, 2024
gvanrossum pushed a commit to gvanrossum/cpython that referenced this pull request Feb 28, 2024
…hon#115667)

Nothing else in Python generally logs the contents of variables, so this
can be very unexpected for developers and could leak sensitive
information in to terminals and log files.
@CendioOssman CendioOssman deleted the log_args branch February 28, 2024 10:51
woodruffw pushed a commit to woodruffw-forks/cpython that referenced this pull request Mar 4, 2024
…hon#115667)

Nothing else in Python generally logs the contents of variables, so this
can be very unexpected for developers and could leak sensitive
information in to terminals and log files.
adorilson pushed a commit to adorilson/cpython that referenced this pull request Mar 25, 2024
…hon#115667)

Nothing else in Python generally logs the contents of variables, so this
can be very unexpected for developers and could leak sensitive
information in to terminals and log files.
diegorusso pushed a commit to diegorusso/cpython that referenced this pull request Apr 17, 2024
…hon#115667)

Nothing else in Python generally logs the contents of variables, so this
can be very unexpected for developers and could leak sensitive
information in to terminals and log files.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants