Skip to content

bug: host namespace flags are ignored inside security contexts #39

@1PoPTRoN

Description

@1PoPTRoN

What happened?

optiqor analyze can miss host namespace findings when hostNetwork, hostPID, or hostIPC are nested under a security-context-style values map.

Expected: nested host namespace fields should populate parser.Workload.Security so the existing host-network, host-pid, and host-ipc detectors can fire.

Actual: the parser only reads these fields from the workload-level mapping, so nested values are silently ignored.

Reproduction steps

1. Create a values file containing the YAML fragment below.
2. Run `optiqor analyze ./values.yaml --detector host-pid --detector host-ipc --detector host-network`.
3. Notice no host namespace findings are emitted, even though the workload sets host namespace flags under `podSecurityContext`.

optiqor-cli version

2e997fc

Install method

Built from source

OS and arch

macOS 15.7.7 / arm64

Relevant output

No `host-network`, `host-pid`, or `host-ipc` findings are emitted for the nested values shape.

Minimal chart fragment (if applicable)

agent:
  resources:
    requests:
      cpu: 50m
  podSecurityContext:
    hostNetwork: true
    hostPID: true
    hostIPC: true

Additional context

This appears to be in pkg/parser/helm.go.

readSecurity reads hostNetwork, hostPID, and hostIPC from the workload-level map. Nested securityContext, podSecurityContext, and containerSecurityContext maps are handled by applySecFields, but that helper does not currently copy the host namespace fields.

The detectors themselves already behave correctly when parser.Workload.Security.HostNetwork, HostPID, or HostIPC are populated, so this looks like a parser false negative.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingtriageNeeds maintainer review and labeling

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions