-
Notifications
You must be signed in to change notification settings - Fork 1.2k
fix(supervisor-network): L7 endpoint validation edge cases #2464
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
base: main
Are you sure you want to change the base?
Changes from 2 commits
b413908
583f62e
200ecd2
ed4a4b6
805f189
7d2795a
3f45123
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1104,6 +1104,7 @@ fn network_endpoint_from_json( | |
| } | ||
|
|
||
| let mut ports = endpoint.ports; | ||
| ports.retain(|p| *p > 0); | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Warning (CWE-20): This changes the untrusted agent-proposal parser without testing that path. Please add |
||
| if ports.is_empty() && endpoint.port > 0 { | ||
| ports.push(endpoint.port); | ||
| } | ||
|
|
||
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.
Warning: This filters only a temporary vector whose sole consumer already checks
any(|port| *port > 0). Consequently,[0]was already rejected, while[0, 443]still passes and the zero remains in the JSON supplied to OPA. Please either reject any zero-valuedportsmember or remove zeros during endpoint normalization/proto serialization, then cover all-zero and mixed arrays with regression tests.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.
I will get to these later today thanks for raising this issue.