Skip to content

Reject UNC and Windows device paths (similar to how netlocks are alre… - #2452

Merged
afourney merged 1 commit into
mainfrom
reject_unc_paths
Sep 10, 2026
Merged

Reject UNC and Windows device paths (similar to how netlocks are alre…#2452
afourney merged 1 commit into
mainfrom
reject_unc_paths

Conversation

@afourney

Copy link
Copy Markdown
Member

Reject UNC and Windows device paths (similar to how netloc paths are already rejected).

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

The security-sensitive path rejection lacks regression tests for supported and rejected URI forms.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Rejects unsafe UNC and Windows device paths during file URI conversion.

Changes:

  • Detects Windows network/device path prefixes cross-platform.
  • Rejects encoded or normalized unsafe paths.
File summaries
File Description
_uri_utils.py Adds unsafe Windows path detection and rejection.
Review details
  • Files reviewed: 1/1 changed files
  • Comments generated: 1
  • Review effort level: Balanced

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +21 to +22
decoded_path = unquote_to_bytes(parsed.path).replace(b"\\", b"/")
if decoded_path.startswith(b"//"):

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Planned in a follow-up PR.

@afourney
afourney merged commit e99a726 into main Sep 10, 2026
18 checks passed
@afourney
afourney deleted the reject_unc_paths branch September 10, 2026 22:02
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.

2 participants