Skip to content
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

fakeroot: 1.22 -> 1.23 #49191

Merged
merged 1 commit into from Oct 26, 2018
Merged

Conversation

charles-dyfis-net
Copy link
Contributor

@charles-dyfis-net charles-dyfis-net commented Oct 26, 2018

Motivation for this change

The shell wrapper for fakeroot 1.22 parses command-line arguments in such a way as to permit arguments which should be passed through as literal data to be evaluated as shell syntax; 1.23 fixes this.

If programs pass untrusted data through the argument list of commands run with fakeroot, this could potentially be security-impacting. Whether or not fakeroot is used in such a context, it's definitely a correctness issue.

Consider the below transcript, showing a simple command line correctly executed when invoked on its own or via fakeroot 1.23, but incorrectly executed from fakeroot 1.22:

$ cmd=( sh -xc $'printf \'%s\\n\' "$@"' _ one two three )

$ "${cmd[@]}"
+ printf '%s\n' one two three
one
two
three

$ /nix/store/2wi31rvbkyzadix44i0d1a2xsmlgdxy9-fakeroot-1.22/bin/fakeroot -- "${cmd[@]}"
+ printf
printf: usage: printf [-v var] format [arguments]

$ /nix/store/s0j7487g3g4davd2wniw268c4b12zgs1-fakeroot-1.23/bin/fakeroot -- "${cmd[@]}"
+ printf '%s\n' one two three
one
two
three
Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Fits CONTRIBUTING.md.

@infinisil
Copy link
Member

Do you think this should be backported?

@infinisil
Copy link
Member

@GrahamcOfBorg build fakeroot hylafaxplus

@GrahamcOfBorg
Copy link

Success on x86_64-darwin (full log)

Attempted: fakeroot

The following builds were skipped because they don't evaluate on x86_64-darwin: hylafaxplus

Partial log (click to expand)

libtool: install: /nix/store/acnfbicd84bnya2l2dq868b5l482qihw-coreutils-8.30/bin/install -c faked /nix/store/4cv9vjdnsb66xbm16k8lhiykmyzfh937-fakeroot-1.23/bin/faked
make[2]: Nothing to be done for 'install-data-am'.
make[2]: Leaving directory '/private/tmp/nix-build-fakeroot-1.23.drv-0/fakeroot-1.23'
make[1]: Leaving directory '/private/tmp/nix-build-fakeroot-1.23.drv-0/fakeroot-1.23'
post-installation fixup
gzipping man pages under /nix/store/4cv9vjdnsb66xbm16k8lhiykmyzfh937-fakeroot-1.23/share/man/
strip is /nix/store/g5r4apl0za012ffs6ladinwa5w0m1l3k-cctools-binutils-darwin/bin/strip
stripping (with command strip and flags -S) in /nix/store/4cv9vjdnsb66xbm16k8lhiykmyzfh937-fakeroot-1.23/lib  /nix/store/4cv9vjdnsb66xbm16k8lhiykmyzfh937-fakeroot-1.23/bin
patching script interpreter paths in /nix/store/4cv9vjdnsb66xbm16k8lhiykmyzfh937-fakeroot-1.23
/nix/store/4cv9vjdnsb66xbm16k8lhiykmyzfh937-fakeroot-1.23

@GrahamcOfBorg
Copy link

Success on x86_64-linux (full log)

Attempted: fakeroot, hylafaxplus

Partial log (click to expand)

shrinking /nix/store/4i50nqp12w2yg7kidn50kj5c1b1hjr3c-hylafaxplus-5.6.1/bin/faxstat
shrinking /nix/store/4i50nqp12w2yg7kidn50kj5c1b1hjr3c-hylafaxplus-5.6.1/lib/libfaxserver.so.5.6.1
shrinking /nix/store/4i50nqp12w2yg7kidn50kj5c1b1hjr3c-hylafaxplus-5.6.1/lib/libfaxutil.so.5.6.1
gzipping man pages under /nix/store/4i50nqp12w2yg7kidn50kj5c1b1hjr3c-hylafaxplus-5.6.1/share/man/
strip is /nix/store/vcc4svb8gy29g4pam2zja6llkbcwsyiq-binutils-2.30/bin/strip
stripping (with command strip and flags -S) in /nix/store/4i50nqp12w2yg7kidn50kj5c1b1hjr3c-hylafaxplus-5.6.1/lib  /nix/store/4i50nqp12w2yg7kidn50kj5c1b1hjr3c-hylafaxplus-5.6.1/bin
patching script interpreter paths in /nix/store/4i50nqp12w2yg7kidn50kj5c1b1hjr3c-hylafaxplus-5.6.1
checking for references to /build in /nix/store/4i50nqp12w2yg7kidn50kj5c1b1hjr3c-hylafaxplus-5.6.1...
/nix/store/lwjisayr1x272xfgv6v0nm3b95jdpkfi-fakeroot-1.23
/nix/store/4i50nqp12w2yg7kidn50kj5c1b1hjr3c-hylafaxplus-5.6.1

@GrahamcOfBorg
Copy link

Success on aarch64-linux (full log)

Attempted: fakeroot, hylafaxplus

Partial log (click to expand)

shrinking /nix/store/7y17q8v5mrn62gqrz6a4gcgzbzggphf0-hylafaxplus-5.6.1/bin/faxmail
shrinking /nix/store/7y17q8v5mrn62gqrz6a4gcgzbzggphf0-hylafaxplus-5.6.1/bin/faxcover
shrinking /nix/store/7y17q8v5mrn62gqrz6a4gcgzbzggphf0-hylafaxplus-5.6.1/bin/faxalter
gzipping man pages under /nix/store/7y17q8v5mrn62gqrz6a4gcgzbzggphf0-hylafaxplus-5.6.1/share/man/
strip is /nix/store/p9akxn2sfy4wkhqdqa3li97pc6jaz3r1-binutils-2.30/bin/strip
stripping (with command strip and flags -S) in /nix/store/7y17q8v5mrn62gqrz6a4gcgzbzggphf0-hylafaxplus-5.6.1/lib  /nix/store/7y17q8v5mrn62gqrz6a4gcgzbzggphf0-hylafaxplus-5.6.1/bin
patching script interpreter paths in /nix/store/7y17q8v5mrn62gqrz6a4gcgzbzggphf0-hylafaxplus-5.6.1
checking for references to /build in /nix/store/7y17q8v5mrn62gqrz6a4gcgzbzggphf0-hylafaxplus-5.6.1...
/nix/store/4kg403ahx167zgrqd64zi6vl8zipffki-fakeroot-1.23
/nix/store/7y17q8v5mrn62gqrz6a4gcgzbzggphf0-hylafaxplus-5.6.1

@infinisil
Copy link
Member

I'll merge this. If you feel like backporting is needed, feel free to open a PR for it :)

@infinisil infinisil merged commit 0ed2247 into NixOS:master Oct 26, 2018
@charles-dyfis-net
Copy link
Contributor Author

I'd want to look at how Hylafax uses fakeroot to determine whether there's any real risk here; if it looks like there is, I'll submit a separate PR with a backport.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants