fix(libstore): accept multi-@ SSH authorities in store URIs#15509
fix(libstore): accept multi-@ SSH authorities in store URIs#15509znaniye wants to merge 1 commit intoNixOS:masterfrom
Conversation
|
This has never worked (as in pre-2.31 too), right? Not sure how I feel about making store reference syntax even more busted than it already is. What's wrong with just doing pct-encoding? |
32e99bf to
c4a72ce
Compare
Actually, before 2.31, we had some pretty cursed behavior. Nix wouldn't report any parsing error. Instead, when copying a closure to debug1: Connecting to cloud.shellhub.io [5.161.34.26] port 22.
debug1: Connection established.
debug1: Local version string SSH-2.0-OpenSSH_10.0
debug1: Remote protocol version 2.0, remote software version Go
debug1: compat_banner: no match: Go
debug1: Authenticating to cloud.shellhub.io:22 as '//user@device'
That is indeed an option, but I though it would be nice if we could solve this on our side. |
That is indeed nice, but what about any other characters? Are we going to special-case every exception we come across? At least being consistent is somewhat sane. One particularly aggregious issue pre-2.31 was that one could specify hostnames with |
Move lenient authority normalization into libutil as an opt-in helper used by StoreReference parsing, replacing scheme-specific handling in libstore. The fallback splits authority at the last '@', normalizes userinfo to RFC3986 form, preserves valid pct-encoding, rejects whitespace/control characters, and re-parses strictly. This keeps parseURL strict for other callers while handling legacy store references with multi-'@' userinfo. Add libutil and libstore tests for multi-'@' authorities, generic invalid-character normalization, and whitespace rejection.
c4a72ce to
11cc196
Compare
|
@xokdvium could you please review the rebased changes? |
Summary
ssh-ngstore URI parsing for the ShellHub addressing form, where device selection appears in userinfo (e.g.ssh-ng://freebotics@freedom.2c-cf-67-db-54-61@cloud.shellhub.io).StoreReference::parsefailed early withCannot parse Nix store ...because authorities with multiple@were rejected unless inner@were percent-encoded.NIX_SSHOPTSor~/.ssh/config) to express the same target.ssh,ssh-ng,mounted-ssh-ng): treat the last@as the userinfo/host separator and percent-encode earlier@as%40.https://user@service@example.orgstill throwsUsageError).Why this matters
user@device-id@gateway-host).