Repository navigation
Conversation
|
Review requested:
|
|
It doesn't seem right to override this with the dot env files without checking privileges which was what SafeGetEnv was for. Maybe @bnoordhuis knows better whether this violates what it tried to guard against. |
| @@ -108,10 +108,14 @@ bool Dotenv::ParsePath(const std::string_view path) { | |||
| } | |||
|
|
|||
| void Dotenv::AssignNodeOptionsIfAvailable(std::string* node_options) { | |||
| auto match = store_.find("NODE_OPTIONS"); | |||
| AssignValueIfAvailable("NODE_OPTIONS", node_options); | |||
There was a problem hiding this comment.
We don't need this function anymore. Ref: AssignNodeOptionsIfAvailable
| AssignValueIfAvailable("NODE_OPTIONS", node_options); | ||
| } | ||
|
|
||
| void Dotenv::AssignValueIfAvailable(const char* key, std::string* value) { |
There was a problem hiding this comment.
| void Dotenv::AssignValueIfAvailable(const char* key, std::string* value) { | |
| void Dotenv::AssignValueIfAvailable(const std::string& key, std::string* value) { |
Thanks @joyeecheung, I'm not sure whether this change is reliable. @bnoordhuis If you are free, please help to review it. Update: I check the comment on |
5f4f97a to
b012fa7
Compare
|
any update? |
|
I think we need someone like @bnoorhuis or someone from @nodejs/security to review it and confirm that this is not introducing a attack vector |
|
Just briefly looked at it so I hope I don't miss anything important. Here's my observation:
|
|
I think the original intent of SafeGetEnv is to guard against e.g. improper permission escalation when the binary gets the setuid bit set. Not sure what the threat model is. It might also make sense to completely ignore the .env file when the binary gets modified like that. |
|
so need to do the same check like |
|
That would be what I'd do - just ignoring the .env too when the permission check fails - but I don't think I am familiar enough with the original threat model to make a call. |
|
This pull request has been marked as stale due to 90 days of inactivity. |
Fixes: #51426