python / python/cpython

netrc.py strips away valid backslash characters from tokens

Open
#99,080 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

stdlib type-bug
Dominant language
Python
Stars
77.2k
Forks
36k
PR merge metrics
PR metrics pending

Description

Bug report

Commit https://github.com/python/cpython/commit/15409c720be0503131713e3d3abc1acd0da07378 to close PR https://github.com/python/cpython/pull/26330 introduced a regression in the stdlib netrc.py that causes backslashes to be stripped out of tokens. As an example, the password extracted from the following .netrc file

machine my.host.com login user password mypass\word

will be mypassword instead of mypass\word. Same behavior would happen for login or account tokens.

Your environment

  • CPython versions tested on: >=3.11
  • PR: gh-99088

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The affected entry point is netrc.py in the standard library; compare the token parsing introduced by commit 15409c720be0503131713e3d3abc1acd0da07378 with the sample .netrc shown here. Confirm that login, account, and password tokens retain valid backslashes, using the sample as the regression check.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
authentication
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.