Fix unsanitised input for GPG() parameter 'keyring'.

* Add assertions for checking that parameters 'verbose' and 'use_agent' are
   boolean values.
feature/documentation-builds-dirhtml
Isis Lovecruft 2013-03-07 01:15:36 +00:00 committed by Isis Lovecruft
parent c6f8a0bb55
commit 1f51375676
1 changed files with 8 additions and 1 deletions

View File

@ -947,9 +947,16 @@ class GPG(object):
else:
self.gpghome = gpghome
self.keyring = keyring
safe_keyring = _fix_unsafe(keyring)
self.keyring = safe_keyring
assert _is_file(self.keyring), "Could not find %s" % safe_keyring
assert isinstance(verbose, bool), "'verbose' must be boolean"
self.verbose = verbose
assert isinstance(use_agent, bool), "'use_agent' must be boolean"
self.use_agent = use_agent
if isinstance(options, str):
options = [options]
self.options = options