pluggable transport socks k=v syntax
This is about the optional k=v
parameters that can be specified in a Bridge
line in torrc, and will then be passed to the PT via the SOCKS handshake.
According to the spec, the settings are to be ;
-separated; and the characters \
=
;
are supposed to be escaped. Implicitly, it seems to be trying to support arbitrary characters in both keys and values.
However, bridges are usually specified in Bridge lines, as found in the C Tor torrc (and as interpreted elsewhere). That means they ought to have a reasonable character set. Also, the Bridge line syntax does not have a way to spcify spaces within values (or key names).
Additionally, the code in C Tor does not conform to the specification. The actual behaviour is as follows: firstly the line is split on whitespace, by the general config line handling code. Then the key=value
items are checked to see that they have a non-initial =
; if not, it's an error. Then strings are subjected to \
-escaping of only \
and ;
, and concatenated together with ;
.
I suggest the following retcon:
- Document bridge lines as part of the official spec. They're an interechange format, not any longer a config detail of C Tor.
- Define a restricted character set for keys. Ideally we would say "C identifiers" like we do for transport names, but we don't want to break anything that is out there in the wild, so perhaps a wider character set should be allowed.
- Define a restricted character set for values. This should be fairly broad, probably, but it should be restricted to 7-bit ASCII printing characters at the very least. But, IMO it should be restricted further: for example, I think
\
"
'
here are rather undesirable.
For now in Arti I propose to implement roughly what C Tor does. The result will still not be capable of putting whitespace into values (or key names). And it would be less ergonomic than C Tor in the case where literal \
are supposed to be specified, since Arti's config file is TOML and would need \
-doubling (or the use of '''
). I'm hoping that this is irrelevant.