Repository navigation
fix(supervisor-network): L7 endpoint validation edge cases - #2464
andrewwhitecdw wants to merge 1 commit into
Conversation
|
I have read the DCO document and I hereby sign the DCO. |
johntmyers
left a comment
There was a problem hiding this comment.
gator-agent
PR Review Status
Validation: This is project-valid small, concentrated work in supervisor network-policy handling: it replaces a malformed-input panic with fail-closed validation and attempts to make zero-port handling consistent. No duplicate work was found.
Head SHA: 583f62ef7019a4c54b23fe91e6ef289c2ca02d4a
Review findings:
- One correctness issue is anchored inline: the raw-policy zero-port filter does not normalize the policy data later supplied to OPA, so mixed arrays still retain zero.
- Focused regression coverage is missing for all three changed contracts. Please add unit tests showing that a non-object endpoint reports the expected validation error and preset expansion remains panic-free; raw-policy
[0]and[0, 443]follow the intended contract; and agent proposals reject an all-zero array while retaining only positive entries from mixed arrays, including scalar fallback.
Docs: Fern docs are not needed for this malformed-input robustness fix; the existing policy reference already describes endpoint objects and concrete MCP ports.
E2E: The changed network-policy path requires test:e2e after review findings are resolved.
Next state: gator:in-review pending an author update.
|
@andrewwhitecdw Several of your PRs are awaiting feedback, please let us know if you plan on looking so we can plan accordingly |
…ion tests Addresses gator-agent review feedback on NVIDIA#2464: - Filter zero values from endpoint ports arrays in normalize_endpoint_ports so OPA never sees a zero port. - Promote positive scalar port to ports array; leave all-zero arrays empty. - Skip non-object endpoints during normalization instead of panicking. - Add regression tests for non-object endpoint validation, zero-port filtering, and scalar fallback. Signed-off-by: Andrew White <andrewh@cdw.com>
johntmyers
left a comment
There was a problem hiding this comment.
gator-agent
PR Review Status
Validation: This remains project-valid small, concentrated robustness work in supervisor network-policy handling.
Head SHA: 200ecd2f0444b5ef60d33c2332990c546e521dc5
Thanks @andrewwhitecdw. I checked the update you pushed after the earlier zero-port normalization and test feedback. The raw-YAML mixed-array case is now normalized and the added helper tests cover that path, but the production proto load/reload path still bypasses the new normalizer.
Review findings:
- One critical correctness/security-boundary issue is anchored inline: zero ports still reach OPA through
OpaEngine::from_proto. - One warning is anchored inline: the separate agent-proposal parser behavior still needs focused regression coverage.
Docs: Fern docs are not needed because this hardens malformed input without changing supported policy syntax or commands.
E2E: The network-policy path still requires test:e2e after review findings are resolved.
Next state: gator:in-review pending an author update.
|
Thanks for the nudge — I’ve gone through all five open PRs:
All relevant test suites pass. Please re-review when you have a chance. |
|
Both review items addressed:
Verified: |
johntmyers
left a comment
There was a problem hiding this comment.
gator-agent
PR Review Status
Validation: This remains project-valid small, concentrated robustness work in supervisor network-policy handling.
Head SHA: ed4a4b63649a5857e2405a8f72bbb62f99a93282
Thanks @andrewwhitecdw. I checked your update about filtering zero ports in the production proto-to-OPA path and adding focused proposal-parser coverage. Those prior gaps are addressed, but the independent review found two remaining normalization cases that can reinterpret malformed or zero-only authorization input as a scalar-port allow; both are anchored inline. A focused preset-expansion regression gap is also anchored inline.
Review findings:
- Two blocking CWE-20 warnings are anchored inline: malformed JSON array elements can be discarded before scalar fallback, and zero-only proto arrays can activate a shadowed scalar despite documented
portsprecedence. - One focused test gap is anchored inline for the removed
expand_access_presetsunwraps.
Docs: Fern docs are not needed for the intended malformed-input robustness fix. If scalar fallback for an explicitly present zero-only ports array is intentional, the schema and proto precedence contract would need updating.
E2E: The network-policy path still requires test:e2e after review findings are resolved.
Next state: gator:in-review pending an author update.
Author Follow-Up NudgeThis PR has been in @andrewwhitecdw, please respond to the two blocking review comments about malformed array elements and zero-only proto-array precedence, or push an update. If this is no longer planned, please say so and a maintainer can close it out. |
1 similar comment
Author Follow-Up NudgeThis PR has been in @andrewwhitecdw, please respond to the two blocking review comments about malformed array elements and zero-only proto-array precedence, or push an update. If this is no longer planned, please say so and a maintainer can close it out. |
96d1085 to
805f189
Compare
|
/ok to test 805f189 |
johntmyers
left a comment
There was a problem hiding this comment.
gator-agent
PR Review Status
Validation: This remains project-valid small, concentrated robustness work in supervisor network-policy handling.
Head SHA: 805f189c9a35f241bcbf3395bbd0cea1bfaa5d7a
Base SHA: 0c7e59a95355cabc15ccaddb86fcbe6a1d30eaaa
Merge base SHA: 21da343c9f838bd9ac85dc61bf44889de1a72873
Patch ID: d8044cf19d18d7dd4ad2547d4467f81feea7a843
Gator payload: 3
Review mode: follow_up
Previous reviewed SHA: ed4a4b63649a5857e2405a8f72bbb62f99a93282
Thanks @andrewwhitecdw. I checked the update pushed after the malformed-array and zero-only proto-array feedback. The raw-policy normalizer now preserves malformed non-numeric entries for fail-closed validation, the proto conversion preserves explicit ports precedence, and focused regression coverage now exercises both cases plus preset expansion with a non-object endpoint.
Blocking findings:
- No blocking findings remain.
Carried findings:
gator-inline-3679152284: resolved by preserving non-numeric array entries through normalization.gator-inline-3679152285: resolved by branching on whether the original protoportsarray is present.
Docs: Fern docs are not needed because this hardens malformed input without changing supported policy syntax or user workflows.
E2E: test:e2e is applied. The mirror was absent, so an authorized maintainer command /ok to test 805f189c9a35f241bcbf3395bbd0cea1bfaa5d7a was posted.
Next state: gator:watch-pipeline
|
Label |
|
/ok to test 805f189 |
Merge Decision NudgeThis PR has been in @NVIDIA/openshell-maintainers @NVIDIA/openshell-codeowners @mrunalp @maxamillion @derekwaynecarr, can someone merge this PR or close/request changes if it should not proceed? |
|
Closing this sweep-generated PR: PR has 7 commits; sweep requires exactly one commit per PR. It does not meet the sweep requirements (single signed-off commit). |
Monitoring CompleteHead SHA: Monitoring is complete because this PR has been closed without merge. Final status: The durable finding ledger records all review findings addressed or non-blocking, no remediation scope growth, and no newly introduced Critical defect. Required Branch Checks, Helm Lint, and E2E status contexts were green, and maintainer approval was present. The author closed the PR because the sweep requires exactly one signed-off commit and this PR contains seven commits. I removed the active |
…orts validate_l7_policies assumed every endpoint entry was a JSON object and used ep.as_object_mut().unwrap() in expand_access_presets. A non-object endpoint would panic. Add an object-shape validation error and replace the unwraps with safe pattern matching. Also filter zero values out of the ports array to match the scalar port validation (which already rejects port == 0). Signed-off-by: Andrew White <andrewh@cdw.com> Signed-off-by: andrewwhitecdw <andrewwhitecdw@users.noreply.github.com>
e71e6af to
a3d00b9
Compare
|
This pull request has had no activity for 14 days and is now marked stale. It may be closed in 7 days if there is no further activity. |
|
Thanks for the walkthrough and the convergence checkpoints — much appreciated. Confirming I'm still actively engaging on this one (and on the other awaiting-feedback PRs): all five got updates before Jul 30, and #2449 has its status summarized here. Current state of this PR: the reviewer obligations from the checkpoints (zero-port normalization across the proto-to-OPA path, fail-closed malformed array elements, |
|
This pull request has had no activity for 14 days and is now marked stale. It may be closed in 7 days if there is no further activity. |
|
Bumping this to keep it from going stale — still actively engaged and the branch remains ready for review. All prior review feedback is addressed in the current head; nothing is waiting on my side. Happy to make further changes if anything new comes up. |
|
This pull request has had no activity for 14 days and is now marked stale. It may be closed in 7 days if there is no further activity. |
Follow-Up NeededThis PR is partially applicable to current main, rather than wholly obsolete or ready to advance unchanged. I fetched GitHub's latest main tip, Thanks @andrewwhitecdw. Your September updates say the prior normalization, precedence, and regression-test feedback is addressed. I checked the current head and durable review history: all six recorded Gator threads are resolved by verified maintainer @johntmyers. Those resolutions remain intact; this is an applicability check against newer main, not a reopening of those findings. What has already been covered on main:
Still-relevant scope:
The L7/OPA paths remain in use; shared semantics were extracted by #2389, rather than the entire affected architecture disappearing. Action required: @NVIDIA/openshell-maintainers, decide whether to retain a narrowed raw-loader/proposal fix and specify rejection versus sanitization, or retire this implementation in favor of a separate current-main fix. @andrewwhitecdw, if retained, update the PR against current main around that scope, revise the summary, and add supported-loader/proposal regressions while preserving the existing resolutions. A maintainer owns any close decision; Gator will not close this PR. This check used fetched code and existing tests; local tests were not executed because no Rust toolchain is available in this sandbox. Current-head Branch Checks, Helm Lint, and E2E statuses are pending. No new test dispatch or independent code-review round was started while applicability remains undecided. Gator metadata
|
|
Closing because newer validation supersedes much of this implementation. The remaining raw-policy and agent-proposal behavior should use consistent rejection of invalid ports rather than silently filtering them with different fallback rules. This closure does not assert that every input path already handles zero ports consistently. |
Monitoring CompleteMonitoring is complete because PR #2464 was closed without merge by verified maintainer @johntmyers. Thanks @johntmyers. Your closure explains that newer validation supersedes much of this implementation, while remaining raw-policy and agent-proposal behavior should consistently reject invalid ports rather than silently filter them with different fallback rules. I checked the latest PR state and your closure comment. The current-main applicability assessment and existing resolved review findings remain intact; closure does not establish that every input path already handles zero ports consistently. The latest GitHub main tip fetched this cycle is I am removing the active Gator metadata
|
Summary
Two small robustness fixes in L7 network policy handling:
validate_l7_policiesassumed every entry innetwork_policies.<name>.endpointswas a JSON object, andexpand_access_presetscalledep.as_object_mut().unwrap(). A malformed non-object endpoint caused a panic. This change adds an object-shape validation error and replaces the unwraps with safe pattern matching.portfield was already validated to be> 0, but theportsarray accepted0values silently. The same inconsistency existed in the agent-proposal endpoint parser. Both paths now filter out zero ports.Related Issue
N/A — small fixes found during code review.
Changes
l7/mod.rs: validate endpoint is an object; replaceas_object_mut().unwrap()with safe matching; filterportsarray to> 0policy_local.rs: filter zero entries fromendpoint.portsTesting
mise run pre-commitpasses (mise unavailable in this environment; ran equivalentcargo fmt+cargo clippy -p openshell-supervisor-network --all-targets— clean)cargo test -p openshell-supervisor-network --lib— 969 passed)Checklist