Conversation
|
It is already possible to hide any bubblewrap option, including
|
smcv
left a comment
There was a problem hiding this comment.
I'm not sure how much effort we should be spending on adding "syntactic sugar" for things that are already possible. bubblewrap is a low-level tool that avoids having dependencies, so it will often make more sense for nice-to-have things to be done by its caller, rather than in bubblewrap itself.
| " --clearenv Unset all environment variables\n" | ||
| " --setenv VAR VALUE Set an environment variable\n" | ||
| " --unsetenv VAR Unset an environment variable\n" | ||
| " --env VAR Inherit environment variable VAR from the caller\n" |
There was a problem hiding this comment.
If we add this feature as something separate from the --args mechanism that I described, I'd prefer it to be called --inherit-env or --inheritenv or similar. Related tools like Flatpak have an --env option that behaves like bwrap --setenv, so it would be really confusing to have an --env option with different behaviour.
| else if (strcmp (arg, "--env") == 0) | ||
| { | ||
| if (argc < 2) | ||
| die ("--env takes an argument"); |
There was a problem hiding this comment.
If this is added, it should probably also valdiate that the argument doesn't contain =, which is the one non-zero byte that is not allowed in environment variable names.
| const char *value = getenv (argv[1]); | ||
| if (value) | ||
| xsetenv (argv[1], value, 1); |
There was a problem hiding this comment.
Did you test this? Does it work? If it does, I'd be surprised.
If you previously passed --clearenv, won't the environment block already be empty? which means getenv() will return NULL and the new option is useless?
Hello. When passing secrets in environment variables to process under bwrap with a program that prints the command executed, for example in shell when set -x is enable, like debugging or various gitlab-ci tools, the bwrap command line will expose passwords to the logs.
This pull request add a simple --env option, that can be used like:
bwrap --clearenv --env TOKENto just inherit the value of environment variable whatever that value is, which will not show up in set -x output.Thank you.