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
F15528959: D18388.id44198.diff
Tue, Apr 22, 3:26 PM
F15526488: D18388.id44199.diff
Mon, Apr 21, 9:08 PM
F15523018: D18388.id.diff
Sun, Apr 20, 11:09 PM
F15522835: D18388.id44199.diff
Sun, Apr 20, 9:47 PM
F15518672: D18388.diff
Sat, Apr 19, 3:39 PM
F15507771: D18388.diff
Tue, Apr 15, 10:39 PM
F15449488: D18388.id.diff
Mar 28 2025, 10:38 AM
F15447973: D18388.id44197.diff
Mar 28 2025, 2:38 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