Skip to content

trusted-substituters matching for nix stores don't match parameter changes for untrusted users #15463

@sakompella

Description

@sakompella

Describe the bug

trusted-substituters matching appears to use raw string equality for untrusted users, so adding store query params (for example ?priority=10) causes a substituter to be rejected as untrusted even when the base URL is in trusted-substituters.

Steps To Reproduce

# /etc/nixos/configuration.nix
{
  nix.settings = {
    substituters = [ "https://cache.nixos.org/" ];

    # explicitly allow numtide cache base URL for untrusted users
    trusted-substituters = [ "https://cache.numtide.com" ];
    trusted-public-keys =[ "niks3.numtide.com-1:DTx8wZduET09hRmMtKdQDxNNthLQETkc/yaX7M4qK0g=" ];
    trusted-users = lib.mkForce [ "root" ];
    allowed-users = [ "*" ];
  };
}
# flake.nix
{
  nixConfig = {
    extra-substituters = [ "https://cache.numtide.com?priority=10" ];
    extra-trusted-public-keys = [ "niks3.numtide.com-1:DTx8wZduET09hRmMtKdQDxNNthLQETkc/yaX7M4qK0g=" ];
  };

  inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";

  outputs = { self, nixpkgs }: {
    packages.x86_64-linux.default = nixpkgs.legacyPackages.x86_64-linux.hello;
  };
}

Run:

nix build .#default --accept-flake-config -L
# ...
# ignoring untrusted substituter 'https://cache.numtide.com?priority=10', you are not a trusted user
# ...

Expected behavior

Matching should treat https://hostname/path and https://hostname/path?priority=... (and potentially other store options) as the same identity for trusted-substituters.

Metadata

nix-env --version
# nix-env (Nix) 2.31.3

Additional context

Ran into this attempting to use numtide/llm-agents.nix in my own nixos/nix-darwin config.
Sidenote PR #15369 would have VASTLY improved the debugging experience, hope it lands soon!

Checklist

  • checked latest Nix manual (source)
  • checked open bug issues and pull requests for possible duplicates

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions