Skip to content

Add dns resolver #117

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 27, 2022
Merged

Add dns resolver #117

merged 2 commits into from
Jun 27, 2022

Conversation

ospfranco
Copy link
Collaborator

Closes #115

@AbdurrahmanA would you mind taking a look and making sure the implementation is correct?

index.ts Outdated
@@ -21,13 +22,20 @@ interface IPreFetchedResource {
data: string;
}

const metaTag = (doc: cheerio.Root, type: string, attr: string) => {
function throwOnLoopback(address: string) {
if (address === "localhost" || address === "127.0.0.1") {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The loopback address doesn't always have to be "localhost" or "127.0.0.1", we may need to check other reserved local ips, I think it makes more sense to use regex for this. e.g

new RegExp(
    "^" +
      "(?:(?:10|127)(?:\\.\\d{1,3}){3})" +
      "|" +
      "(?:(?:169\\.254|192\\.168|192\\.0)(?:\\.\\d{1,3}){2})" +
      "|" +
      "(?:172\\.(?:1[6-9]|2\\d|3[0-1])(?:\\.\\d{1,3}){2})" +
      "$",
    "i"
  )

if you can find a more comprehensive regex it will be nice too

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll just use this regex for now

@ospfranco ospfranco merged commit 7331edd into main Jun 27, 2022
@ospfranco ospfranco deleted the dns-resolver branch June 27, 2022 05:53
@ospfranco
Copy link
Collaborator Author

released under 1.1.16

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

SSRF
2 participants