8000 port() accepts non-numeric values, which can change the host · Issue #203 · libwww-perl/URI · GitHub
[go: up one dir, main page]

Skip to content

port() accepts non-numeric values, which can change the host #203

Open

Description

@oalders

URI::_server::port() (via _port) appends the new value to the authority without checking it. If the value has an @, the authority is parsed differently afterwards and host() returns another host.

my $u = URI->new("https://api.good.example/v1/hook");
$u->port("443\@evil.example");
say $u;           # https://api.good.example:443@evil.example/v1/hook
say $u->host;     # evil.example
say $u->userinfo; # api.good.example:443

Expected: the host stays api.good.example. port() should reject a value that isn't all digits (or percent-encode it), the same way host() escapes @ (s/[@]/%40/g; # protect @ in _server.pm).

Seen with URI 5.37.

Possibly related: #70 (out-of-range numeric ports).

🤖 Generated with Claude Code · Opus 5.5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      0