Skip to content

Conversation

@sethmlarson
Copy link
Contributor

@sethmlarson sethmlarson commented Feb 2, 2026

The first part of closing #74453, this documentation update I believe is less controversial than a deprecation. I'm recommending backporting this warning, as all Python versions supported today have commonpath().

The mix-up that commonprefix is acceptable for generating a path prefix (versus a string prefix) occurred at least once in a critical packaging tool: https://www.cve.org/CVERecord?id=CVE-2026-1703 Given its usage (40K+ hits on GitHub) I suspect this is not the only occurrence.


📚 Documentation preview 📚: https://cpython-previews--144401.org.readthedocs.build/

@bedevere-app bedevere-app bot added docs Documentation in the Doc dir skip news labels Feb 2, 2026
@github-project-automation github-project-automation bot moved this to Todo in Docs PRs Feb 2, 2026
@sethmlarson sethmlarson added type-security A security issue stdlib Standard Library Python modules in the Lib/ directory skip news and removed awaiting review skip news labels Feb 2, 2026
Copy link
Member

@StanFromIreland StanFromIreland left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

(``''``).

.. note::
.. danger::
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We do not often use "danger" but rather prefer using warning (I believe we have something about it in the devguide)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! I've updated to warning instead of danger.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe we have something about it in the devguide

Out of curiosity, which section? I was unable to find any on these.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

@picnixz picnixz Feb 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes here. It is just so that we do not have a proliferation of different boxes (while Sphinx and docutils provide lots of boxes we tend to only use a few of them). In addition other security warnings were usually indicated through a warning.

Though if we actually use danger/important instead of warning, feel free to revert my suggestion (from what I remember we mostly used warning)

@sethmlarson sethmlarson requested a review from picnixz February 2, 2026 21:55
Copy link
Member

@vstinner vstinner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

IMO we should still consider deprecating os.path.commonprefix() and add string.commonprefix() instead. But this doc change is a good start :-)

@sethmlarson
Copy link
Contributor Author

@vstinner Thanks! I'm working on a PR that deprecates the function and moves it to string.commonprefix().

@encukou encukou merged commit 4e15b8d into python:main Feb 3, 2026
47 of 56 checks passed
@github-project-automation github-project-automation bot moved this from Todo to Done in Docs PRs Feb 3, 2026
@encukou encukou added needs backport to 3.12 only security fixes needs backport to 3.13 bugs and security fixes needs backport to 3.14 bugs and security fixes labels Feb 3, 2026
@miss-islington-app
Copy link

Thanks @sethmlarson for the PR, and @encukou for merging it 🌮🎉.. I'm working now to backport this PR to: 3.10.
🐍🍒⛏🤖

@miss-islington-app
Copy link

Thanks @sethmlarson for the PR, and @encukou for merging it 🌮🎉.. I'm working now to backport this PR to: 3.12.
🐍🍒⛏🤖

@miss-islington-app
Copy link

Thanks @sethmlarson for the PR, and @encukou for merging it 🌮🎉.. I'm working now to backport this PR to: 3.11.
🐍🍒⛏🤖

@miss-islington-app
Copy link

Thanks @sethmlarson for the PR, and @encukou for merging it 🌮🎉.. I'm working now to backport this PR to: 3.13.
🐍🍒⛏🤖

@miss-islington-app
Copy link

Thanks @sethmlarson for the PR, and @encukou for merging it 🌮🎉.. I'm working now to backport this PR to: 3.14.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Feb 3, 2026
…pythonGH-144401)

(cherry picked from commit 4e15b8d)

Co-authored-by: Seth Michael Larson <seth@python.org>
@bedevere-app
Copy link

bedevere-app bot commented Feb 3, 2026

GH-144426 is a backport of this pull request to the 3.10 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.10 only security fixes label Feb 3, 2026
@bedevere-app
Copy link

bedevere-app bot commented Feb 3, 2026

GH-144427 is a backport of this pull request to the 3.12 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.12 only security fixes label Feb 3, 2026
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Feb 3, 2026
…pythonGH-144401)

(cherry picked from commit 4e15b8d)

Co-authored-by: Seth Michael Larson <seth@python.org>
@bedevere-app
Copy link

bedevere-app bot commented Feb 3, 2026

GH-144428 is a backport of this pull request to the 3.11 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.11 only security fixes label Feb 3, 2026
@bedevere-app
Copy link

bedevere-app bot commented Feb 3, 2026

GH-144429 is a backport of this pull request to the 3.13 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.13 bugs and security fixes label Feb 3, 2026
@bedevere-app
Copy link

bedevere-app bot commented Feb 3, 2026

GH-144430 is a backport of this pull request to the 3.14 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.14 bugs and security fixes label Feb 3, 2026
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Feb 3, 2026
…pythonGH-144401)

(cherry picked from commit 4e15b8d)

Co-authored-by: Seth Michael Larson <seth@python.org>
sethmlarson added a commit that referenced this pull request Feb 3, 2026
gh-74453: Add stronger security warning to os.path.commonprefix (GH-144401)
(cherry picked from commit 4e15b8d)

Co-authored-by: Seth Michael Larson <seth@python.org>
@sethmlarson sethmlarson deleted the os-path-commonprefix branch February 3, 2026 14:16
sethmlarson added a commit that referenced this pull request Feb 3, 2026
gh-74453: Add stronger security warning to os.path.commonprefix (GH-144401)
(cherry picked from commit 4e15b8d)

Co-authored-by: Seth Michael Larson <seth@python.org>
sethmlarson added a commit that referenced this pull request Feb 3, 2026
gh-74453: Add stronger security warning to os.path.commonprefix (GH-144401)
(cherry picked from commit 4e15b8d)

Co-authored-by: Seth Michael Larson <seth@python.org>
sethmlarson added a commit that referenced this pull request Feb 3, 2026
gh-74453: Add stronger security warning to os.path.commonprefix (GH-144401)
(cherry picked from commit 4e15b8d)

Co-authored-by: Seth Michael Larson <seth@python.org>
sethmlarson added a commit that referenced this pull request Feb 3, 2026
gh-74453: Add stronger security warning to os.path.commonprefix (GH-144401)
(cherry picked from commit 4e15b8d)

Co-authored-by: Seth Michael Larson <seth@python.org>
@sethmlarson
Copy link
Contributor Author

I've created the follow-up PR which deprecates os.path.commonprefix: #144436

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting merge docs Documentation in the Doc dir skip news stdlib Standard Library Python modules in the Lib/ directory type-security A security issue

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

5 participants