Skip to content

Autopudate#109

Merged
aojea merged 5 commits into
google:mainfrom
aojea:autopudate
Jun 9, 2026
Merged

Autopudate#109
aojea merged 5 commits into
google:mainfrom
aojea:autopudate

Conversation

@aojea

@aojea aojea commented Jun 8, 2026

Copy link
Copy Markdown
Collaborator

No description provided.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request simplifies peer discovery in cmd/sam-node/node.go by removing manual relay address construction and instead logging and saving the advertised addresses directly to the peerstore. In cmd/sam-hub/main.go, the addition of libp2p.EnableRelayService() is flagged as a security risk and redundant because a custom relay service with ACL is already instantiated elsewhere in the codebase.

Comment thread cmd/sam-hub/main.go
Comment on lines 160 to 162
libp2p.ConnectionManager(cm),
libp2p.EnableRelayService(),
libp2p.EnableAutoNATv2(),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

security-high high

The addition of libp2p.EnableRelayService() here is redundant and introduces a security risk.\n\n1. Redundancy & Conflicts: A custom relay service is already manually instantiated and configured with an ACL at line 272 (relay.New(h, relay.WithACL(&relayACL{hub: hub}))). Enabling it here via libp2p.Option will instantiate a second relay service instance with default options.\n2. Security Risk: The default relay service instantiated by libp2p.EnableRelayService() does not enforce the custom relayACL (which requires peer authentication). This could allow unauthorized peers to use the hub as a relay, bypassing your security policies.\n\nPlease remove this option and rely solely on the manual instantiation at line 272.

Suggested change
libp2p.ConnectionManager(cm),
libp2p.EnableRelayService(),
libp2p.EnableAutoNATv2(),
libp2p.ConnectionManager(cm),
libp2p.EnableAutoNATv2(),

@aojea aojea merged commit 799a8f6 into google:main Jun 9, 2026
10 checks passed
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.

1 participant