Skip to content

Commit

Permalink
Undo change
Browse files Browse the repository at this point in the history
  • Loading branch information
hansott committed Feb 21, 2025
1 parent 7cdde05 commit bbbb3b7
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion library/vulnerabilities/ssrf/findHostnameInUserInput.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,15 @@ export function findHostnameInUserInput(
return false;
}

const hostnameURL = tryParseURL(`http://${hostname}`);
if (!hostnameURL) {
return false;
}

const variants = [userInput, `http://${userInput}`, `https://${userInput}`];
for (const variant of variants) {
const userInputURL = tryParseURL(variant);
if (userInputURL && userInputURL.hostname === hostname) {
if (userInputURL && userInputURL.hostname === hostnameURL.hostname) {
const userPort = getPortFromURL(userInputURL);

if (!port) {
Expand Down

0 comments on commit bbbb3b7

Please sign in to comment.