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

Improve Port Validation for Node Configs #4651

Open
linear bot opened this issue Oct 23, 2024 · 1 comment
Open

Improve Port Validation for Node Configs #4651

linear bot opened this issue Oct 23, 2024 · 1 comment

Comments

@linear
Copy link

linear bot commented Oct 23, 2024

in node/node.go try to externalize these validation to the config creation itself. i.e., move it upstream.

givenPortNumber := cfg.BacalhauConfig.API.Port
if givenPortNumber < minPortNumber {
    return nil, fmt.Errorf("invalid negative port number: %d", cfg.BacalhauConfig.API.Port)
}
if givenPortNumber > maxPortNumber {
    return nil, fmt.Errorf("port number %d exceeds maximum allowed value (65535)", cfg.BacalhauConfig.API.Port)
}

safePortNumber := uint16(givenPortNumber)
Copy link
Author

linear bot commented Oct 23, 2024

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

No branches or pull requests

0 participants