With
services = {
espanso = {
enable = true;
package = pkgs.espanso-wayland;
};
};
I got
checking that Nix store paths of all wrapped programs exist and are ELF executables... FAIL
The target executable /nix/store/skwp5sg0xly7d39anx5fr2hg0kci026g-espanso-2.4.1/bin/espanso is not an ELF! This is a security risk.
Script wrappers (e.g. bash or python) are commonly susceptible to dangerous env var injections.
EDIT: Seems to pass without using espanso-wayland
master ← svenjacobs:espanso-binary-wrapper
opened 05:14PM - 15 Oct 26 UTC
Since #570085 re-added the `ensure-wrapper-integrity` check, every `security.wra… ppers.<name>.source` must be an ELF executable. With `services.espanso.package = pkgs.espanso-wayland`, the module points its `cap_dac_override` wrapper at `bin/espanso`, which is a `wrapProgram` bash script, so the system no longer builds:
```
> The target executable /nix/store/…-espanso-2.4.1/bin/espanso is not an ELF! This is a security risk.
```
This switches the package to `makeBinaryWrapper`, the same fix as for hyprland in #573247. The `PATH` additions (`wl-clipboard`, `kdotool`, `libnotify`, …) stay, and the capabilities still reach `.espanso-wrapped` because the security wrapper raises them into the ambient set. Pointing the module at `.espanso-wrapped` instead would drop the `PATH` additions.
Tested on x86_64-linux:
- `nixosTests.espanso.wayland` and `nixosTests.espanso.x11` pass. The Wayland test goes through the capability wrapper.
- `bin/espanso` is an ELF in `espanso` and `espanso-wayland`, runs, and the wrapper still carries the `PATH` additions.
- `passthru.tests.version` fails, but not because of this change: the `v2.4.1` tag still has `version = "2.4.0"` in `espanso/Cargo.toml`, so the binary reports 2.4.0.
The change is only on `master`. 26.05 doesn't have the check, so no backport is needed.
This PR was prepared with Claude Code (Claude Opus 5.5): it found the cause, made the change, ran the tests below and drafted this text. I reviewed the change and the test results before submitting.
## Things done
- [x] Fits [CONTRIBUTING.md], [pkgs/README.md], [maintainers/README.md] and other READMEs.
- [x] Follows the [automation/AI policy].
- Built on platform:
- [x] x86_64-linux
- [ ] aarch64-linux
- [ ] aarch64-darwin
- Tested, as applicable:
- [x] Basic functionality of all binary files, usually in `./result/bin/`.
- [ ] Ran `nixpkgs-review` on this PR. See [nixpkgs-review usage].
- [ ] [Package tests] at `passthru.tests`.
- [x] [NixOS tests] in [nixos/tests].
- [ ] Tests in [lib/tests] or [pkgs/test] for functions and "core" functionality.
- Nixpkgs Release Notes
- [ ] Package update: when the change is major or breaking.
- NixOS Release Notes
- [ ] Module addition: when adding a new NixOS module.
- [ ] Module update: when the change is significant.
[Package tests]: https://github.com/NixOS/nixpkgs/blob/master/pkgs/README.md#package-tests
[NixOS tests]: https://nixos.org/manual/nixos/unstable/index.html#sec-nixos-tests
[nixpkgs-review usage]: https://github.com/Mic92/nixpkgs-review#usage
[CONTRIBUTING.md]: https://github.com/NixOS/nixpkgs/blob/master/CONTRIBUTING.md
[automation/AI policy]: https://github.com/NixOS/nixpkgs/blob/master/CONTRIBUTING.md#automationai-policy
[lib/tests]: https://github.com/NixOS/nixpkgs/blob/master/lib/tests
[maintainers/README.md]: https://github.com/NixOS/nixpkgs/blob/master/maintainers/README.md
[nixos/tests]: https://github.com/NixOS/nixpkgs/blob/master/nixos/tests
[pkgs/README.md]: https://github.com/NixOS/nixpkgs/blob/master/pkgs/README.md
[pkgs/test]: https://github.com/NixOS/nixpkgs/blob/master/pkgs/test
Wait for this to land in your channel.
More context:
staging-nixos ← GrimmTheShrimp:wrapper-elf-reapply
opened 07:25AM - 04 Oct 26 UTC
This reverts commit f515a2051f6338136d4481bcbc979bde4af9c11d.
Same idea as ht… tps://github.com/NixOS/nixpkgs/pull/567913, this time without a dependency on `file` to ideally not break installer tests. Sadly, installer tests still fail on this branch due to running out of disk space, nothing i can do about *that* here and probably not the fault of this change.
## Things done
- Built on platform:
- [x] x86_64-linux
- [ ] aarch64-linux
- [ ] aarch64-darwin
- Tested, as applicable:
- [x] [NixOS tests] in [nixos/tests].
- [ ] [Package tests] at `passthru.tests`.
- [ ] Tests in [lib/tests] or [pkgs/test] for functions and "core" functionality.
- [ ] Ran `nixpkgs-review` on this PR. See [nixpkgs-review usage].
- [ ] Tested basic functionality of all binary files, usually in `./result/bin/`.
- Nixpkgs Release Notes
- [ ] Package update: when the change is major or breaking.
- NixOS Release Notes
- [ ] Module addition: when adding a new NixOS module.
- [ ] Module update: when the change is significant.
- [x] Fits [CONTRIBUTING.md], [pkgs/README.md], [maintainers/README.md] and other READMEs.
- [x] Follows the [automation/AI policy].
[NixOS tests]: https://nixos.org/manual/nixos/unstable/index.html#sec-nixos-tests
[Package tests]: https://github.com/NixOS/nixpkgs/blob/master/pkgs/README.md#package-tests
[nixpkgs-review usage]: https://github.com/Mic92/nixpkgs-review#usage
[CONTRIBUTING.md]: https://github.com/NixOS/nixpkgs/blob/master/CONTRIBUTING.md
[automation/AI policy]: https://github.com/NixOS/nixpkgs/blob/master/CONTRIBUTING.md#automationai-policy
[lib/tests]: https://github.com/NixOS/nixpkgs/blob/master/lib/tests
[maintainers/README.md]: https://github.com/NixOS/nixpkgs/blob/master/maintainers/README.md
[nixos/tests]: https://github.com/NixOS/nixpkgs/blob/master/nixos/tests
[pkgs/README.md]: https://github.com/NixOS/nixpkgs/blob/master/pkgs/README.md
[pkgs/test]: https://github.com/NixOS/nixpkgs/blob/master/pkgs/test
staging-nixos ← GrimmTheShrimp:wrapper-elf
opened 03:27PM - 28 Sep 26 UTC
This *will* break some things, such as `nixosTests.espanso`. This is intended: L… oading bash, python or perl scripts via SUID or extensive capabilities is dangerous. PERL5LIB, PYTHONPATH or BASH_ENV make these things trivial LPE primitives.
The mime types being matched include both static, non-static and pie ELFs. This should be fine until we somehow get yet another type of magic and associated mime type.
## Things done
- Built on platform:
- [x] x86_64-linux
- [ ] aarch64-linux
- [ ] aarch64-darwin
- Tested, as applicable:
- [x] [NixOS tests] in [nixos/tests]. (`wrappers`, `espanso`)
- [ ] [Package tests] at `passthru.tests`.
- [ ] Tests in [lib/tests] or [pkgs/test] for functions and "core" functionality.
- [ ] Ran `nixpkgs-review` on this PR. See [nixpkgs-review usage].
- [ ] Tested basic functionality of all binary files, usually in `./result/bin/`.
- Nixpkgs Release Notes
- [ ] Package update: when the change is major or breaking.
- NixOS Release Notes
- [ ] Module addition: when adding a new NixOS module.
- [ ] Module update: when the change is significant.
- [x] Fits [CONTRIBUTING.md], [pkgs/README.md], [maintainers/README.md] and other READMEs.
- [x] Follows the [automation/AI policy].
[NixOS tests]: https://nixos.org/manual/nixos/unstable/index.html#sec-nixos-tests
[Package tests]: https://github.com/NixOS/nixpkgs/blob/master/pkgs/README.md#package-tests
[nixpkgs-review usage]: https://github.com/Mic92/nixpkgs-review#usage
[CONTRIBUTING.md]: https://github.com/NixOS/nixpkgs/blob/master/CONTRIBUTING.md
[automation/AI policy]: https://github.com/NixOS/nixpkgs/blob/master/CONTRIBUTING.md#automationai-policy
[lib/tests]: https://github.com/NixOS/nixpkgs/blob/master/lib/tests
[maintainers/README.md]: https://github.com/NixOS/nixpkgs/blob/master/maintainers/README.md
[nixos/tests]: https://github.com/NixOS/nixpkgs/blob/master/nixos/tests
[pkgs/README.md]: https://github.com/NixOS/nixpkgs/blob/master/pkgs/README.md
[pkgs/test]: https://github.com/NixOS/nixpkgs/blob/master/pkgs/test