Skip to content
Snippets Groups Projects
Commit 028652e7 authored by dakkar's avatar dakkar
Browse files

extract host, not hostname!

`url.host` includes the port, `url.hostname` doesn't.

`http://foo.example.com/something` and
`http://foo.example.com:1234/something` are different resources served
by different hosts, we should not confuse them

note that `(new URL('http://localhost:80')).host` is `localhost` and
`(new URL('https://localhost:443')).host` is also `localhost`: the
default port gets correctly ignored

this change should not really affect anything in "the real world", as
we're all serving over https from port 443, but it may stop some
impersonation attacks
parent 4e4a1457
No related branches found
No related tags found
1 merge request!484some validation fixes
Pipeline #453 passed with stage
in 1 minute and 55 seconds
......@@ -86,7 +86,7 @@ export class UtilityService {
@bindThis
public extractDbHost(uri: string): string {
const url = new URL(uri);
return this.toPuny(url.hostname);
return this.toPuny(url.host);
}
@bindThis
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment