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
F22731035: D18388.id.diff
Sun, Oct 4, 6:29 AM
F22677479: D18388.id44197.diff
Thu, Oct 1, 11:30 PM
F22655075: D18388.id44198.diff
Thu, Oct 1, 2:50 AM
F22524075: D18388.id44197.diff
Sun, Sep 20, 10:06 PM
Unknown Object (File)
Aug 24 2026, 11:43 PM
Unknown Object (File)
Aug 15 2026, 6:40 AM
Unknown Object (File)
Aug 14 2026, 6:17 PM
Unknown Object (File)
Jul 11 2026, 12:50 AM
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