Repository navigation
Fix fleetctl apply custom profile path and label validation - #55097
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review. Walkthrough
Priority: ➖ Normal Severity of issue fixed: Medium Merge Risk: ⚪ Minimal · up to No actionable merge blocker is established by the supplied change evidence. Normal checks remain appropriate. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Docstring CoverageExplanation Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 3 functions across 3 files. (1 skipped: 1 unsupported.)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #55097 +/- ##
==========================================
- Coverage 76.97% 76.94% -0.04%
==========================================
Files 4292 4292
Lines 264268 264307 +39
Branches 15431 15431
==========================================
- Hits 203432 203372 -60
- Misses 60655 60754 +99
Partials 181 181
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Warning
- Copilot's review of this pull request may be incomplete because some of the changed files are excluded by your Copilot content exclusion settings. See Excluding content from Copilot for details.
🟢 Approval recommended
The validation is atomic, preserves documented compatibility behavior, and has focused unit and end-to-end CLI coverage.
0 open findings
What changed in this PR
Validates custom Apple profile paths and labels during fleet spec application, preventing silently dropped invalid values.
Changes:
- Rejects incorrectly typed paths, label arrays, and label elements.
- Preserves supported null, empty, and legacy profile forms.
- Adds unit and CLI regression coverage.
| File | Description |
|---|---|
server/fleet/app.go |
Adds strict profile field validation. |
server/fleet/app_test.go |
Tests valid and invalid field types. |
cmd/fleetctl/fleetctl/apply_test.go |
Tests surfaced CLI validation errors. |
changes/54690-validate-custom-settings-types |
Adds the changes entry; content excluded from review. |
Files excluded by content exclusion policy (1)
- changes/54690-validate-custom-settings-types
🧠 Review effort: Balanced
Give feedback about Copilot approvals in this survey to enter a drawing for a $150 gift card.
|
QAed it locally, fixes the problem described in the issue. I would have taken the same approach as in this PR. |
Related issue: Resolves #54690
Follow-up to #54375, which added validation for profile names and descriptions.
Reject incorrectly typed custom profile paths and label values when applying fleet specs. Previously, Fleet silently dropped these values and could report success with incomplete settings. Preserve omitted/null fields, empty label lists, and legacy string profile entries. Missing or empty paths remain unchanged; this fixes incorrect types only.
Checklist for submitter
Changes file added for user-visible changes in
changes/,orbit/changes/oree/fleetd-chrome/changes.See Changes files for more information.
Input data is properly validated,
SELECT *is avoided, SQL injection is prevented (using placeholders for values in statements), JS inline code is prevented especially for url redirects, and untrusted data interpolated into shell scripts/commands is validated against shell metacharacters.Testing
Added/updated automated tests
QA'd all new/changed functionality manually
Automated validation:
go test ./server/fleet -count=1REDIS_TEST=1 go test ./cmd/fleetctl/fleetctl -run '^TestApplySpecs$' -count=1 -v— all 81 cases passed, including three new CLI regressions.GOMAXPROCS=2 make lint-go LINT_CONCURRENCY=2— main and custom incremental lint passed with 0 issues.interface{}toanysubstitutions.Manual QA on local server at commit 2ed283d (Apple MDM disabled):
Valid-profile installation with Apple MDM enabled has not been manually tested. The path rejection was tested before the baseline export was captured.
AI
AI: Codex (unknown)
Frontend
Not applicable; backend validation and CLI errors only.
Summary by CodeRabbit
fleetctl applynow reports validation errors for custom profile settings with incorrectly typedpathor label values, rather than silently dropping them. Label fields must contain arrays of strings; omitted ornulllabel fields remain accepted.