8000 gh-135823: improve error message in `netrc` security checks by picnixz · Pull Request #135827 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-135823: improve error message in netrc security checks #135827

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
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Lib/netrc.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,8 @@ def _security_check(self, fp, default_netrc, login):
fowner = _getpwuid(prop.st_uid)
user = _getpwuid(current_user_id)
raise NetrcParseError(
(f"~/.netrc file owner ({fowner}, {user}) does not match"
" current user"))
f"~/.netrc file owner ({fowner}) does not match"
f" current user ({user})")
if (prop.st_mode & (stat.S_IRWXG | stat.S_IRWXO)):
raise NetrcParseError(
"~/.netrc access too permissive: access"
Expand Down
4EC8
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
:mod:`netrc`: improve the error message when the security check for the
ownership of the default configuration file ``~/.netrc`` fails. Patch by
Bénédikt Tran.
Loading
0