Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
Boscop opened this issue Sep 27, 2019 · 4 comments
Closed

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

Boscop opened this issue Sep 27, 2019 · 4 comments
Labels
A-driver Area: rustc_driver that ties everything together into the `rustc` compiler A-reproducibility Area: Reproducible / deterministic builds C-enhancement Category: An issue proposing an enhancement or a PR with one. C-feature-request Category: A feature request, i.e: not implemented / a PR. T-cargo Relevant to the cargo team, which will review and decide on the PR/issue. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@Boscop
Copy link

Boscop commented Sep 27, 2019

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.

@jonas-schievink jonas-schievink added A-driver Area: rustc_driver that ties everything together into the `rustc` compiler C-enhancement Category: An issue proposing an enhancement or a PR with one. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Sep 27, 2019
@Mark-Simulacrum Mark-Simulacrum added the C-feature-request Category: A feature request, i.e: not implemented / a PR. label Dec 7, 2019
@joshtriplett
Copy link
Member

Ideally, I'd like to see Rust defaulting to omitting full paths, and only including project-root-relative paths. That would make Rust builds more reproducible, as well as hiding potentially private information.

@Evrey
Copy link

Evrey commented Jan 6, 2020

When using log, I already get project-relative paths for my own code, like src/log.rs. However, for dependencies the full absolute path is logged, for example: /home/evrey/.cargo/registry/src/github.com-1ecc6299db9ec823/winit-0.20.0-alpha6/src/platform_impl/linux/x11/window.rs So… we're half-way there for privacy in paths. I think it may be good enough to start the latter path after .config, displaying it as $CARGO_HOME/registry/… instead.

@ghost
Copy link

ghost commented Aug 15, 2021

rust-lang/rfcs#3127 is try for this but yes rust should be reproduce and private by default. they claim will be default but im not trust until i see so

@jyn514 jyn514 added T-cargo Relevant to the cargo team, which will review and decide on the PR/issue. A-reproducibility Area: Reproducible / deterministic builds labels Jun 16, 2023
@jyn514
Copy link
Member

jyn514 commented Jun 16, 2023

  1. 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.

This is tracked in #89434.

The other issues you mentioned look like they would also be solved by -Z remap-cwd-prefix.

@jyn514 jyn514 closed this as not planned Won't fix, can't repro, duplicate, stale Jun 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-driver Area: rustc_driver that ties everything together into the `rustc` compiler A-reproducibility Area: Reproducible / deterministic builds C-enhancement Category: An issue proposing an enhancement or a PR with one. C-feature-request Category: A feature request, i.e: not implemented / a PR. T-cargo Relevant to the cargo team, which will review and decide on the PR/issue. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

6 participants