-
Type:
Bug
-
Resolution: Fixed
-
Priority:
Minor - P4
-
Affects Version/s: None
-
Component/s: None
_validate_uri and _parse_srv call unquote_plus on the entire host section of a connection string before splitting it into individual host:port entries.
This is the wrong order of operations per RFC 3986, which specifies splitting on delimiters first and percent-decoding the individual components afterward. Because decoding happens first, a percent-encoded , or : in the host section becomes a literal delimiter, so a single host entry can expand into multiple entries in the parsed nodelist. The related "no '/' in hosts" check runs on the raw string before decoding, so an encoded / is not caught either.
Unix domain socket paths are the only host identifiers that legitimately require percent-encoding, since they may contain /.
Proposed fix: move the percent-decoding into split_hosts, apply it only to Unix domain socket paths (identified by an unescaped .sock suffix before decoding), and only after splitting on ,.
Affects the sync and async parsers equally. See SECBUG-4278 for details.