-
Notifications
You must be signed in to change notification settings - Fork 446
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
feat: Use CIDR format for connection-manager allow/deny lists #2783
base: main
Are you sure you want to change the base?
Conversation
…r handling for invalid multiaddrs
…Net with encapsulation
…g behavior for allowlist connections
Commit History and ChangesThis document summarizes the commits made to the repository, detailing the changes and the rationale behind each commit. 1. Commit: Add
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good, really close - comments inline.
const ma = '/ip4/127.0.0.1/ipcidr/32' | ||
const ipNet = multiaddrToIpNet(ma) | ||
expect(ipNet.toString()).to.equal('127.0.0.1/32') | ||
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please can you add some tests for IPv6 addresses
@@ -571,7 +583,7 @@ export class DefaultConnectionManager implements ConnectionManager, Startable { | |||
async acceptIncomingConnection (maConn: MultiaddrConnection): Promise<boolean> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please can you add some tests that show that incoming connections are denied for multiaddrs in the deny list and allowed for ones in the allow list.
They should show that individual addresses and ranges are handled correctly in both IPv4 and IPv6 formats.
It should be a case of adding more tests like this one and this one.
@SgtPooki @wemeetagain @dhuseby
Description
This PR updates the connection manager to treat multiaddrs in the allow/deny lists using the standard IP CIDR format (e.g.
/ip4/52.55.0.0/ipcidr/16
) rather than string prefixes (e.g./ip4/52.55
). This allows us to validate multiaddrs accurately and ensures better control over IP address matching.Changes:
.allow
and.deny
properties in the connection manager to useIpNet[]
for IP range validation.IpNet
format for both allow and deny lists.Relevant issues:
Notes & open questions
IpNet
format to ensure the connection manager handles IPs in CIDR notation.Change checklist