Skip to content
This repository has been archived by the owner on Mar 31, 2023. It is now read-only.

Add dns resolver #117

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
Owner

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
Owner 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
2 checks passed
@ospfranco ospfranco deleted the dns-resolver branch June 27, 2022 05:53
@ospfranco
Copy link
Owner Author

released under 1.1.16

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

Successfully merging this pull request may close these issues.

SSRF
2 participants