Skip to content

Commit 396ca9a

Browse files
authored
gh-135823: improve error message in netrc security checks (#135827)
1 parent 6aa0826 commit 396ca9a

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

Lib/netrc.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,8 +162,8 @@ def _security_check(self, fp, default_netrc, login):
162162
fowner = _getpwuid(prop.st_uid)
163163
user = _getpwuid(current_user_id)
164164
raise NetrcParseError(
165-
(f"~/.netrc file owner ({fowner}, {user}) does not match"
166-
" current user"))
165+
f"~/.netrc file owner ({fowner}) does not match"
166+
f" current user ({user})")
167167
if (prop.st_mode & (stat.S_IRWXG | stat.S_IRWXO)):
168168
raise NetrcParseError(
169169
"~/.netrc access too permissive: access"
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
:mod:`netrc`: improve the error message when the security check for the
2+
ownership of the default configuration file ``~/.netrc`` fails. Patch by
3+
Bénédikt Tran.

0 commit comments

Comments
 (0)