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

feat: use 0.0.0.0 as the default listening address for RPC and gnoweb #1657

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion docs/getting-started/setting-up-a-local-chain.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ gnoland start --chainid NewChainID
```

We can verify the chain ID has been changed, by fetching the status of the node and seeing the
associated chain ID. By default, the node exposes the JSON-RPC API on `http://127.0.0.1:26657`:
associated chain ID. By default, the node exposes the JSON-RPC API on `http://0.0.0.0:26657`[^1]:

```bash
curl -H "Content-type: application/json" -d '{
Expand Down Expand Up @@ -140,3 +140,7 @@ Following this pattern, potential entries into the genesis balances file would l
g1qpymzwx4l4cy6cerdyajp9ksvjsf20rk5y9rtt=10000000000ugnot
g1u7y667z64x2h7vc6fmpcprgey4ck233jaww9zq=10000000000ugnot
```

[^1]: The address `0.0.0.0` means that the node can be accessed by any IPv4 address,
including any loopback address like `127.0.0.1`, a private network address like
`192.168.0.X`, or a public IP address.
2 changes: 1 addition & 1 deletion gno.land/cmd/gnoweb/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func runMain(args []string) error {
fs.StringVar(&cfg.HelpChainID, "help-chainid", cfg.HelpChainID, "help page's chainid")
fs.StringVar(&cfg.HelpRemote, "help-remote", cfg.HelpRemote, "help page's remote addr")
fs.BoolVar(&cfg.WithAnalytics, "with-analytics", cfg.WithAnalytics, "enable privacy-first analytics")
fs.StringVar(&bindAddress, "bind", "127.0.0.1:8888", "server listening address")
fs.StringVar(&bindAddress, "bind", ":8888", "server listening address")

if err := fs.Parse(args); err != nil {
return err
Expand Down
2 changes: 1 addition & 1 deletion tm2/pkg/bft/rpc/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@
// DefaultRPCConfig returns a default configuration for the RPC server
func DefaultRPCConfig() *RPCConfig {
return &RPCConfig{
ListenAddress: "tcp://127.0.0.1:26657",
ListenAddress: "tcp://0.0.0.0:26657",

Check warning on line 91 in tm2/pkg/bft/rpc/config/config.go

View check run for this annotation

Codecov / codecov/patch

tm2/pkg/bft/rpc/config/config.go#L91

Added line #L91 was not covered by tests
Copy link
Member

Choose a reason for hiding this comment

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

i'm 100% Again this. This is WAY TO DANGEROUS for mainnet.

Too many validators on cosmos with having 127.0.0.1 by default expose their validator on 0.0.0.0, which is a terrible error and it's dangerous.

The result will be way worse if we set it to 0.0.0.0 by default.

CORSAllowedOrigins: []string{"*"},
CORSAllowedMethods: []string{http.MethodHead, http.MethodGet, http.MethodPost, http.MethodOptions},
CORSAllowedHeaders: []string{"Origin", "Accept", "Content-Type", "X-Requested-With", "X-Server-Time"},
Expand Down
Loading