-
Notifications
You must be signed in to change notification settings - Fork 136
vendorCargoRegistries: avoid escaping shell args #1045
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -25,7 +25,6 @@ let | |
| inherit (lib) | ||
| concatMapStrings | ||
| concatStrings | ||
| escapeShellArg | ||
| flatten | ||
| foldl | ||
| groupBy | ||
|
|
@@ -65,7 +64,7 @@ let | |
| runCommandLocal "vendor-registry" { } '' | ||
| mkdir -p $out | ||
| ${concatMapStrings (p: '' | ||
| ln -s ${escapeShellArg (vendorCrate p)} $out/${escapeShellArg "${p.name}-${p.version}"} | ||
| ln -s ${vendorCrate p} $out/${p.name}-${p.version} | ||
| '') packages} | ||
| ''; | ||
|
|
||
|
|
@@ -158,7 +157,7 @@ let | |
| hashed = hash prefixedUrl; | ||
| in | ||
| '' | ||
| [source.${escapeShellArg name}] | ||
| [source.${name}] | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The original motivation for escaping |
||
| registry = "${url}" | ||
| replace-with = "nix-sources-${hashed}" | ||
| '' | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
vendorCrate pshould be a store path yes, but can store paths contain spaces? If not the/nix/store/<hash>-<name>path, what about subdirectories? Technically the caller can override the download derivation with whatever they want. Maybe its their own fault if they do a shell injection, but escaping here is a foolproof way of dealing with quoting${p.name}-${p.version}. There's probably a number of different ways to set them to something potentially evilUh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ln -s '${vendorCrate }'. Depends on whether subdirectories can contain'.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If
overrideVendorCargoPackagereturns a quoted path quoting it again might end up "undoing" the quotes