Repository navigation
Conversation
|
@jadenfix is attempting to deploy a commit to the Vercel Labs Team on Vercel. A member of the Team first needs to authorize it. |
8b9856f to
355fd8a
Compare
|
Ready for review at |
|
I independently exercised the privileged-container portion of this matcher with IaC-Guard-V securityContext: {privileged: true}The equivalent block form is detected by the matcher, but this inline-map form produces no DeepSec finding. IaC-Guard-V’s protected I also found two additional boundary cases that may be useful depending on the intended matcher scope: a top-level Minimal fixtures, exact SHAs, reproduction steps, and sanitized results are here: |
783195c to
3f3f541
Compare
|
@lokesh0186 thanks for testing this and for the clear repros! You were right, the patterns only matched block-style YAML so |
🤖 auto-maintain reviewAutomated, advisory triage for
Review panel: 🟡 medium highest severity deepsec maintainer code review: 🟡 medium
General code review: 🟡 medium
Scanner and matcher quality: 🟡 medium
Sandbox and credential boundaries: 🟡 medium
Durability and distributed state: 🟢 low
Posted by auto-maintain. This automated code review is advisory; a human maintainer makes the call. |
Flags workload manifests that run privileged, share host namespaces, run as Windows host processes, mount hostPath volumes, run as UID 0, unmask /proc, or add dangerous capabilities. Handles block and flow YAML, multi-document files, documents written entirely in flow style, PodTemplate, and workloads inside List or typed lists such as PodList. Quoted string values, comments, block scalars, and metadata labels and annotations are not matched. Helm dependency charts under charts/<name>/charts/ are skipped. Snippets show the original manifest lines around the first hit.
3f3f541 to
674d4ad
Compare
Kubernetes decodes manifests with sigs.k8s.io/yaml, which follows YAML 1.1, so `hostPID: yes` and `allowPrivilegeEscalation: on` are true and were being missed. Count y, yes and on in all their spellings. A quoted "true" or "0" is a string, which Kubernetes rejects for these boolean and integer fields, so stop unquoting those. A nodeSelector or matchLabels entry like `privileged: "true"` was reported as a privileged container.
|
Addressed the advisory findings in a62af88. The matcher now reads bounded YAML 1.1 syntax nodes, covers JSON/flow Lists and multiline capabilities, scopes hostPath to volumes, and caps stored locations and snippets. All 1,972 scanner tests, workspace build, lint, knip and 29 bundle tests pass. A scan of 31 Kubernetes example manifests produced one confirmed privileged-Pod candidate. The description records input limits and the three environment-blocked shutdown tests. Could a maintainer approve the fork CI and review this revision when convenient? Thanks! |
Kubernetes resolves `<<` merge keys, so a securityContext that inherits `privileged: true` from an anchor now matches. Explicit keys still win, and earlier merge sources win over later ones. Go template actions are masked in place before parsing, so first-party Helm templates parse as YAML instead of being skipped. Lines and offsets don't move, and snippets still show the original template text. The 1 MiB limit now applies per document. A multi-document bundle up to 16 MiB is split at `---` markers and only an oversized document is skipped. Files without "kind" skip parsing entirely.
|
Pushed e186dea for the latest advisory review on a62af88. Merge keys ( |
|
A new push changed this PR and the review now contains a higher-severity finding. See the updated review comment above. |
Resolve merge keys iteratively with shared work limits and cached map indexes. Mask Go strings and multiline comments without moving source locations, parse escaped field names, and flag four host-impacting capabilities. Add regressions for deep chains, cycles, merge precedence, template limits, escaped keys, and capability drop controls. Prepared with OpenAI Codex assistance.
Leave unmatched Go action openings intact and bound delimiter lookahead. Validate kind/API group pairs, inherit typed-list API versions, scan first-party manifests under .github, and flag PERFMON, CHECKPOINT_RESTORE, and SYS_RESOURCE when explicitly added. Prepared with OpenAI Codex assistance.
|
The advisory comment above targets bf1a009. These findings are addressed in the current 1a69fd4: unmatched template openings are preserved, template scans have per-opening and total budgets, PERFMON/CHECKPOINT_RESTORE/SYS_RESOURCE are included, workload kinds are checked against their API groups, and first-party Kubernetes manifests under .github are scanned. The PR description lists the regression coverage and validation results for this revision. |
|
The standard CI runs for #112 at |
What changed
Adds a
k8s-privileged-workloadmatcher for privileged containers, privilege escalation, host namespaces, Windows host processes, hostPath volumes, root UID, unmasked /proc, and dangerous Linux capabilities, includingSYS_BOOT,SYS_TIME,AUDIT_CONTROL,IPC_OWNER,PERFMON,CHECKPOINT_RESTORE, andSYS_RESOURCE.The matcher reads YAML 1.1 syntax nodes, including escaped JSON/YAML keys, rather than matching field names in arbitrary text. It checks pod specs in Pods, PodTemplates, workload templates, CronJobs, and generic/typed Lists. Container checks cover regular, init, and ephemeral containers. YAML and JSON file globs are included. Flow maps, multiline capabilities, commented document separators, and YAML integer spellings are covered;
hostPathis checked only in volume definitions.Why
deepsec checks Kubernetes secret handling but lacked a workload-privilege matcher. The syntax-node approach also addresses the advisory review's coverage gaps and unrelated-key false positives.
Verification
e186deaand pass with this revision, including a valid 12,000-link merge chain that previously throwsRangeError. Added controls cover explicit and merge precedence, cycles, wide merge graphs, template-action limits, comments, source lines, and dropped capabilities.bf1a009and pass with this revision: unmatched template openings, missing capabilities, custom API-group namesakes, and Kubernetes files under.github. Controls retain valid multiline actions, comments, literal braces inside Go strings, supported workload API groups, typed-list API inheritance, and workflow filtering._archived/podsecuritypolicy/rbac/pod_priv.yaml.tsx -ereproduction fails to open its IPC socket withlisten EPERM, so two children exit before READY and the third test times out. Pipeline e2e and all 29 bundle tests pass. No full-suite pass is claimed.Notes for reviewer
---markers. The matcher skips any document over 1,048,576 UTF-16 code units, files over 16 times that, and documents the YAML parser reports as invalid. YAML merge keys (<<) are followed iteratively. Multiline Go actions, comments, and quoted closing delimiters are masked in place before parsing; template expressions aren't evaluated. Unmatched openings are left intact. Delimiter lookahead is limited to 65,536 UTF-16 code units per opening and twice the file length in total iterations. Files exceeding the total lookahead budget or 100,000 openings are skipped.apps,extensions, andbatch, plusapps.openshift.ioDeploymentConfigs andargoproj.ioRollouts. Typed Lists inherit their API version when an item omits it. Unrelated custom API groups reusing workload kind names are ignored..githubare scanned. Workflow YAML is excluded by its parsed shape rather than its directory.charts/<name>/charts/are skipped; first-party chart templates are scanned as-is.yaml@2.9.0scanner dependency. Other dependency versions are unchanged.Code, tests, and this description were prepared with OpenAI Codex assistance.