Commit d18afd7
feat(linters): add native Rust kubelint and helmlint tools
Add comprehensive Kubernetes and Helm chart linting capabilities with
~20,000 lines of new Rust code, translated from StackRox's Go implementations.
## New Analyzers
### KubeLint (src/analyzer/kubelint/)
Native Rust translation of stackrox/kube-linter with:
- 63 built-in security and best practice checks
- Kubernetes manifest validation (Deployments, Services, RBAC, etc.)
- Helm chart rendering support (shells to `helm template`)
- Kustomize directory support
- Annotation-based rule ignoring (@ignore-check.kube-linter.io)
- Multiple output formats (JSON, SARIF, plain text)
- Graceful fallback to raw YAML parsing when Helm render fails
Security checks include:
- Privileged containers, privilege escalation
- Run as non-root, read-only root filesystem
- Linux capabilities (NET_RAW, etc.)
- Host namespace access (network, PID, IPC)
- RBAC wildcards, secrets access, cluster-admin bindings
- Resource limits and requests
- Health probes (liveness, readiness)
- Service account configuration
### Helmlint (src/analyzer/helmlint/)
Native Rust implementation inspired by stackrox/helmtest with:
- Chart.yaml validation (apiVersion, metadata, dependencies)
- values.yaml validation (types, unused values detection)
- Go template syntax analysis (unclosed blocks, undefined variables)
- Security checks for rendered templates
- Best practice validation (resource limits, probes, deprecated APIs)
- Inline pragma support for ignoring rules
Rule categories (HL1xxx-HL5xxx):
- HL1xxx: Chart structure validation
- HL2xxx: Values file validation
- HL3xxx: Template syntax checking
- HL4xxx: Security checks
- HL5xxx: Kubernetes best practices
## Agent Tool Integration
- KubelintTool: Agent tool with AI-optimized JSON output
- Priority-based issue categorization (critical/high/medium/low)
- Category tagging (security/rbac/best-practice/validation)
- Quick fixes and remediation guidance
- Decision context for AI reasoning
- HelmlintTool: Agent tool for Helm chart validation
- Structured output with action plans
- File-level issue grouping
- Template error highlighting
## Terminal UI (Claude Code style)
- Rich inline preview in tool call display
- Priority indicators with emoji (🔴🟠🟡🟢)
- Category badges ([SEC], [RBAC], [BP], [VAL], [TPL])
- Kubernetes (☸) and Helm (⎈) icons
- Collapsible output with "+N more" indicators
- Quick fix hints for high-priority issues
## Bug Fixes
- Fixed double-encoding bug in hooks.rs where Rig framework's
JSON serialization caused kubelint/helmlint to always show
"OK - no issues found" even when issues existed
- Added graceful fallback for broken Helm charts that can't be
rendered - now parses raw template YAML files instead of failing
## Attribution
Both tools are derivative works under Apache-2.0 license:
- kubelint: https://github.com/stackrox/kube-linter
- helmlint: https://github.com/stackrox/helmtest
Original copyright: StackRox, Inc. (now part of Red Hat)
See THIRD_PARTY_NOTICES.md for full attribution details.
## Test Files
Added test fixtures in tests/test-lint/:
- helm-chart/: Intentionally broken Helm chart for testing
- k8s/: Insecure Kubernetes manifests with 46 total issues
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>1 parent 90af159 commit d18afd7
88 files changed
Lines changed: 20078 additions & 19 deletions
File tree
- src
- agent
- prompts
- tools
- ui
- analyzer
- helmlint
- formatter
- k8s
- parser
- rules
- kubelint
- checks
- context
- extract
- formatter
- objectkinds
- parser
- rules
- templates
- tests
- test-dockerfile
- test-lint
- helm-chart
- templates
- k8s
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
83 | 83 | | |
84 | 84 | | |
85 | 85 | | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
86 | 168 | | |
87 | 169 | | |
88 | 170 | | |
| |||
101 | 183 | | |
102 | 184 | | |
103 | 185 | | |
104 | | - | |
105 | | - | |
106 | | - | |
107 | | - | |
108 | | - | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
109 | 197 | | |
110 | 198 | | |
111 | 199 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
362 | 362 | | |
363 | 363 | | |
364 | 364 | | |
| 365 | + | |
| 366 | + | |
365 | 367 | | |
366 | 368 | | |
367 | 369 | | |
| |||
438 | 440 | | |
439 | 441 | | |
440 | 442 | | |
| 443 | + | |
| 444 | + | |
441 | 445 | | |
442 | 446 | | |
443 | 447 | | |
| |||
518 | 522 | | |
519 | 523 | | |
520 | 524 | | |
| 525 | + | |
| 526 | + | |
521 | 527 | | |
522 | 528 | | |
523 | 529 | | |
| |||
1410 | 1416 | | |
1411 | 1417 | | |
1412 | 1418 | | |
| 1419 | + | |
| 1420 | + | |
1413 | 1421 | | |
1414 | 1422 | | |
1415 | 1423 | | |
| |||
1453 | 1461 | | |
1454 | 1462 | | |
1455 | 1463 | | |
| 1464 | + | |
| 1465 | + | |
1456 | 1466 | | |
1457 | 1467 | | |
1458 | 1468 | | |
| |||
1499 | 1509 | | |
1500 | 1510 | | |
1501 | 1511 | | |
| 1512 | + | |
| 1513 | + | |
1502 | 1514 | | |
1503 | 1515 | | |
1504 | 1516 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
146 | 146 | | |
147 | 147 | | |
148 | 148 | | |
149 | | - | |
150 | | - | |
151 | | - | |
152 | 149 | | |
153 | 150 | | |
154 | 151 | | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
155 | 166 | | |
156 | 167 | | |
157 | 168 | | |
| |||
220 | 231 | | |
221 | 232 | | |
222 | 233 | | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
223 | 240 | | |
224 | 241 | | |
225 | 242 | | |
| |||
296 | 313 | | |
297 | 314 | | |
298 | 315 | | |
299 | | - | |
300 | 316 | | |
301 | 317 | | |
302 | 318 | | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
303 | 333 | | |
304 | 334 | | |
305 | 335 | | |
306 | 336 | | |
307 | | - | |
308 | | - | |
| 337 | + | |
| 338 | + | |
309 | 339 | | |
310 | 340 | | |
311 | 341 | | |
| |||
358 | 388 | | |
359 | 389 | | |
360 | 390 | | |
361 | | - | |
362 | | - | |
363 | | - | |
364 | | - | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
365 | 398 | | |
366 | 399 | | |
367 | | - | |
| 400 | + | |
368 | 401 | | |
369 | | - | |
370 | | - | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
371 | 409 | | |
372 | 410 | | |
373 | 411 | | |
| |||
554 | 592 | | |
555 | 593 | | |
556 | 594 | | |
557 | | - | |
| 595 | + | |
| 596 | + | |
| 597 | + | |
| 598 | + | |
| 599 | + | |
| 600 | + | |
| 601 | + | |
| 602 | + | |
558 | 603 | | |
559 | 604 | | |
560 | 605 | | |
| |||
0 commit comments