From: Bénédikt Tran <10796600+picnixz@users.noreply.github.com> Date: Mon, 23 Jun 2025 10:49:27 +0000 (+0200) Subject: gh-135823: improve error message in `netrc` security checks (#135827) X-Git-Tag: v3.15.0a1~1211 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=396ca9a641429e59e09d3a3c28dc85623197797f;p=thirdparty%2FPython%2Fcpython.git gh-135823: improve error message in `netrc` security checks (#135827) --- diff --git a/Lib/netrc.py b/Lib/netrc.py index bd003e80a480..2f502c1d5336 100644 --- a/Lib/netrc.py +++ b/Lib/netrc.py @@ -162,8 +162,8 @@ class netrc: 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" diff --git a/Misc/NEWS.d/next/Library/2025-06-22-22-03-06.gh-issue-135823.iDBg97.rst b/Misc/NEWS.d/next/Library/2025-06-22-22-03-06.gh-issue-135823.iDBg97.rst new file mode 100644 index 000000000000..5b9d89caae7a --- /dev/null +++ b/Misc/NEWS.d/next/Library/2025-06-22-22-03-06.gh-issue-135823.iDBg97.rst @@ -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.