-
Notifications
You must be signed in to change notification settings - Fork 1.6k
PVF worker: random fixes #7649
PVF worker: random fixes #7649
Conversation
- Fixes possible panic due to non-UTF-8 env vars (#7330 (comment)) - Very small refactor of some duplicated code
If we don't use anything like |
// TODO: *theoretically* the value (or mere presence) of `RUST_LOG` can be a source of | ||
// randomness for malicious code. In the future we can remove it also and log in the host; | ||
// see <https://github.com/paritytech/polkadot/issues/7117>. | ||
if key != "RUST_LOG" { | ||
if key.to_str() != Some("RUST_LOG") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to_str
here? As far as I see, we can directly compare OsStr
and str
, even if OsStr
variable has some unsafe unicode.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, looks like you're right.
It seems that we need to filter
|
In case of a key or value that would cause env::remove_var to panic, we first log a warning and then proceed to attempt to remove the env var.
Thanks @vstakhov, pushed a commit. Got to use |
bot merge |
Waiting for commit status. |
env::remove_var
to panic, we first log a warning and then proceed to attempt to remove the env var.Not needed on Unix according to @vstakhovI didn't address keeping
PATH
as it's not needed for the workers to function. @vstakhov is there any reason to keep it?