Shipping Security Updates

Shipping Security Updates

Security Matters

Exploits don't wait for updates:

Trust, Who?

Can we even trust software makers?

  1. Do they care about you?
  2. Are issues fixed quickly?
  3. Are fixes released quickly?

Examples

  1. Android?
  2. Firefox?
  3. NixOS?

Android Example

Firefox Example

Making Security Updates

Exceptional implies stress, stress implies mistakes:

  • Typos.
  • Copy & Pasta.

Chemspill

Make a process

  • Reduce mistakes.
  • Improve the speed.

Chemspill Timeline

NixOS Example

Suggested ways:

  • Default channel: Long critical path. (when it builds)
  • Small channel: small ciritcal path (with local rebuilds).
  • Do it yourself pkgs.replaceDependency or system.replaceRuntimeDependencies.

NixOS Example

Dear user, please proceed as follow:

system.replaceRuntimeDependencies = with pkgs; [
  ({ original = openssl;
     replacement = callPackage /some/path/nixpkgs/pkgs/development/libraries/openssl {
       fetchurl = fetchurlBoot;
       cryptodevHeaders = linuxPackages.cryptodev.override {
         fetchurl = fetchurlBoot;
         onlyHeaders = true;
       };
     };
  })
];

NixOS Requirements

Require:

  • User awareness.
  • User actions.
  • ABI compatible versions.
  • Security updates are the exception. (not the rule)

Otherwise: Normal updates are shipped in a month.

Trust NixOS?

Yes-ish
which means
No

Security Issues

pkgs.replaceDependency

Substitute references inside package outputs:

  • Maintained by hand.
  • Realize packages during the evaluation.
  • Realize the packages to apply the fixes.
  • Lack support for statically linked packages.

One problem at a time

By order of importance:

  1. Make it transparent for users.
  2. Make it fast for Hydra.
  3. Make it easy for package managers.
  4. Make it sane. (no build during evaluation)

Transparent

$ nix-channel --update
$ nix-env -u firefox
      

Should become:

$ nix-channel --update
$ nix-env -u firefox

Transparent (Ideal)

$ nix-channel --update
$ nix-env -u firefox
      

Should become:


      

Implicitcations

  • Fixed packages should have the same layout as Nixpkgs.

Fast

Break the critical path in parallel compilation.

Do not recompile when a dependency change.

Fast & Sane

Implicitcations

Generate the same set of packages.

Implicitcations

Generate the same set of packages with one extra no-op iteration.

Implicitcations

Recompile fixed packages based on fixpoint of stable packages.

Implicitcations

Partially recompile fixed packages based on fixed packages.

Implicitcations

Entirelly recompile fixed packages based on fixed packages.

Implicitcations

Use the recompiled-info as a hint for patching with dependencies.

Easy

3 lists of packages:

  • Latest compiled branch.
  • ABI compatible changes branch.
  • Security channel. (merges both)

Release Management

Packagers options:

  • Push to master & Cherry-pick ABI compatible changes.
  • Push to ABI changes & Cherry-pick in master.

On new stable channel update:

  • Merge master into the ABI branch.
  • Reset the ABI branch.

Remaining Issues

What is left for improvements:

  • Use runtime dependencies generated by Hydra.
  • Automated updates for registered packages.
  • Support for statically linked packages.

Questions?