Skip to content

Run under /bin/sh, accept scip-rust index, distrust eMudhra roots - #55

Merged
chrapkowski-sg merged 2 commits into
mainfrom
nix-shell-index-cacert
Oct 27, 2026
Merged

chrapkowski-sg merged 2 commits into
mainfrom
nix-shell-index-cacert

Conversation

@chrapkowski-sg

@chrapkowski-sg chrapkowski-sg commented Oct 27, 2026 •

Copy link
Copy Markdown
Collaborator

Why

The image cannot be used by callers that run commands in the container through a shell: it has no /bin/sh. Callers that still run scip-rust index (the invocation releases up to v0.0.5 accepted) get an empty index, because the argument is passed to rust-analyzer as the project path. The image's CA bundle (nss-cacert 3.123, from the pinned nixpkgs) also still trusts the emSign root behind the compromised eMudhra intermediate CAs (https://emudhra.we-have-a-problem.com/): git and cargo in the image complete a TLS handshake with https://dv-g3b-emudhra.we-have-a-problem.com/.

Changes

  • Add BusyBox to the image for /bin/sh and basic utilities. Its wget and ssl_client applets are disabled because BusyBox does not verify TLS certificates.
  • scip-rust: drop a leading index argument, documented in the script. A directory named index can still be indexed as ./index.
  • Distrust emSign ECC Root CA - G3 and Comodo AAA Services root in the image's CA bundle via cacert.override { blacklist = … }. The pinned cacert already distrusts the Comodo root for TLS, so that entry is defence in depth. cacert 3.131.1 no longer contains the emSign root, so the override fails the build after a nixpkgs bump to it and should be removed then.

Verification (local image build)

main This PR
git, cargo (sparse registry, git dependency, git dependency via git CLI) → emSign host handshake completes certificate rejected
same → AAA cross-sign host certificate rejected certificate rejected
docker run --entrypoint /bin/sh … -c 'scip-rust index' cannot start (no /bin/sh) indexes
docker run … scip-rust index exit 0, empty index (0 documents) indexes
  • git still reaches GitHub and cargo still fetches from crates.io.
  • docker run -v "$PWD:/work" <image> (README usage), scip-rust ./index, scip-rust index --output X <path> and scip-rust --output X <path> all work.
  • ripgrep 15.2.0 indexed through /bin/sh + scip-rust index: 98 documents, 75,866 occurrences, crates/core/main.rs present.
  • shellcheck and formatting flake checks pass.
  • CI: the docker job now also indexes through --entrypoint /bin/sh with scip-rust index, and checks that the image has no BusyBox wget or ssl_client. Both steps pass locally; the TLS-client check fails on an image that has wget.

- Add BusyBox to the image so /bin/sh exists for callers that run
  commands in the container through a shell. Its wget and ssl_client
  applets are disabled because BusyBox does not verify TLS certificates.
- scip-rust: drop a leading `index` argument. Releases up to v0.0.5
  ignored their arguments and callers still run `scip-rust index`;
  rust-analyzer treated `index` as the project path and wrote an empty
  index. A directory named `index` can still be indexed as `./index`.
- Distrust the emSign ECC Root CA - G3 and Comodo AAA Services roots in
  the image's CA bundle after the eMudhra intermediate CA key compromise
  (https://emudhra.we-have-a-problem.com/). nixos-26.05 still ships
  cacert 3.126; drop the override once it has 3.131.1 or later.
- ci: in the docker job, also index through `--entrypoint /bin/sh` with
  `scip-rust index`, and check that the image has no BusyBox wget or
  ssl_client.
- flake: the pinned cacert is 3.123 and already distrusts Comodo AAA
  Services root for TLS. cacert 3.131.1 drops emSign ECC Root CA - G3,
  so the override fails the build after a nixpkgs bump to it.

@peterguy peterguy left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@keegancsmith keegancsmith left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Haven't used dockerTools much in nix, but got lots of nix experience. This fix makes a lot of sense, but may be worth inspecting the built image just to make sure it doesn't trust the bad cert.

EG I don't think it would work this way, but not impossible: pkgs.git could have in its nix store closure the bad certs somehow. But yeah, I don't think thats how certs work in general for nix, they are expected to be managed outside of the pkg.

@chrapkowski-sg
chrapkowski-sg enabled auto-merge (squash) October 27, 2026 21:13
@chrapkowski-sg
chrapkowski-sg merged commit e782ec4 into main Oct 27, 2026
7 checks passed
@chrapkowski-sg
chrapkowski-sg deleted the nix-shell-index-cacert branch October 27, 2026 21:18
chrapkowski-sg added a commit that referenced this pull request Oct 27, 2026
)

* Run under /bin/sh, accept `scip-rust index`, distrust eMudhra roots

- Add BusyBox to the image so /bin/sh exists for callers that run
  commands in the container through a shell. Its wget and ssl_client
  applets are disabled because BusyBox does not verify TLS certificates.
- scip-rust: drop a leading `index` argument. Releases up to v0.0.5
  ignored their arguments and callers still run `scip-rust index`;
  rust-analyzer treated `index` as the project path and wrote an empty
  index. A directory named `index` can still be indexed as `./index`.
- Distrust the emSign ECC Root CA - G3 and Comodo AAA Services roots in
  the image's CA bundle after the eMudhra intermediate CA key compromise
  (https://emudhra.we-have-a-problem.com/). nixos-26.05 still ships
  cacert 3.126; drop the override once it has 3.131.1 or later.

* Test the /bin/sh path in CI and correct the cacert comment

- ci: in the docker job, also index through `--entrypoint /bin/sh` with
  `scip-rust index`, and check that the image has no BusyBox wget or
  ssl_client.
- flake: the pinned cacert is 3.123 and already distrusts Comodo AAA
  Services root for TLS. cacert 3.131.1 drops emSign ECC Root CA - G3,
  so the override fails the build after a nixpkgs bump to it.

* Use gitMinimal in the image

- pkgs.git pulls in Perl and Mozilla::CA for git-send-email. That
  separate CA bundle still trusts emSign ECC Root CA - G3; gitMinimal
  leaves both out.
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