← Back to Pull requests

Strip credentials from editable VCS URLs in pip freeze #14340

Open
unknown opened this pull request with 225 lines diff across 2 files
View on GitHub
unknown unknown commented on Oct 08, 2026 12:28 UTC
Author

What does this PR do?

pip freeze built the line for an editable VCS install from the checkout's live remote URL and never stripped user info, so a clone made with https://user:token@host/repo printed the token (-e git+https://user:token@host/repo@<sha>#egg=name), and it ends up in committed requirements files. The non-editable path already emits the PEP 610-stripped URL from direct_url.json.

This applies the same PEP 610 rule in VersionControl.get_src_requirement, the one place every backend goes through: drop user:password@ unless it is ${VAR} references or the git user. The git user is kept on any scheme, matching what direct_url.json already records; happy to restrict it to ssh schemes if preferred. Percent-encoded user names such as %67%69%74@ are stripped, as they are for direct_url.json today. remove_auth_from_url was not used because it would also strip git@ from ssh URLs and ${TOKEN} references (see #12365).

Tests: parametrized unit test in tests/unit/test_vcs.py (6 cases, fails without the change) and a functional test in tests/functional/test_freeze.py that adds a credentialed origin remote to the test package and checks the freeze output. News fragment news/11410.bugfix.rst.

Fixes #11410. Earlier attempt: #14222.

PR Checklist:


  • I agree to follow the PSF Code of Conduct.

  • I have read and have followed the CONTRIBUTING.md file.

  • I have added a news file fragment (or this PR does not need one).

  • I have read and followed the AI_POLICY.md file, and if any AI tools were used, I have disclosed it below.
  • Assisted-by: Claude

    Diff: 225 lines (+168 / -57) across 2 files Reviewer: sepehr-rs Review duration: 76580m
    All Vouch review confidence checks passed
    Residual risk 0.24 = Change Risk (0.44) × (1 − Review Confidence (0.45)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.44 · 225 lines diff across 2 files
    0.44
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.02 · 1 substantive comment(s)
    0.02
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    44%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Shallow Review Depth shallow_review_depth
    0.344
    Diff Size diff_size
    0.324
    Real PR Conversation Timeline
    1 comments
    "Review active on #14340"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 44.7% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 43.9% (MEDIUM) · Higher = larger blast radius
    43.9%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 44.7% · Lower = rushed or shallow review
    44.7%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 24.3% · Safe to merge
    24.3%
    Repository