s-ui/util
freedomdb 34ecbbb4ac
sub: strip control characters from the Profile-Title header (#1311)
GetHeaders returns the client's remark (or name) as the
Profile-Title value, and neither field has any character
restriction on the way in -- validateClientName checks only
emptiness and duplicates, and the remark is not validated at all.
addHeaders then sets the header verbatim.

Go's net/http refuses to write a response whose header values
contain control bytes, so a remark with a CR or LF in it does not
inject a header (that is not possible) -- it makes the whole
subscription response fail to write. Link, clash and json formats
all go through GetHeaders, so one bad remark silently breaks
every subscription format for that client until an admin edits
the remark; the subscriber cannot fix their own name or remark.

Everything around this one header is already sanitized -- the
Content-Disposition built from the same value goes through
asciiSafeFilename + rfc5987Encode, and admin-defined custom
headers are validated with httpguts.ValidHeaderFieldValue. Strip
control characters from the title in GetHeaders, at the source,
and add a regression test.

Related, for a separate look: the name doubles as the
subscription ID, so a name containing '/' can never match the
single-segment /:subid route -- the same missing character-set
constraint on names, but a naming-policy question rather than
this bug, so it is not touched here.

Prepared by muse ai
2026-10-31 17:18:10 +01:00
..
common bulk edit-delete #636 #1035 2026-03-08 01:23:07 +01:00
base64.go links: accept unpadded and url-safe base64, legacy ss format #1281 2026-10-10 21:48:31 +02:00
cert.go qa tests and fixes phases 3-6 2026-09-12 18:49:52 +02:00
cert_ping_test.go qa tests and fixes phases 3-6 2026-09-12 18:49:52 +02:00
genLink.go Fix bare type assertions in link generation and swallowed WireGuard key parse error (#1296) 2026-10-22 19:55:06 +02:00
genlink_test.go qa tests and fixes phases 3-6 2026-09-12 18:49:52 +02:00
host.go fix ipv6 in link and sub #1220 2026-08-12 14:58:33 +02:00
linkToJson.go Preserve XHTTP settings in external Clash subscriptions (#1295) 2026-10-21 23:26:14 +02:00
linkToJson_ss_test.go links: accept unpadded and url-safe base64, legacy ss format #1281 2026-10-10 21:48:31 +02:00
linkToJson_xhttp_test.go Preserve XHTTP settings in external Clash subscriptions (#1295) 2026-10-21 23:26:14 +02:00
outJson.go feat: hysteria-realm service and realm-aware hysteria2 subscriptions #1317 2026-10-31 16:24:26 +01:00
outJson_test.go feat: hysteria-realm service and realm-aware hysteria2 subscriptions #1317 2026-10-31 16:24:26 +01:00
password.go qa tests and fixes phases 3-6 2026-09-12 18:49:52 +02:00
password_test.go qa tests and fixes phases 3-6 2026-09-12 18:49:52 +02:00
shadowsocks.go v1.5.4 2026-07-19 19:03:23 +02:00
subInfo.go sub: strip control characters from the Profile-Title header (#1311) 2026-10-31 17:18:10 +01:00
subinfo_test.go sub: strip control characters from the Profile-Title header (#1311) 2026-10-31 17:18:10 +01:00
subToJson.go Preserve XHTTP settings in external Clash subscriptions (#1295) 2026-10-21 23:26:14 +02:00