Skip to content

fix(config): ensure config file is absolute path and prevent writing to symlink#3788

Closed
frostming wants to merge 2 commits into
mainfrom
fix/symlink-config
Closed

fix(config): ensure config file is absolute path and prevent writing to symlink#3788
frostming wants to merge 2 commits into
mainfrom
fix/symlink-config

Conversation

@frostming
Copy link
Copy Markdown
Collaborator

Signed-off-by: Frost Ming me@frostming.com

Pull Request Checklist

  • A news fragment is added in news/ describing what is new.
  • Test cases added for changed code.

Describe what you have changed in this PR.

frostming added 2 commits May 20, 2026 11:36
…to symlink

Signed-off-by: Frost Ming <me@frostming.com>
…nfig files

Signed-off-by: Frost Ming <me@frostming.com>
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 36bbbdd257

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/pdm/project/config.py
def __init__(self, config_file: Path, is_global: bool = False):
self.is_global = is_global
self.config_file = config_file.resolve()
self.config_file = config_file.absolute()
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Normalize config path before storing it

Using Path.absolute() in Config.__init__ preserves lexical .. segments, so later _save_config() can create unintended directories when self.config_file.parent.mkdir(parents=True) runs (for example, with -c configs/../pdm.toml, a configs/ directory can be created even though it is not part of the canonical target path). This is a regression from resolve() and can also trigger avoidable write failures if those extra intermediate segments collide with files.

Useful? React with 👍 / 👎.

@codecov
Copy link
Copy Markdown

codecov Bot commented May 20, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 86.25%. Comparing base (b059077) to head (df4d978).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3788   +/-   ##
=======================================
  Coverage   86.25%   86.25%           
=======================================
  Files         118      118           
  Lines       12432    12433    +1     
  Branches     2082     2083    +1     
=======================================
+ Hits        10723    10724    +1     
  Misses       1139     1139           
  Partials      570      570           
Flag Coverage Δ
unittests 86.10% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@frostming frostming closed this May 21, 2026
@frostming frostming deleted the fix/symlink-config branch May 21, 2026 01:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant