Skip to content

remap-path-prefix is not convenient to use in .cargo/config for privacy #64839

Closed as not planned
@Boscop

Description

@Boscop

Let's say when building your executable for release, you have this goal: Maximum privacy, strip all paths associated with the build machine from the release executable. Requirements:

  • it should be doable with no cmd line flags (just a fixed .cargo/config)
  • it should work regardless of which machine the build is done on
  • it should work regardless of what the path to the project is on the build machine
  • it should not require mentioning paths from a specific build machine in any file in the repo (like .cargo/config)

remap-path-prefix-from requires specifying the path to the project. There are 2 problems with it:

  1. It's very user-unfriendly, if all someone wants is to just maximum privacy when releasing a binary.
  2. It requires specifying the absolute path that should be hidden from the exe, which depends on the folder structure of the build machine, thus it can't be done with a fixed .cargo/config.

It would be better to have an option that:

  1. Is easier to use when the goal is maximum privacy.
  2. Works independently of the path to the project folder on every build machine that it's run on, not requiring to specify the path. It should be inferred.

It could look like this: --strip-path-prefix and it behaves like remap-path-prefix-from set to the path to the project and remap-path-prefix-to set to the empty string.

If this is too much to ask, as an alternative, it should be possible to pass a placeholder to remap-path-prefix-from that always means "the project's path", so that it can be used inside .cargo/config, agnostic to the build machine / project path.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-driverArea: rustc_driver that ties everything together into the `rustc` compilerA-reproducibilityArea: Reproducible / deterministic buildsC-enhancementCategory: An issue proposing an enhancement or a PR with one.C-feature-requestCategory: A feature request, i.e: not implemented / a PR.T-cargoRelevant to the cargo team, which will review and decide on the PR/issue.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions