Skip to content

Commit bbbb3b7

Browse files
committed
Undo change
1 parent 7cdde05 commit bbbb3b7

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

library/vulnerabilities/ssrf/findHostnameInUserInput.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,15 @@ export function findHostnameInUserInput(
1010
return false;
1111
}
1212

13+
const hostnameURL = tryParseURL(`http://${hostname}`);
14+
if (!hostnameURL) {
15+
return false;
16+
}
17+
1318
const variants = [userInput, `http://${userInput}`, `https://${userInput}`];
1419
for (const variant of variants) {
1520
const userInputURL = tryParseURL(variant);
16-
if (userInputURL && userInputURL.hostname === hostname) {
21+
if (userInputURL && userInputURL.hostname === hostnameURL.hostname) {
1722
const userPort = getPortFromURL(userInputURL);
1823

1924
if (!port) {

0 commit comments

Comments
 (0)