Skip to content

Conversation

@ghost
Copy link

@ghost ghost commented Nov 24, 2020

fixes #944

@ghost ghost requested a review from lidel as a code owner November 24, 2020 20:40
@ipfs ipfs deleted a comment from welcome bot Nov 24, 2020
@jessicaschilling
Copy link
Contributor

@lidel - might you have time for a review? Thanks!

Copy link
Member

@lidel lidel left a comment

Choose a reason for hiding this comment

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

Thank you @Sierra410!

ps. I noticed potential problems with IPv6 and inlined custom ports, so I've added additional normalization/tests for those scenarios. Should be robust enough now to handle anything you throw at it :-)

@lidel lidel changed the title fix: hostArrayCleanup allows ip addresses fix: IP support on opt-in and opt-out lists Nov 27, 2020
@lidel lidel changed the title fix: IP support on opt-in and opt-out lists fix: IP support on opt-in and opt-out lists Nov 27, 2020
@lidel lidel merged commit 724775e into ipfs:master Nov 27, 2020
@ghost
Copy link
Author

ghost commented Nov 27, 2020

x => isFQDN(x) || isIP.v4(x) || (!isIP.v6(x) && isIP.v6(x.replace(/[[\]]+/g, '')))

This will report malformed IPv6s like ]::1[ or [:[:[1[ as valid.

It should be more like this:

function isHostname(x) {
	if (isFQDN(x) || isIP.v4(x))
		return true
	
	const match = x.match(/^\[(.*)\]$/)
	
	if (match == null)
		return false
	
	return isIP.v6(match[1])
}

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.

Can't add an IP address to "Always Disable IPFS Integrations" list.

2 participants