Commit graph parsimony/internal/web/web.go
Author SHA1 Message Date
tgiachi
a63807e71b fix(web): refuse a bare IP address as the domain of a typed address
a@127.0.0.1 has dots and digit labels, so it passed the domain check
and named the daemon's own host without brackets. No top-level domain
is all digits: a domain whose last label is all digits is refused.
2026-11-10 15:16:48 +01:00
tgiachi
96a1243c2f fix(web): refuse local addresses on the subscribe form
root@localhost, a@b and a@[127.0.0.1] passed mail.ParseAddress, so the
public form could make the daemon mail itself or its own network.

The domain of a typed address must now contain a dot, not be a domain
literal, be made of non-empty labels of letters, digits and hyphens, and
not be localhost or end in .localhost, .local, .internal or .invalid.
.test and .example stay accepted (the end-to-end tests use them).
2026-11-10 15:11:43 +01:00
tgiachi
44b3f9d98a fix(web): key the subscribe limit on the real client
Behind a reverse proxy every visitor shared the proxy's address, so the
whole site got 10 signups an hour and one person could block everyone.
Over IPv6 each address of a /64 was a fresh key, so the limit did not
bind and the map grew by one entry per address.

- web.trusted_proxies (addresses or CIDR ranges, default empty) is
  validated at load and passed to the web handler. X-Forwarded-For is
  read only when the TCP peer is a trusted proxy; the client is then the
  right-most entry that is not itself a trusted proxy. An empty or
  malformed header falls back to the peer. With no trusted proxy the
  behaviour is unchanged: the header is ignored.
- IPv6 clients are keyed by their /64, IPv4 clients by address.
- The limiter remembers at most 100000 clients. When full it sweeps
  expired entries first and otherwise answers 429 to new clients until
  the oldest window ends, instead of growing.
2026-11-10 15:11:26 +01:00
tgiachi
922e2dc500 feat(web): public subscribe form for lists with a public archive and open joins
- GET /subscribe/{address}: email field, an off-screen honeypot named website,
  a Subscribe button; 404 (the usual page) for a private, closed or unknown list
- POST /subscribe/{address}: one plain ASCII address of at most 254 characters,
  else the form again (400) with the escaped typed value; a filled honeypot gets
  the success page and nothing happens; otherwise Router.RequestJoin and always
  the same neutral page, so a member, a rate limited address or an unknown
  one cannot be told apart; the body is limited to 4 KiB (413)
- at most 10 POSTs per hour per TCP peer address (X-Forwarded-For is ignored),
  then 429 with Retry-After; idle addresses are swept; the clock is injectable
- a Subscribe link on the archive page of a list that qualifies, nothing else
- no-store on the subscribe pages; the CSP is unchanged
- tests for each of these, including escaping, enumeration, the limit and its expiry
2026-11-10 12:38:02 +01:00
tgiachi
ec8ca567ff feat(web): logo and favicon on the public pages
- Show the mark on every page, linking to the index, inline so the CSP needs no image source
- Add the favicon as a data: URI and allow img-src data: only
2026-11-10 12:13:53 +01:00
tgiachi
19c845caab feat(web): public archive pages and one-click unsubscribe
- Add list index, paginated archive with search, and message pages with thread links
- Show only lists whose archive policy is public; hide others and foreign messages with 404
- Escape all content and obfuscate email addresses in subjects, senders and bodies
- Add GET confirm page and POST one-click unsubscribe with signed tokens
- Send CSP, nosniff, no-referrer and no-store headers
2026-11-09 15:20:45 +01:00