diff options
author | Michał Górny <mgorny@gentoo.org> | 2018-02-08 17:49:40 +0100 |
---|---|---|
committer | Michał Górny <mgorny@gentoo.org> | 2018-02-08 17:49:40 +0100 |
commit | 546e7a9695728fa205fbfe7c373762b25697b12a (patch) | |
tree | 3d09bfafc37217cf51903fb86d071a9d94f65a6f | |
parent | 3aeadeb4587d36e7b3cfc30fd970a68b5996584e (diff) | |
download | gemato-546e7a9695728fa205fbfe7c373762b25697b12a.tar.gz |
openpgp: Do not wipe the environment in isolated mode
Do not wipe the complete environment when running in isolated mode
as this had unintended side effect of wiping PATH. Since there is no
real reasons to pursue a proper whitelist for this, just preserve
the environment while overriding GNUPGHOME and TZ appropriately.
-rw-r--r-- | gemato/openpgp.py | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/gemato/openpgp.py b/gemato/openpgp.py index b4f6a27..de3139a 100644 --- a/gemato/openpgp.py +++ b/gemato/openpgp.py @@ -139,10 +139,10 @@ class OpenPGPSystemEnvironment(object): outf.write(out.decode('utf8')) - def _spawn_gpg(self, options, stdin, env=None): - if env is None: - env = os.environ.copy() + def _spawn_gpg(self, options, stdin, env_override={}): + env = os.environ.copy() env['TZ'] = 'UTC' + env.update(env_override) impls = ['gpg2', 'gpg'] if self._impl is not None: @@ -230,5 +230,6 @@ disable-scdaemon return self._home def _spawn_gpg(self, options, stdin): - env = {'GNUPGHOME': self.home} - return super(OpenPGPEnvironment, self)._spawn_gpg(options, stdin, env) + env_override = {'GNUPGHOME': self.home} + return (super(OpenPGPEnvironment, self) + ._spawn_gpg(options, stdin, env_override)) |