Page MenuHomePhabricator

Increase strictness of URI parsing, rejecting URIs in the form "ssh://-flag"
ClosedPublic

Authored by epriestley on Aug 10 2017, 10:23 PM.
Tags
None
Referenced Files
F19811766: D18388.diff
Wed, Mar 4, 2:27 AM
F19758926: D18388.diff
Tue, Feb 17, 10:52 PM
F19504070: D18388.diff
Jan 9 2026, 3:33 AM
F19469124: D18388.diff
Jan 4 2026, 4:23 PM
F19468234: D18388.diff
Jan 4 2026, 12:54 AM
F18863115: D18388.diff
Nov 2 2025, 10:00 PM
F18836266: D18388.diff
Oct 26 2025, 11:37 PM
F18832820: D18388.diff
Oct 25 2025, 11:16 PM
Subscribers
None

Details

Summary

Ref T12961. See that task for discussion of the major attack we're responding to here.

  • Reject hosts beginning with "-". These are not legitimate.
  • Reject hosts beginning with ".". These are also not legitimate.
  • Tighten $ to \z. $ can match either "newline, end of string" or "end of string". \z matches ONLY "end of string". We don't want to match a newline, only "end of string" strictly.
  • We already that hosts otherwise contain only "reasonable" characters (letters, numbers, hyphens, and periods).
Test Plan
  • Added unit tests, ran unit tests.
  • Tried to set a repository URI to ssh://-oxyz/path with these changes, which worked previously; it no longer works.

Diff Detail

Repository
rPHU libphutil
Lint
Lint Not Applicable
Unit
Tests Not Applicable