Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

get k8s artifacts error: could not parse reference: docker-pullable #5791

Closed
2 tasks done
chen-keinan opened this issue Dec 17, 2023 Discussed in #5685 · 2 comments
Closed
2 tasks done

get k8s artifacts error: could not parse reference: docker-pullable #5791

chen-keinan opened this issue Dec 17, 2023 Discussed in #5685 · 2 comments
Assignees
Labels
kind/bug Categorizes issue or PR as related to a bug. target/kubernetes Issues relating to kubernetes cluster scanning

Comments

@chen-keinan
Copy link
Contributor

Discussed in #5685

Originally posted by AkikoOrenji November 30, 2023

Description

Trying to run a k8 audit just to see misconfigurations of the local cluster e.g. permissions, groups etc

Desired Behavior

run trivy and get a report about kube

Actual Behavior

FATAL get k8s artifacts error: could not parse reference: docker-pullable://OUR-PRIVATE-DOCKER-REPO.ap-southeast-2.compute.internal:12376/cilium/cilium@sha256:somesha256sum

Reproduction Steps

./trivy k8s --report=all --scanners config all

Target

Kubernetes

Scanner

Misconfiguration

Output Format

None

Mode

Standalone

Debug Output

2023-11-30T01:03:17.573Z        FATAL   get k8s artifacts error:
    github.com/aquasecurity/trivy/pkg/k8s/commands.namespaceRun
        /home/runner/work/trivy/trivy/pkg/k8s/commands/namespace.go:28

Operating System

Redhat EL

Version

Version: 0.47.0
Policy Bundle:
  Digest: sha256:1df8ade71efc830877ca3b1130f83e0c6368e3a45b0d4c0f0418955501644054
  DownloadedAt: 2023-11-30 00:31:12.648819818 +0000 UTC

Checklist

@chen-keinan chen-keinan added kind/bug Categorizes issue or PR as related to a bug. target/kubernetes Issues relating to kubernetes cluster scanning labels Dec 17, 2023
@chen-keinan chen-keinan self-assigned this Dec 17, 2023
@afdesk
Copy link
Contributor

afdesk commented Feb 3, 2025

$ kind version
kind v0.25.0 go1.23.3 darwin/arm64
$ kind create cluster
...
$ trivy k8s --report=all --scanners misconfig
the full log
2025-02-03T18:16:52+06:00       INFO    Node scanning is enabled
2025-02-03T18:16:52+06:00       INFO    If you want to disable Node scanning via an in-cluster Job, please try '--disable-node-collector' to disable the Node-Collector job.
2025-02-03T18:16:52+06:00       INFO    Scanning K8s... K8s="kind-kind"

namespace: local-path-storage, deployment: local-path-provisioner (kubernetes)

Tests: 158 (SUCCESSES: 144, FAILURES: 14)
Failures: 14 (UNKNOWN: 0, LOW: 9, MEDIUM: 3, HIGH: 2, CRITICAL: 0)

AVD-KSV-0001 (MEDIUM): Container 'local-path-provisioner' of Deployment 'local-path-provisioner' should set 'securityContext.allowPrivilegeEscalation' to false
════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════
A program inside the container can elevate its own privileges and run as root, which might give the program control over the container and node.

See https://avd.aquasec.com/misconfig/ksv001
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
 namespace: local-path-storage, deployment: local-path-provisioner:18-36
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
  18 ┌                 - command:
  19 │                     - local-path-provisioner
  20 │                     - --debug
  21 │                     - start
  22 │                     - --helper-image
  23 │                     - docker.io/kindest/local-path-helper:v20230510-486859a6
  24 │                     - --config
  25 │                     - /etc/config/config.json
  26 └                   env:
  ..
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────


AVD-KSV-0003 (LOW): Container 'local-path-provisioner' of Deployment 'local-path-provisioner' should add 'ALL' to 'securityContext.capabilities.drop'
════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════
The container should drop all default capabilities and add only those that are needed for its execution.

See https://avd.aquasec.com/misconfig/ksv003
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
 namespace: local-path-storage, deployment: local-path-provisioner:18-36
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
  18 ┌                 - command:
  19 │                     - local-path-provisioner
  20 │                     - --debug
  21 │                     - start
  22 │                     - --helper-image
  23 │                     - docker.io/kindest/local-path-helper:v20230510-486859a6
  24 │                     - --config
  25 │                     - /etc/config/config.json
  26 └                   env:
  ..
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────


AVD-KSV-0011 (LOW): Container 'local-path-provisioner' of Deployment 'local-path-provisioner' should set 'resources.limits.cpu'
════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════
Enforcing CPU limits prevents DoS via resource exhaustion.

See https://avd.aquasec.com/misconfig/ksv011
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
 namespace: local-path-storage, deployment: local-path-provisioner:18-36
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
  18 ┌                 - command:
  19 │                     - local-path-provisioner
  20 │                     - --debug
  21 │                     - start
  22 │                     - --helper-image
  23 │                     - docker.io/kindest/local-path-helper:v20230510-486859a6
  24 │                     - --config
  25 │                     - /etc/config/config.json
  26 └                   env:
  ..
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────


AVD-KSV-0012 (MEDIUM): Container 'local-path-provisioner' of Deployment 'local-path-provisioner' should set 'securityContext.runAsNonRoot' to true
════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════
Force the running image to run as a non-root user to ensure least privileges.

See https://avd.aquasec.com/misconfig/ksv012
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
 namespace: local-path-storage, deployment: local-path-provisioner:18-36
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
  18 ┌                 - command:
  19 │                     - local-path-provisioner
  20 │                     - --debug
  21 │                     - start
  22 │                     - --helper-image
  23 │                     - docker.io/kindest/local-path-helper:v20230510-486859a6
  24 │                     - --config
  25 │                     - /etc/config/config.json
  26 └                   env:
  ..
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────


AVD-KSV-0014 (HIGH): Container 'local-path-provisioner' of Deployment 'local-path-provisioner' should set 'securityContext.readOnlyRootFilesystem' to true
════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════
An immutable root file system prevents applications from writing to their local disk. This can limit intrusions, as attackers will not be able to tamper with the file system or write foreign executables to disk.

See https://avd.aquasec.com/misconfig/ksv014
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
 namespace: local-path-storage, deployment: local-path-provisioner:18-36
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
  18 ┌                 - command:
  19 │                     - local-path-provisioner
  20 │                     - --debug
  21 │                     - start
  22 │                     - --helper-image
  23 │                     - docker.io/kindest/local-path-helper:v20230510-486859a6
  24 │                     - --config
  25 │                     - /etc/config/config.json
  26 └                   env:
  ..
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────


AVD-KSV-0015 (LOW): Container 'local-path-provisioner' of Deployment 'local-path-provisioner' should set 'resources.requests.cpu'
════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════
When containers have resource requests specified, the scheduler can make better decisions about which nodes to place pods on, and how to deal with resource contention.

See https://avd.aquasec.com/misconfig/ksv015
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
 namespace: local-path-storage, deployment: local-path-provisioner:18-36
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
  18 ┌                 - command:
  19 │                     - local-path-provisioner
  20 │                     - --debug
  21 │                     - start
  22 │                     - --helper-image
  23 │                     - docker.io/kindest/local-path-helper:v20230510-486859a6
  24 │                     - --config
  25 │                     - /etc/config/config.json
  26 └                   env:
  ..
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
─────────────────────────────────────────────────────

@afdesk
Copy link
Contributor

afdesk commented Feb 3, 2025

it works correctly with the latest Trivy.
it seems the issue is out dated, or need more details

@afdesk afdesk closed this as completed Feb 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug. target/kubernetes Issues relating to kubernetes cluster scanning
Projects
None yet
Development

No branches or pull requests

2 participants