Skip to content
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

fix(lib): use ipaddr.js instead of ip for support IPv6 #3

Merged
merged 5 commits into from
Sep 5, 2019

Conversation

azu
Copy link
Owner

@azu azu commented Sep 5, 2019

https://github.com/indutny/node-ip has not defined IPv4-mapped IPv6 addresses like [::ffff:127.0.0.1].
Swith to use ipaddr.js for parsing IPv6 address correctly.

ipaddr.js has SpecialRanges that is defined RFC IP Address range that include IPv4-mapped IPv6 addresses.

https://github.com/whitequark/ipaddr.js/blob/3ade7dbfa1d9713f0aabe002c9a0718c4cc6cb5e/lib/ipaddr.js#L506

Changes

  • Fix to handle IPv6 address like IPv4-mapped IPv6 addresses

fix #2

azu added 2 commits September 5, 2019 21:33
- Fix to handle IPv6 address like IPv4-mapped IPv6 addresses
@azu azu force-pushed the switch-ipaddr.js branch from 4674f7c to d704fc1 Compare September 5, 2019 12:45
}
}
// TODO: rename option name
if (!options.allowPrivateIPAddress && range !== "unicast") {
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 think that allowPrivateIPAddress option name is invalid.
allowReservedIPAddress is correct.

// TODO: Travis CI does not support IPv6
// https://docs.travis-ci.com/user/reference/overview/
// https://github.com/travis-ci/travis-ci/issues/8891
(IS_TRAVIS ? it.skip : it)("IPv6: should not request because Socket is closed", async () => {
Copy link
Owner Author

Choose a reason for hiding this comment

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

Travis CI does not support IPv6...

We need to other CI servier that support IPv6 network...
In locally, These tests are passed.

@azu azu changed the title fix(lib): user ipaddr.js instead of ip fix(lib): user ipaddr.js instead of ip for IPv6 supporting Sep 5, 2019
@azu azu changed the title fix(lib): user ipaddr.js instead of ip for IPv6 supporting fix(lib): user ipaddr.js instead of ip for support IPv6 Sep 5, 2019
@azu azu changed the title fix(lib): user ipaddr.js instead of ip for support IPv6 fix(lib): use ipaddr.js instead of ip for support IPv6 Sep 5, 2019
@azu azu merged commit d732083 into master Sep 5, 2019
@azu azu deleted the switch-ipaddr.js branch September 5, 2019 13:16
@azu azu mentioned this pull request Sep 5, 2019
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.

[BUG] SSRF protection bypass
1 participant