meejah / TorNS

prototype/proof-of-concept to implement Proposition 279 w/o changing Tor
The Unlicense
5 stars 8 forks source link

Clearing env #7

Closed JeremyRand closed 5 years ago

JeremyRand commented 5 years ago

In https://github.com/meejah/TorNS/blob/df0c8ce39fe2ae7cd57b51d2b88def7b07fe23ac/poc.py#L104-L114 , the env is cleared except for the 3 variables that are explicitly set. Is this intended to be a security feature, or is it an oversight? It seems to break things on Windows (both of the example services exit with an error, as does Namecoin's Go-based dns-prop279... I think the error is related to being unable to access the random number generator?). Namecoin's Stem-based fork of TorNS is currently passing through the existing env ( https://github.com/namecoin/StemNS/commit/9d2a5c5740d07b423b12c129a3c81dcd6895f870 ) in order to make things work on Windows, but I figured it would be a good idea to check with you on whether Namecoin's change is a good idea.

meejah commented 5 years ago

"In general" I like being explicit about things, but don't know why this was written that way. I think without e.g. HOME and similar "expected" variables, it might not be super happy on Linux either...

I guess "if you didn't want an env-var passed through, don't set it in the parent environment" is fine :) and I think it's fine to pass through env= as os.environ + TOR_NS* vars too...

meejah commented 5 years ago

(Anyway, point is I'm happy to merge a thing which change environment handling :)