[tor-commits] [bridgedb/master] Also forbid bogus characters in PT fingerprint and address
isis at torproject.org
isis at torproject.org
Sat Jul 25 19:26:19 UTC 2015
commit 44e31908090a0e70dfdd82020a5b89c80e04a6d2
Author: Robert Ransom <rransom.8774 at gmail.com>
Date: Thu Apr 30 10:37:47 2015 -0700
Also forbid bogus characters in PT fingerprint and address
---
lib/bridgedb/bridges.py | 26 ++++++++++++++++++++++++++
1 file changed, 26 insertions(+)
diff --git a/lib/bridgedb/bridges.py b/lib/bridgedb/bridges.py
index b799ca3..61cf503 100644
--- a/lib/bridgedb/bridges.py
+++ b/lib/bridgedb/bridges.py
@@ -356,6 +356,10 @@ class PluggableTransport(BridgeAddressBase):
characters or double quotes or backslashes, in keys or
in values.
+ 3. The :data:`fingerprint` and :data:`address` do not
+ contain non-ASCII or control characters or double quotes
+ or backslashes.
+
:raises MalformedPluggableTransport: if any of the above checks fails.
"""
if not self.fingerprint:
@@ -391,6 +395,28 @@ class PluggableTransport(BridgeAddressBase):
% (k, v))
pass
+ if not isascii_noncontrol(self.fingerprint):
+ raise MalformedPluggableTransport(
+ ("Cannot create PluggableTransport with non-ASCII or "
+ "control characters in fingerprint: %r")
+ % self.fingerprint)
+ if '"' in self.fingerprint or '\\' in self.fingerprint:
+ raise MalformedPluggableTransport(
+ ("Cannot create PluggableTransport with double quotes or "
+ "backslashes in fingerprint: %r")
+ % self.fingerprint)
+
+ if not isascii_noncontrol(self.address):
+ raise MalformedPluggableTransport(
+ ("Cannot create PluggableTransport with non-ASCII or "
+ "control characters in address: %r")
+ % self.address)
+ if '"' in self.address or '\\' in self.address:
+ raise MalformedPluggableTransport(
+ ("Cannot create PluggableTransport with double quotes or "
+ "backslashes in address: %r")
+ % self.address)
+
if not self._checkArguments():
raise MalformedPluggableTransport(
("Can't use %s transport with missing arguments. Arguments: "
More information about the tor-commits
mailing list