Commit 2ddf676
authored
<!-- markdownlint-disable MD041 -->
## Summary
Custom preset application now fails closed when the full preset document
cannot be parsed into a `network_policies` mapping. This prevents
malformed metadata above a valid policy tail from bypassing the
custom-preset guards.
## Related Issue
Fixes #9406
## Changes
- Reject invalid or missing custom `network_policies` before
reserved-key, `allowed_ips`, semantic, disclosure, or mutation work.
- Add a regression for a duplicate-key preset whose extracted policy
tail remains valid.
## Type of Change
- [x] Code change (feature, bug fix, or refactor)
- [ ] Code change with doc updates
- [ ] Doc only (prose changes, no code sample modifications)
- [ ] Doc only (includes code sample changes)
## Quality Gates
- [x] Tests added or updated for changed behavior
- [ ] Existing tests cover changed behavior — justification:
- [ ] Tests not applicable — justification:
- [x] Sensitive paths changed (security, policy, credentials, preflight,
onboarding, inference, runner, sandbox, or messaging)
- [ ] Sensitive-path review completed or maintainer-approved waiver
recorded — reviewer/approval link/justification: Review pending.
- [ ] Non-success, skipped, or missing CI check accepted by maintainer —
check name, approval link, and follow-up issue:
## DGX Station Hardware Evidence
- [ ] Tested on DGX Station
- Tested commit: Not applicable.
- Station profile/scenario: Not applicable.
- Result: Not applicable.
- Supporting evidence: Not applicable.
## Verification
- [x] PR description includes a `Signed-off-by:` line and every commit
appears as `Verified` in GitHub
- [ ] Normal `pre-commit`, `commit-msg`, and `pre-push` hooks passed, or
`npm run validate:pr` passed after refreshing `origin/main` when hooks
were skipped or unavailable
- [x] Targeted behavior tests pass for the current change set, or tests
are marked not applicable above — `npx vitest run --project cli
src/lib/policy/preset-allowed-ips.test.ts` passed 14 tests.
- [x] Applicable broad gate passed — `npm run test:changed` passed 139
files and 1,944 tests after the 25-test growth-guardrail lane passed.
- [x] Quality Gates section completed with required justifications or
waivers
- [x] No secrets, API keys, or credentials committed
- [ ] `npm run docs` builds without warnings (doc changes only)
- [ ] Doc pages follow the [style
guide](https://github.com/NVIDIA/NemoClaw/blob/main/docs/CONTRIBUTING.md)
(doc changes only)
- [ ] New doc pages include SPDX header and frontmatter (new pages only)
Additional validation:
- `npm run build:cli` passed.
- `npm run typecheck:cli` passed.
- `git diff --check` passed.
---
Signed-off-by: Deepak Jain <deepujain@gmail.com>
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
- **Bug Fixes**
- Custom policy presets are now rejected when policy data is missing,
malformed, or invalid.
- Presets with duplicate metadata or invalid policy definitions no
longer continue through the application process.
- Clear error reporting helps identify rejected preset configurations
and prevents unintended policy changes.
- Valid custom presets continue to be applied and recorded as provided.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
---------
Signed-off-by: Deepak Jain <deepujain@gmail.com>
1 parent c0b1862 commit 2ddf676
3 files changed
Lines changed: 37 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2073 | 2073 | | |
2074 | 2074 | | |
2075 | 2075 | | |
| 2076 | + | |
| 2077 | + | |
| 2078 | + | |
| 2079 | + | |
2076 | 2080 | | |
2077 | | - | |
| 2081 | + | |
2078 | 2082 | | |
2079 | 2083 | | |
2080 | 2084 | | |
2081 | 2085 | | |
2082 | 2086 | | |
2083 | | - | |
| 2087 | + | |
2084 | 2088 | | |
2085 | 2089 | | |
2086 | 2090 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
| 9 | + | |
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| |||
209 | 209 | | |
210 | 210 | | |
211 | 211 | | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
212 | 234 | | |
213 | 235 | | |
214 | 236 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
741 | 741 | | |
742 | 742 | | |
743 | 743 | | |
744 | | - | |
| 744 | + | |
| 745 | + | |
| 746 | + | |
| 747 | + | |
| 748 | + | |
| 749 | + | |
| 750 | + | |
745 | 751 | | |
746 | 752 | | |
747 | 753 | | |
| |||
841 | 847 | | |
842 | 848 | | |
843 | 849 | | |
844 | | - | |
| 850 | + | |
845 | 851 | | |
846 | 852 | | |
847 | 853 | | |
| |||
0 commit comments