Skip to content

Conversation

@Zaczero
Copy link
Member

@Zaczero Zaczero commented Dec 26, 2025

I removed heavy scpRegex instantiation per fixGitURL call and reimplemented in a way that is more correct about colon handling, fixing potential IPv6 and other issues.

Previous implementation would rewrite:

"user@host:a:b"
into "ssh://user@host:a/b"
instead of "ssh://user@host/a:b"

"user@[2001:db8:1::2]:a:b"
into "ssh://user@[2001:db8:1::2]:a/b"
instead of "ssh://user@[2001:db8:1::2]/a:b"

This change should make fixGitURL more efficient and correctish.

Motivation

Context


Add 👍 to pull requests you find important.

The Nix maintainer team uses a GitHub project board to schedule and track reviews.

@Zaczero Zaczero requested a review from edolstra as a code owner December 26, 2025 17:50
@Zaczero Zaczero changed the title nix/util: remove regex from fixGitURL scp and improve colon handling libutil: remove regex from fixGitURL scp and improve colon handling Dec 26, 2025
@Zaczero Zaczero force-pushed the zaczero/convinced-rat branch from 3b79372 to ed01333 Compare December 26, 2025 17:51
Copilot AI added a commit to Zaczero/nix that referenced this pull request Dec 26, 2025
This document analyzes all pointer and index accesses in the
rewriteScpLikeGitURL function from PR NixOS#14866. All accesses are verified
to be safe with proper bounds checking.

Key findings:
- All 4 pointer/index accesses have proper bounds checking
- Uses short-circuit evaluation to prevent unsafe access
- Comprehensive edge case handling
- Extensive test coverage included in PR

Conclusion: All pointer accesses are SAFE.

Co-authored-by: Zaczero <[email protected]>
@xokdvium
Copy link
Contributor

There's also #14863, fixGitURL has some issues, as outlined in the comments on that PR. Would make sense to land the fixes together.

@Zaczero
Copy link
Member Author

Zaczero commented Dec 28, 2025

I could merge the tests and new features (accept paths without a user component) if that's the right direction. Then I could try to write it regex-less. Is that what we want here?

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.

3 participants