mirror of
https://github.com/kubescape/kubescape.git
synced 2026-02-14 18:09:55 +00:00
Compare commits
142 Commits
v3.0.42-rc
...
v3.0.48
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6ce0121a03 | ||
|
|
09aa1ab866 | ||
|
|
0ec188b23d | ||
|
|
090820ba04 | ||
|
|
0cf24d058f | ||
|
|
c32e665809 | ||
|
|
82ec11b207 | ||
|
|
32a15acdea | ||
|
|
837a50c903 | ||
|
|
bd00d153e9 | ||
|
|
306050046d | ||
|
|
413db87e85 | ||
|
|
4d3b3efb9a | ||
|
|
7ca609d39f | ||
|
|
872c0c9fab | ||
|
|
9353eb5b54 | ||
|
|
aa62fbea68 | ||
|
|
08d964b631 | ||
|
|
75fb07efde | ||
|
|
9445e0aa01 | ||
|
|
ea12643a3c | ||
|
|
0c42b41dcc | ||
|
|
351f957083 | ||
|
|
9d876b14e9 | ||
|
|
895233630f | ||
|
|
423d9c5c1f | ||
|
|
3f3681a4cd | ||
|
|
d6ccc37640 | ||
|
|
3b6bc00b03 | ||
|
|
8984f941ab | ||
|
|
46eb266064 | ||
|
|
0f2125817b | ||
|
|
1225540590 | ||
|
|
0e4ff13276 | ||
|
|
5fed9cc507 | ||
|
|
06241fce03 | ||
|
|
2b91023c6b | ||
|
|
082edf52d9 | ||
|
|
be250ff090 | ||
|
|
d74803af28 | ||
|
|
893bb86035 | ||
|
|
314a74b817 | ||
|
|
997bc2d23b | ||
|
|
5d1699291a | ||
|
|
bfca19bf25 | ||
|
|
1b94d27fd6 | ||
|
|
acf7ad04ed | ||
|
|
0f5775065e | ||
|
|
66fbca8f24 | ||
|
|
1f8de23a65 | ||
|
|
89478eabcc | ||
|
|
6be9aec5b0 | ||
|
|
32551275ba | ||
|
|
4ee6238244 | ||
|
|
54dda8bf31 | ||
|
|
270b3b320d | ||
|
|
fa17ca26e1 | ||
|
|
66e970a3dc | ||
|
|
d10d08c02b | ||
|
|
8d7c595a76 | ||
|
|
621ffd3ead | ||
|
|
5dee6d0e4f | ||
|
|
f516853af8 | ||
|
|
0d01329683 | ||
|
|
5a0f5f98c1 | ||
|
|
771fc4acca | ||
|
|
68a9d0cf60 | ||
|
|
d2bc957500 | ||
|
|
d20ec9e471 | ||
|
|
d3824028c5 | ||
|
|
5013f91814 | ||
|
|
41e47c3ad3 | ||
|
|
acfe986863 | ||
|
|
abafa9eafa | ||
|
|
dce1ee4dc6 | ||
|
|
62a143326c | ||
|
|
d72a6005bb | ||
|
|
adb9b80442 | ||
|
|
cb7cca7b44 | ||
|
|
f38bec9314 | ||
|
|
fff663bed4 | ||
|
|
6a72851182 | ||
|
|
e4962fe934 | ||
|
|
dac3af19a3 | ||
|
|
0b44e94b67 | ||
|
|
df37457504 | ||
|
|
f88a374b6d | ||
|
|
47442f954c | ||
|
|
efbb8e8367 | ||
|
|
60d7276de3 | ||
|
|
c05427ff38 | ||
|
|
3e245da02b | ||
|
|
cc7aae470f | ||
|
|
8d59a6074e | ||
|
|
1f7dd6e5f5 | ||
|
|
bf5ca3c1f0 | ||
|
|
a8574c61ea | ||
|
|
6f9c0ae85f | ||
|
|
be2c74e48a | ||
|
|
68da73855f | ||
|
|
5b3f2d0ff9 | ||
|
|
02637c7a8e | ||
|
|
7d5b374f9d | ||
|
|
1dd6d7a1b3 | ||
|
|
6b80b85555 | ||
|
|
d88bc067e2 | ||
|
|
ba78527c80 | ||
|
|
4c8692bf8c | ||
|
|
742e3bb67f | ||
|
|
a39f36c9fb | ||
|
|
9bc29032e1 | ||
|
|
a4a290a3ce | ||
|
|
379a3fbc27 | ||
|
|
a46098c034 | ||
|
|
440f39ba3e | ||
|
|
b6a4e282f9 | ||
|
|
8deff34d12 | ||
|
|
acc9b54b2b | ||
|
|
1ffa29fbaa | ||
|
|
2ae30a8162 | ||
|
|
0ca5378c6b | ||
|
|
f51a1281f7 | ||
|
|
5469d8bc04 | ||
|
|
bd7c0c580e | ||
|
|
154fec1385 | ||
|
|
5c2275e32a | ||
|
|
2da4736201 | ||
|
|
aefafeae6f | ||
|
|
1772b38b8c | ||
|
|
c844f42208 | ||
|
|
b86d051998 | ||
|
|
aaa8d1ed35 | ||
|
|
441d16aa08 | ||
|
|
b33f1c8cc7 | ||
|
|
4929af510e | ||
|
|
f28bb11c55 | ||
|
|
8bff4a02e1 | ||
|
|
33d1e018ec | ||
|
|
0c74599314 | ||
|
|
c23b85cc84 | ||
|
|
aab10d14a2 | ||
|
|
2fcbe54e4e |
247
.github/workflows/00-pr-scanner.yaml
vendored
247
.github/workflows/00-pr-scanner.yaml
vendored
@@ -1,74 +1,189 @@
|
||||
name: 00-pr_scanner
|
||||
permissions: read-all
|
||||
on:
|
||||
workflow_dispatch: {}
|
||||
pull_request:
|
||||
types: [opened, reopened, synchronize, ready_for_review]
|
||||
paths-ignore:
|
||||
- '**.yaml'
|
||||
- '**.yml'
|
||||
- '**.md'
|
||||
- '**.sh'
|
||||
- 'website/*'
|
||||
- 'examples/*'
|
||||
- 'docs/*'
|
||||
- 'build/*'
|
||||
- '.github/*'
|
||||
workflow_dispatch: {}
|
||||
pull_request:
|
||||
types: [opened, reopened, synchronize, ready_for_review]
|
||||
paths-ignore:
|
||||
- "**.yaml"
|
||||
- "**.yml"
|
||||
- "**.md"
|
||||
- "**.sh"
|
||||
- "website/*"
|
||||
- "examples/*"
|
||||
- "docs/*"
|
||||
- "build/*"
|
||||
- ".github/*"
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
pr-scanner:
|
||||
permissions:
|
||||
actions: read
|
||||
checks: read
|
||||
deployments: read
|
||||
id-token: write
|
||||
issues: read
|
||||
models: read
|
||||
discussions: read
|
||||
packages: read
|
||||
pages: read
|
||||
pull-requests: write
|
||||
repository-projects: read
|
||||
security-events: read
|
||||
statuses: read
|
||||
attestations: read
|
||||
contents: write
|
||||
uses: ./.github/workflows/a-pr-scanner.yaml
|
||||
with:
|
||||
RELEASE: ""
|
||||
CLIENT: test
|
||||
CGO_ENABLED: 0
|
||||
GO111MODULE: ""
|
||||
secrets: inherit
|
||||
pr-scanner:
|
||||
permissions:
|
||||
actions: read
|
||||
artifact-metadata: read
|
||||
attestations: read
|
||||
checks: read
|
||||
contents: write
|
||||
deployments: read
|
||||
discussions: read
|
||||
id-token: write
|
||||
issues: read
|
||||
models: read
|
||||
packages: read
|
||||
pages: read
|
||||
pull-requests: write
|
||||
repository-projects: read
|
||||
security-events: read
|
||||
statuses: read
|
||||
uses: ./.github/workflows/a-pr-scanner.yaml
|
||||
with:
|
||||
RELEASE: ""
|
||||
CLIENT: test
|
||||
CGO_ENABLED: 0
|
||||
GO111MODULE: ""
|
||||
secrets: inherit
|
||||
|
||||
binary-build:
|
||||
if: ${{ github.actor == 'kubescape' }}
|
||||
permissions:
|
||||
actions: read
|
||||
checks: read
|
||||
contents: write
|
||||
deployments: read
|
||||
discussions: read
|
||||
id-token: write
|
||||
issues: read
|
||||
models: read
|
||||
packages: write
|
||||
pages: read
|
||||
pull-requests: read
|
||||
repository-projects: read
|
||||
security-events: read
|
||||
statuses: read
|
||||
attestations: read
|
||||
uses: ./.github/workflows/b-binary-build-and-e2e-tests.yaml
|
||||
with:
|
||||
COMPONENT_NAME: kubescape
|
||||
CGO_ENABLED: 0
|
||||
GO111MODULE: ""
|
||||
GO_VERSION: "1.24"
|
||||
RELEASE: "latest"
|
||||
CLIENT: test
|
||||
secrets: inherit
|
||||
wf-preparation:
|
||||
name: secret-validator
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
TEST_NAMES: ${{ steps.export_tests_to_env.outputs.TEST_NAMES }}
|
||||
is-secret-set: ${{ steps.check-secret-set.outputs.is-secret-set }}
|
||||
|
||||
steps:
|
||||
- name: check if the necessary secrets are set in github secrets
|
||||
id: check-secret-set
|
||||
env:
|
||||
CUSTOMER: ${{ secrets.CUSTOMER }}
|
||||
USERNAME: ${{ secrets.USERNAME }}
|
||||
PASSWORD: ${{ secrets.PASSWORD }}
|
||||
CLIENT_ID: ${{ secrets.CLIENT_ID_PROD }}
|
||||
SECRET_KEY: ${{ secrets.SECRET_KEY_PROD }}
|
||||
REGISTRY_USERNAME: ${{ secrets.REGISTRY_USERNAME }}
|
||||
REGISTRY_PASSWORD: ${{ secrets.REGISTRY_PASSWORD }}
|
||||
run: "echo \"is-secret-set=${{ env.CUSTOMER != '' && env.USERNAME != '' && env.PASSWORD != '' && env.CLIENT_ID != '' && env.SECRET_KEY != '' && env.REGISTRY_USERNAME != '' && env.REGISTRY_PASSWORD != '' }}\" >> $GITHUB_OUTPUT\n"
|
||||
|
||||
- id: export_tests_to_env
|
||||
name: set test name
|
||||
run: |
|
||||
echo "TEST_NAMES=$input" >> $GITHUB_OUTPUT
|
||||
env:
|
||||
input: '[
|
||||
"scan_nsa",
|
||||
"scan_mitre",
|
||||
"scan_with_exceptions",
|
||||
"scan_repository",
|
||||
"scan_local_file",
|
||||
"scan_local_glob_files",
|
||||
"scan_local_list_of_files",
|
||||
"scan_git_repository_and_submit_to_backend",
|
||||
"scan_and_submit_to_backend",
|
||||
"scan_customer_configuration",
|
||||
"scan_compliance_score",
|
||||
"scan_custom_framework_scanning_file_scope_testing",
|
||||
"scan_custom_framework_scanning_cluster_scope_testing",
|
||||
"scan_custom_framework_scanning_cluster_and_file_scope_testing"
|
||||
]'
|
||||
|
||||
run-system-tests:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
TEST: ${{ fromJson(needs.wf-preparation.outputs.TEST_NAMES) }}
|
||||
needs: [wf-preparation, pr-scanner]
|
||||
if: ${{ (needs.wf-preparation.outputs.is-secret-set == 'true') && (always() && (contains(needs.*.result, 'success') || contains(needs.*.result, 'skipped')) && !(contains(needs.*.result, 'failure')) && !(contains(needs.*.result, 'cancelled'))) }}
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
actions: read
|
||||
contents: read
|
||||
pull-requests: write
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
submodules: recursive
|
||||
|
||||
- uses: actions/setup-go@v4
|
||||
name: Installing go
|
||||
with:
|
||||
go-version: "1.25"
|
||||
|
||||
- uses: anchore/sbom-action/download-syft@v0
|
||||
name: Setup Syft
|
||||
|
||||
- uses: goreleaser/goreleaser-action@v6
|
||||
name: Build
|
||||
with:
|
||||
distribution: goreleaser
|
||||
version: latest
|
||||
args: build --clean --snapshot --single-target
|
||||
env:
|
||||
RELEASE: ""
|
||||
CLIENT: test
|
||||
CGO_ENABLED: 0
|
||||
|
||||
- name: chmod +x
|
||||
run: chmod +x -R ${PWD}/dist/cli_linux_amd64_v1/kubescape
|
||||
|
||||
- name: Checkout systests repo
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
repository: armosec/system-tests
|
||||
path: system-tests
|
||||
|
||||
- uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: "3.9"
|
||||
cache: "pip"
|
||||
|
||||
- name: create env
|
||||
run: ./create_env.sh
|
||||
working-directory: system-tests
|
||||
|
||||
- name: Generate uuid
|
||||
id: uuid
|
||||
run: |
|
||||
echo "RANDOM_UUID=$(uuidgen)" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Create k8s Kind Cluster
|
||||
id: kind-cluster-install
|
||||
uses: helm/kind-action@v1.10.0
|
||||
with:
|
||||
cluster_name: ${{ steps.uuid.outputs.RANDOM_UUID }}
|
||||
|
||||
- name: run-tests-on-local-built-kubescape
|
||||
env:
|
||||
CUSTOMER: ${{ secrets.CUSTOMER }}
|
||||
USERNAME: ${{ secrets.USERNAME }}
|
||||
PASSWORD: ${{ secrets.PASSWORD }}
|
||||
CLIENT_ID: ${{ secrets.CLIENT_ID_PROD }}
|
||||
SECRET_KEY: ${{ secrets.SECRET_KEY_PROD }}
|
||||
REGISTRY_USERNAME: ${{ secrets.REGISTRY_USERNAME }}
|
||||
REGISTRY_PASSWORD: ${{ secrets.REGISTRY_PASSWORD }}
|
||||
working-directory: system-tests
|
||||
run: |
|
||||
echo "Test history:"
|
||||
echo " ${{ matrix.TEST }} " >/tmp/testhistory
|
||||
cat /tmp/testhistory
|
||||
source systests_python_env/bin/activate
|
||||
|
||||
python3 systest-cli.py \
|
||||
-t ${{ matrix.TEST }} \
|
||||
-b production \
|
||||
-c CyberArmorTests \
|
||||
--duration 3 \
|
||||
--logger DEBUG \
|
||||
--kwargs kubescape=${GITHUB_WORKSPACE}/dist/cli_linux_amd64_v1/kubescape
|
||||
|
||||
deactivate
|
||||
|
||||
- name: Test Report
|
||||
uses: mikepenz/action-junit-report@v5
|
||||
if: always()
|
||||
with:
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
report_paths: "system-tests/**/results_xml_format/**.xml"
|
||||
commit: ${{github.event.workflow_run.head_sha}}
|
||||
|
||||
215
.github/workflows/02-release.yaml
vendored
215
.github/workflows/02-release.yaml
vendored
@@ -3,114 +3,117 @@ permissions: read-all
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- 'v*.*.*-rc.*'
|
||||
- "v[0-9]+.[0-9]+.[0-9]+"
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
skip_publish:
|
||||
description: "Skip publishing artifacts"
|
||||
required: false
|
||||
default: true
|
||||
type: boolean
|
||||
jobs:
|
||||
retag:
|
||||
outputs:
|
||||
NEW_TAG: ${{ steps.tag-calculator.outputs.NEW_TAG }}
|
||||
release:
|
||||
permissions:
|
||||
actions: read
|
||||
checks: read
|
||||
contents: write
|
||||
deployments: read
|
||||
discussions: read
|
||||
id-token: write
|
||||
issues: read
|
||||
models: read
|
||||
packages: write
|
||||
pages: read
|
||||
pull-requests: read
|
||||
repository-projects: read
|
||||
statuses: read
|
||||
security-events: read
|
||||
attestations: read
|
||||
artifact-metadata: read
|
||||
runs-on: ubuntu-large
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- id: tag-calculator
|
||||
uses: ./.github/actions/tag-action
|
||||
with:
|
||||
SUB_STRING: "-rc"
|
||||
binary-build:
|
||||
permissions:
|
||||
actions: read
|
||||
checks: read
|
||||
deployments: read
|
||||
discussions: read
|
||||
id-token: write
|
||||
issues: read
|
||||
models: read
|
||||
packages: write
|
||||
pages: read
|
||||
pull-requests: read
|
||||
repository-projects: read
|
||||
security-events: read
|
||||
statuses: read
|
||||
contents: write
|
||||
attestations: write
|
||||
needs: [retag]
|
||||
uses: ./.github/workflows/b-binary-build-and-e2e-tests.yaml
|
||||
with:
|
||||
COMPONENT_NAME: kubescape
|
||||
CGO_ENABLED: 0
|
||||
GO111MODULE: ""
|
||||
GO_VERSION: "1.24"
|
||||
RELEASE: ${{ needs.retag.outputs.NEW_TAG }}
|
||||
CLIENT: release
|
||||
secrets: inherit
|
||||
create-release:
|
||||
permissions:
|
||||
actions: read
|
||||
checks: read
|
||||
contents: write
|
||||
deployments: read
|
||||
discussions: read
|
||||
id-token: write
|
||||
issues: read
|
||||
models: read
|
||||
packages: read
|
||||
pages: read
|
||||
pull-requests: read
|
||||
repository-projects: read
|
||||
statuses: read
|
||||
security-events: read
|
||||
attestations: read
|
||||
needs: [retag, binary-build]
|
||||
uses: ./.github/workflows/c-create-release.yaml
|
||||
with:
|
||||
RELEASE_NAME: "Release ${{ needs.retag.outputs.NEW_TAG }}"
|
||||
TAG: ${{ needs.retag.outputs.NEW_TAG }}
|
||||
DRAFT: false
|
||||
secrets: inherit
|
||||
publish-image:
|
||||
permissions:
|
||||
actions: read
|
||||
checks: read
|
||||
deployments: read
|
||||
discussions: read
|
||||
id-token: write
|
||||
issues: read
|
||||
models: read
|
||||
packages: write
|
||||
pages: read
|
||||
pull-requests: read
|
||||
repository-projects: read
|
||||
security-events: read
|
||||
statuses: read
|
||||
attestations: read
|
||||
contents: write
|
||||
uses: ./.github/workflows/d-publish-image.yaml
|
||||
needs: [create-release, retag]
|
||||
with:
|
||||
client: "image-release"
|
||||
image_name: "quay.io/${{ github.repository_owner }}/kubescape-cli"
|
||||
image_tag: ${{ needs.retag.outputs.NEW_TAG }}
|
||||
support_platforms: true
|
||||
cosign: true
|
||||
secrets: inherit
|
||||
post-release:
|
||||
permissions:
|
||||
actions: read
|
||||
checks: read
|
||||
deployments: read
|
||||
discussions: read
|
||||
id-token: write
|
||||
issues: read
|
||||
models: read
|
||||
packages: write
|
||||
pages: read
|
||||
pull-requests: read
|
||||
repository-projects: read
|
||||
security-events: read
|
||||
statuses: read
|
||||
attestations: read
|
||||
contents: write
|
||||
uses: ./.github/workflows/e-post-release.yaml
|
||||
needs: [retag, publish-image]
|
||||
with:
|
||||
TAG: ${{ needs.retag.outputs.NEW_TAG }}
|
||||
secrets: inherit
|
||||
fetch-depth: 0
|
||||
|
||||
- uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: "1.25"
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: "3.9"
|
||||
|
||||
- name: Install system dependencies for system-tests
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y --no-install-recommends \
|
||||
libpq5 \
|
||||
libpq-dev \
|
||||
gcc \
|
||||
python3-dev
|
||||
sudo rm -rf /var/lib/apt/lists/*
|
||||
|
||||
- name: Install Cosign
|
||||
uses: sigstore/cosign-installer@v3.5.0
|
||||
|
||||
- name: Create Cosign Key
|
||||
run: echo "${{ secrets.COSIGN_PRIVATE_KEY_V1 }}" > cosign.key
|
||||
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v3
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Login to Quay.io
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: quay.io
|
||||
username: ${{ secrets.QUAYIO_REGISTRY_USERNAME }}
|
||||
password: ${{ secrets.QUAYIO_REGISTRY_PASSWORD }}
|
||||
|
||||
- uses: anchore/sbom-action/download-syft@v0
|
||||
name: Setup Syft
|
||||
|
||||
- name: Create k8s Kind Cluster
|
||||
uses: helm/kind-action@v1.10.0
|
||||
with:
|
||||
cluster_name: kubescape-e2e
|
||||
|
||||
- name: Run GoReleaser
|
||||
uses: goreleaser/goreleaser-action@v6
|
||||
with:
|
||||
distribution: goreleaser
|
||||
version: latest
|
||||
args: release --clean ${{ inputs.skip_publish == true && '--skip=publish' || '' }}
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN || secrets.GITHUB_TOKEN }}
|
||||
COSIGN_PWD: ${{ secrets.COSIGN_PRIVATE_KEY_V1_PASSWORD }}
|
||||
RELEASE: ${{ github.ref_name }}
|
||||
CLIENT: release
|
||||
RUN_E2E: "true"
|
||||
KUBESCAPE_SKIP_UPDATE_CHECK: "true"
|
||||
CUSTOMER: ${{ secrets.CUSTOMER }}
|
||||
USERNAME: ${{ secrets.USERNAME }}
|
||||
PASSWORD: ${{ secrets.PASSWORD }}
|
||||
CLIENT_ID: ${{ secrets.CLIENT_ID_PROD }}
|
||||
SECRET_KEY: ${{ secrets.SECRET_KEY_PROD }}
|
||||
REGISTRY_USERNAME: ${{ secrets.REGISTRY_USERNAME }}
|
||||
REGISTRY_PASSWORD: ${{ secrets.REGISTRY_PASSWORD }}
|
||||
|
||||
- name: List collected system-test results (debug)
|
||||
if: always()
|
||||
run: |
|
||||
echo "Listing test-results/system-tests (if any):"
|
||||
ls -laR test-results/system-tests || true
|
||||
|
||||
- name: System Tests Report
|
||||
uses: mikepenz/action-junit-report@v5
|
||||
if: always()
|
||||
with:
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
report_paths: "test-results/system-tests/**/results_xml_format/**.xml"
|
||||
annotate_only: true
|
||||
job_summary: true
|
||||
|
||||
79
.github/workflows/a-pr-scanner.yaml
vendored
79
.github/workflows/a-pr-scanner.yaml
vendored
@@ -56,7 +56,7 @@ jobs:
|
||||
with:
|
||||
distribution: goreleaser
|
||||
version: latest
|
||||
args: release --clean --snapshot
|
||||
args: build --clean --snapshot --single-target
|
||||
env:
|
||||
RELEASE: ${{ inputs.RELEASE }}
|
||||
CLIENT: ${{ inputs.CLIENT }}
|
||||
@@ -66,84 +66,11 @@ jobs:
|
||||
env:
|
||||
RELEASE: ${{ inputs.RELEASE }}
|
||||
KUBESCAPE_SKIP_UPDATE_CHECK: "true"
|
||||
run: ${{ env.DOCKER_CMD }} python3 smoke_testing/init.py ${PWD}/dist/kubescape-ubuntu-latest
|
||||
run: ${{ env.DOCKER_CMD }} python3 smoke_testing/init.py ${PWD}/dist/cli_linux_amd64_v1/kubescape
|
||||
|
||||
- name: golangci-lint
|
||||
continue-on-error: false
|
||||
uses: golangci/golangci-lint-action@v8
|
||||
uses: golangci/golangci-lint-action@v9
|
||||
with:
|
||||
version: v2.1
|
||||
args: --timeout 10m
|
||||
only-new-issues: true
|
||||
|
||||
scanners:
|
||||
env:
|
||||
GITGUARDIAN_API_KEY: ${{ secrets.GITGUARDIAN_API_KEY }}
|
||||
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
|
||||
name: PR Scanner
|
||||
runs-on: ubuntu-large
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
submodules: recursive
|
||||
- uses: actions/setup-go@v4
|
||||
name: Installing go
|
||||
with:
|
||||
go-version: "1.24"
|
||||
- name: Scanning - Forbidden Licenses (go-licenses)
|
||||
id: licenses-scan
|
||||
continue-on-error: true
|
||||
run: |
|
||||
echo "## Installing go-licenses tool"
|
||||
go install github.com/google/go-licenses@latest
|
||||
echo "## Scanning for forbiden licenses ##"
|
||||
go-licenses check .
|
||||
- name: Scanning - Credentials (GitGuardian)
|
||||
if: ${{ env.GITGUARDIAN_API_KEY }}
|
||||
continue-on-error: true
|
||||
id: credentials-scan
|
||||
uses: GitGuardian/ggshield-action@master
|
||||
with:
|
||||
args: -v --all-policies
|
||||
env:
|
||||
GITHUB_PUSH_BEFORE_SHA: ${{ github.event.before }}
|
||||
GITHUB_PUSH_BASE_SHA: ${{ github.event.base }}
|
||||
GITHUB_PULL_BASE_SHA: ${{ github.event.pull_request.base.sha }}
|
||||
GITHUB_DEFAULT_BRANCH: ${{ github.event.repository.default_branch }}
|
||||
GITGUARDIAN_API_KEY: ${{ secrets.GITGUARDIAN_API_KEY }}
|
||||
- name: Scanning - Vulnerabilities (Snyk)
|
||||
if: ${{ env.SNYK_TOKEN }}
|
||||
id: vulnerabilities-scan
|
||||
continue-on-error: true
|
||||
uses: snyk/actions/golang@master
|
||||
with:
|
||||
command: test --all-projects
|
||||
env:
|
||||
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
|
||||
|
||||
- name: Test coverage
|
||||
id: unit-test
|
||||
run: go test -v ${{ inputs.UNIT_TESTS_PATH }} -covermode=count -coverprofile=coverage.out
|
||||
|
||||
- name: Convert coverage count to lcov format
|
||||
uses: jandelgado/gcov2lcov-action@v1
|
||||
|
||||
- name: Submit coverage tests to Coveralls
|
||||
continue-on-error: true
|
||||
uses: coverallsapp/github-action@v1
|
||||
with:
|
||||
github-token: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }}
|
||||
path-to-lcov: coverage.lcov
|
||||
|
||||
- name: Comment results to PR
|
||||
continue-on-error: true # Warning: This might break opening PRs from forks
|
||||
uses: peter-evans/create-or-update-comment@v4
|
||||
with:
|
||||
issue-number: ${{ github.event.pull_request.number }}
|
||||
body: |
|
||||
Scan results:
|
||||
- License scan: ${{ steps.licenses-scan.outcome }}
|
||||
- Credentials scan: ${{ steps.credentials-scan.outcome }}
|
||||
- Vulnerabilities scan: ${{ steps.vulnerabilities-scan.outcome }}
|
||||
reactions: 'eyes'
|
||||
|
||||
359
.github/workflows/b-binary-build-and-e2e-tests.yaml
vendored
359
.github/workflows/b-binary-build-and-e2e-tests.yaml
vendored
@@ -1,359 +0,0 @@
|
||||
name: b-binary-build-and-e2e-tests
|
||||
permissions: read-all
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
COMPONENT_NAME:
|
||||
required: false
|
||||
type: string
|
||||
default: "kubescape"
|
||||
RELEASE:
|
||||
required: false
|
||||
type: string
|
||||
default: ""
|
||||
CLIENT:
|
||||
required: false
|
||||
type: string
|
||||
default: "test"
|
||||
GO_VERSION:
|
||||
required: false
|
||||
type: string
|
||||
default: "1.24"
|
||||
GO111MODULE:
|
||||
required: false
|
||||
type: string
|
||||
default: ""
|
||||
CGO_ENABLED:
|
||||
type: number
|
||||
default: 1
|
||||
required: false
|
||||
BINARY_TESTS:
|
||||
type: string
|
||||
required: false
|
||||
default: '[
|
||||
"ks_microservice_create_2_cronjob_mitre_and_nsa_proxy",
|
||||
"ks_microservice_triggering_with_cron_job",
|
||||
"ks_microservice_update_cronjob_schedule",
|
||||
"ks_microservice_delete_cronjob",
|
||||
"ks_microservice_create_2_cronjob_mitre_and_nsa",
|
||||
"ks_microservice_ns_creation",
|
||||
"ks_microservice_on_demand",
|
||||
"ks_microservice_mitre_framework_on_demand",
|
||||
"ks_microservice_nsa_and_mitre_framework_demand",
|
||||
"scan_nsa",
|
||||
"scan_mitre",
|
||||
"scan_with_exceptions",
|
||||
"scan_repository",
|
||||
"scan_local_file",
|
||||
"scan_local_glob_files",
|
||||
"scan_local_list_of_files",
|
||||
"scan_with_exception_to_backend",
|
||||
"scan_nsa_and_submit_to_backend",
|
||||
"scan_mitre_and_submit_to_backend",
|
||||
"scan_local_repository_and_submit_to_backend",
|
||||
"scan_repository_from_url_and_submit_to_backend",
|
||||
"scan_with_custom_framework",
|
||||
"scan_customer_configuration",
|
||||
"scan_compliance_score"
|
||||
]'
|
||||
|
||||
workflow_call:
|
||||
inputs:
|
||||
COMPONENT_NAME:
|
||||
required: true
|
||||
type: string
|
||||
RELEASE:
|
||||
required: true
|
||||
type: string
|
||||
CLIENT:
|
||||
required: true
|
||||
type: string
|
||||
GO_VERSION:
|
||||
type: string
|
||||
default: "1.24"
|
||||
GO111MODULE:
|
||||
required: true
|
||||
type: string
|
||||
CGO_ENABLED:
|
||||
type: number
|
||||
default: 1
|
||||
BINARY_TESTS:
|
||||
type: string
|
||||
default: '[
|
||||
"scan_nsa",
|
||||
"scan_mitre",
|
||||
"scan_with_exceptions",
|
||||
"scan_repository",
|
||||
"scan_local_file",
|
||||
"scan_local_glob_files",
|
||||
"scan_local_list_of_files",
|
||||
"scan_nsa_and_submit_to_backend",
|
||||
"scan_mitre_and_submit_to_backend",
|
||||
"scan_local_repository_and_submit_to_backend",
|
||||
"scan_repository_from_url_and_submit_to_backend",
|
||||
"scan_with_custom_framework",
|
||||
"scan_customer_configuration",
|
||||
"scan_compliance_score",
|
||||
"scan_custom_framework_scanning_file_scope_testing",
|
||||
"scan_custom_framework_scanning_cluster_scope_testing",
|
||||
"scan_custom_framework_scanning_cluster_and_file_scope_testing"
|
||||
]'
|
||||
|
||||
jobs:
|
||||
wf-preparation:
|
||||
name: secret-validator
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
TEST_NAMES: ${{ steps.export_tests_to_env.outputs.TEST_NAMES }}
|
||||
is-secret-set: ${{ steps.check-secret-set.outputs.is-secret-set }}
|
||||
|
||||
steps:
|
||||
- name: check if the necessary secrets are set in github secrets
|
||||
id: check-secret-set
|
||||
env:
|
||||
CUSTOMER: ${{ secrets.CUSTOMER }}
|
||||
USERNAME: ${{ secrets.USERNAME }}
|
||||
PASSWORD: ${{ secrets.PASSWORD }}
|
||||
CLIENT_ID: ${{ secrets.CLIENT_ID_PROD }}
|
||||
SECRET_KEY: ${{ secrets.SECRET_KEY_PROD }}
|
||||
REGISTRY_USERNAME: ${{ secrets.REGISTRY_USERNAME }}
|
||||
REGISTRY_PASSWORD: ${{ secrets.REGISTRY_PASSWORD }}
|
||||
run: "echo \"is-secret-set=${{ env.CUSTOMER != '' && env.USERNAME != '' && env.PASSWORD != '' && env.CLIENT_ID != '' && env.SECRET_KEY != '' && env.REGISTRY_USERNAME != '' && env.REGISTRY_PASSWORD != '' }}\" >> $GITHUB_OUTPUT\n"
|
||||
|
||||
- id: export_tests_to_env
|
||||
name: set test name
|
||||
run: |
|
||||
echo "TEST_NAMES=$input" >> $GITHUB_OUTPUT
|
||||
env:
|
||||
input: ${{ inputs.BINARY_TESTS }}
|
||||
|
||||
check-secret:
|
||||
name: check if QUAYIO_REGISTRY_USERNAME & QUAYIO_REGISTRY_PASSWORD is set in github secrets
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
is-secret-set: ${{ steps.check-secret-set.outputs.is-secret-set }}
|
||||
steps:
|
||||
- name: check if QUAYIO_REGISTRY_USERNAME & QUAYIO_REGISTRY_PASSWORD is set in github secrets
|
||||
id: check-secret-set
|
||||
env:
|
||||
QUAYIO_REGISTRY_USERNAME: ${{ secrets.QUAYIO_REGISTRY_USERNAME }}
|
||||
QUAYIO_REGISTRY_PASSWORD: ${{ secrets.QUAYIO_REGISTRY_PASSWORD }}
|
||||
run: |
|
||||
echo "is-secret-set=${{ env.QUAYIO_REGISTRY_USERNAME != '' && env.QUAYIO_REGISTRY_PASSWORD != '' }}" >> $GITHUB_OUTPUT
|
||||
|
||||
binary-build:
|
||||
name: Create cross-platform build
|
||||
needs: wf-preparation
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
runs-on: ubuntu-large
|
||||
steps:
|
||||
- name: (debug) Step 1 - Check disk space before checkout
|
||||
run: df -h
|
||||
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
submodules: recursive
|
||||
|
||||
- name: (debug) Step 2 - Check disk space before installing Go
|
||||
run: df -h
|
||||
|
||||
- uses: actions/setup-go@v4
|
||||
name: Installing go
|
||||
with:
|
||||
go-version: ${{ inputs.GO_VERSION }}
|
||||
|
||||
- name: (debug) Step 3 - Check disk space before build
|
||||
run: df -h
|
||||
|
||||
- name: Test core pkg
|
||||
run: ${{ env.DOCKER_CMD }} go test -v ./...
|
||||
if: startsWith(github.ref, 'refs/tags')
|
||||
|
||||
- name: (debug) Step 4 - Check disk space before testing httphandler pkg
|
||||
run: df -h
|
||||
|
||||
- name: Test httphandler pkg
|
||||
run: ${{ env.DOCKER_CMD }} sh -c 'cd httphandler && go test -v ./...'
|
||||
if: startsWith(github.ref, 'refs/tags')
|
||||
|
||||
- name: (debug) Step 5 - Check disk space before setting up Syft
|
||||
run: df -h
|
||||
|
||||
- uses: anchore/sbom-action/download-syft@v0
|
||||
name: Setup Syft
|
||||
|
||||
- name: (debug) Step 6 - Check disk space before goreleaser
|
||||
run: df -h
|
||||
|
||||
- uses: goreleaser/goreleaser-action@v6
|
||||
name: Build
|
||||
with:
|
||||
distribution: goreleaser
|
||||
version: latest
|
||||
args: release --clean --snapshot
|
||||
env:
|
||||
RELEASE: ${{ inputs.RELEASE }}
|
||||
CLIENT: ${{ inputs.CLIENT }}
|
||||
CGO_ENABLED: ${{ inputs.CGO_ENABLED }}
|
||||
|
||||
- name: (debug) Step 7 - Check disk space before smoke testing
|
||||
run: df -h
|
||||
|
||||
- name: Smoke Testing
|
||||
env:
|
||||
RELEASE: ${{ inputs.RELEASE }}
|
||||
KUBESCAPE_SKIP_UPDATE_CHECK: "true"
|
||||
run: ${{ env.DOCKER_CMD }} python3 smoke_testing/init.py ${PWD}/dist/kubescape-ubuntu-latest
|
||||
|
||||
- name: (debug) Step 8 - Check disk space before golangci-lint
|
||||
run: df -h
|
||||
|
||||
- name: golangci-lint
|
||||
continue-on-error: true
|
||||
uses: golangci/golangci-lint-action@v3
|
||||
with:
|
||||
version: latest
|
||||
args: --timeout 10m
|
||||
only-new-issues: true
|
||||
skip-pkg-cache: true
|
||||
skip-build-cache: true
|
||||
|
||||
- name: (debug) Step 9 - Check disk space before uploading artifacts
|
||||
run: df -h
|
||||
|
||||
- uses: actions/upload-artifact@v4
|
||||
name: Upload artifacts
|
||||
with:
|
||||
name: kubescape
|
||||
path: dist/*
|
||||
if-no-files-found: error
|
||||
|
||||
- name: (debug) Step 10 - Check disk space after uploading artifacts
|
||||
run: df -h
|
||||
|
||||
build-http-image:
|
||||
permissions:
|
||||
contents: write
|
||||
id-token: write
|
||||
packages: write
|
||||
pull-requests: read
|
||||
needs: [check-secret]
|
||||
uses: kubescape/workflows/.github/workflows/incluster-comp-pr-merged.yaml@main
|
||||
with:
|
||||
IMAGE_NAME: quay.io/${{ github.repository_owner }}/kubescape
|
||||
IMAGE_TAG: ${{ inputs.RELEASE }}
|
||||
COMPONENT_NAME: kubescape
|
||||
CGO_ENABLED: 0
|
||||
GO111MODULE: "on"
|
||||
BUILD_PLATFORM: linux/amd64,linux/arm64
|
||||
GO_VERSION: "1.24"
|
||||
REQUIRED_TESTS: '[
|
||||
"ks_microservice_create_2_cronjob_mitre_and_nsa_proxy",
|
||||
"ks_microservice_triggering_with_cron_job",
|
||||
"ks_microservice_update_cronjob_schedule",
|
||||
"ks_microservice_delete_cronjob",
|
||||
"ks_microservice_create_2_cronjob_mitre_and_nsa",
|
||||
"ks_microservice_ns_creation",
|
||||
"ks_microservice_on_demand",
|
||||
"ks_microservice_mitre_framework_on_demand",
|
||||
"ks_microservice_nsa_and_mitre_framework_demand",
|
||||
"scan_nsa",
|
||||
"scan_mitre",
|
||||
"scan_with_exceptions",
|
||||
"scan_repository",
|
||||
"scan_local_file",
|
||||
"scan_local_glob_files",
|
||||
"scan_local_list_of_files",
|
||||
"scan_with_exception_to_backend",
|
||||
"scan_nsa_and_submit_to_backend",
|
||||
"scan_mitre_and_submit_to_backend",
|
||||
"scan_local_repository_and_submit_to_backend",
|
||||
"scan_repository_from_url_and_submit_to_backend",
|
||||
"scan_with_custom_framework",
|
||||
"scan_customer_configuration",
|
||||
"scan_compliance_score"
|
||||
]'
|
||||
COSIGN: true
|
||||
HELM_E2E_TEST: true
|
||||
FORCE: true
|
||||
secrets: inherit
|
||||
|
||||
run-tests:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
TEST: ${{ fromJson(needs.wf-preparation.outputs.TEST_NAMES) }}
|
||||
needs: [wf-preparation, binary-build]
|
||||
if: ${{ (needs.wf-preparation.outputs.is-secret-set == 'true') && (always() && (contains(needs.*.result, 'success') || contains(needs.*.result, 'skipped')) && !(contains(needs.*.result, 'failure')) && !(contains(needs.*.result, 'cancelled'))) }}
|
||||
runs-on: ubuntu-latest # This cannot change
|
||||
steps:
|
||||
- uses: actions/download-artifact@v4
|
||||
id: download-artifact
|
||||
with:
|
||||
name: kubescape
|
||||
path: "~"
|
||||
|
||||
- run: ls -laR
|
||||
|
||||
- name: chmod +x
|
||||
run: chmod +x -R ${{steps.download-artifact.outputs.download-path}}/kubescape-ubuntu-latest
|
||||
|
||||
- name: Checkout systests repo
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
repository: armosec/system-tests
|
||||
path: .
|
||||
|
||||
- uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: '3.9'
|
||||
cache: 'pip'
|
||||
|
||||
- name: create env
|
||||
run: ./create_env.sh
|
||||
|
||||
- name: Generate uuid
|
||||
id: uuid
|
||||
run: |
|
||||
echo "RANDOM_UUID=$(uuidgen)" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Create k8s Kind Cluster
|
||||
id: kind-cluster-install
|
||||
uses: helm/kind-action@v1.10.0
|
||||
with:
|
||||
cluster_name: ${{ steps.uuid.outputs.RANDOM_UUID }}
|
||||
|
||||
- name: run-tests-on-local-built-kubescape
|
||||
env:
|
||||
CUSTOMER: ${{ secrets.CUSTOMER }}
|
||||
USERNAME: ${{ secrets.USERNAME }}
|
||||
PASSWORD: ${{ secrets.PASSWORD }}
|
||||
CLIENT_ID: ${{ secrets.CLIENT_ID_PROD }}
|
||||
SECRET_KEY: ${{ secrets.SECRET_KEY_PROD }}
|
||||
REGISTRY_USERNAME: ${{ secrets.REGISTRY_USERNAME }}
|
||||
REGISTRY_PASSWORD: ${{ secrets.REGISTRY_PASSWORD }}
|
||||
run: |
|
||||
echo "Test history:"
|
||||
echo " ${{ matrix.TEST }} " >/tmp/testhistory
|
||||
cat /tmp/testhistory
|
||||
source systests_python_env/bin/activate
|
||||
|
||||
python3 systest-cli.py \
|
||||
-t ${{ matrix.TEST }} \
|
||||
-b production \
|
||||
-c CyberArmorTests \
|
||||
--duration 3 \
|
||||
--logger DEBUG \
|
||||
--kwargs kubescape=${{steps.download-artifact.outputs.download-path}}/kubescape-ubuntu-latest
|
||||
|
||||
deactivate
|
||||
|
||||
- name: Test Report
|
||||
uses: mikepenz/action-junit-report@v5
|
||||
if: always() # always run even if the previous step fails
|
||||
with:
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
report_paths: '**/results_xml_format/**.xml'
|
||||
commit: ${{github.event.workflow_run.head_sha}}
|
||||
41
.github/workflows/build-image.yaml
vendored
41
.github/workflows/build-image.yaml
vendored
@@ -1,41 +0,0 @@
|
||||
name: build-image
|
||||
permissions: read-all
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
CLIENT:
|
||||
required: false
|
||||
type: string
|
||||
default: "test"
|
||||
IMAGE_TAG:
|
||||
required: true
|
||||
type: string
|
||||
CO_SIGN:
|
||||
type: boolean
|
||||
required: false
|
||||
default: false
|
||||
PLATFORMS:
|
||||
type: boolean
|
||||
required: false
|
||||
default: false
|
||||
jobs:
|
||||
build-http-image:
|
||||
permissions:
|
||||
id-token: write
|
||||
packages: write
|
||||
contents: write
|
||||
pull-requests: read
|
||||
uses: kubescape/workflows/.github/workflows/incluster-comp-pr-merged.yaml@main
|
||||
with:
|
||||
IMAGE_NAME: quay.io/${{ github.repository_owner }}/kubescape
|
||||
IMAGE_TAG: ${{ inputs.IMAGE_TAG }}
|
||||
COMPONENT_NAME: kubescape
|
||||
CGO_ENABLED: 0
|
||||
GO111MODULE: "on"
|
||||
BUILD_PLATFORM: ${{ inputs.PLATFORMS && 'linux/amd64,linux/arm64' || 'linux/amd64' }}
|
||||
GO_VERSION: "1.24"
|
||||
REQUIRED_TESTS: '[]'
|
||||
COSIGN: ${{ inputs.CO_SIGN }}
|
||||
HELM_E2E_TEST: false
|
||||
FORCE: true
|
||||
secrets: inherit
|
||||
86
.github/workflows/c-create-release.yaml
vendored
86
.github/workflows/c-create-release.yaml
vendored
@@ -1,86 +0,0 @@
|
||||
name: c-create_release
|
||||
permissions: read-all
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
RELEASE_NAME:
|
||||
description: 'Release name'
|
||||
required: true
|
||||
type: string
|
||||
TAG:
|
||||
description: 'Tag name'
|
||||
required: true
|
||||
type: string
|
||||
DRAFT:
|
||||
description: 'Create draft release'
|
||||
required: false
|
||||
type: boolean
|
||||
default: false
|
||||
jobs:
|
||||
create-release:
|
||||
name: create-release
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
MAC_OS: macos-latest
|
||||
UBUNTU_OS: ubuntu-latest
|
||||
WINDOWS_OS: windows-latest
|
||||
permissions:
|
||||
contents: write
|
||||
steps:
|
||||
- uses: actions/download-artifact@v4
|
||||
id: download-artifact
|
||||
with:
|
||||
name: kubescape
|
||||
path: .
|
||||
|
||||
# TODO: kubescape-windows-latest is deprecated and should be removed
|
||||
- name: Get kubescape.exe from kubescape-windows-latest.exe
|
||||
run: cp ${{steps.download-artifact.outputs.download-path}}/kubescape-${{ env.WINDOWS_OS }}.exe ${{steps.download-artifact.outputs.download-path}}/kubescape.exe
|
||||
|
||||
- name: Set release token
|
||||
id: set-token
|
||||
run: |
|
||||
if [ "${{ secrets.GH_PERSONAL_ACCESS_TOKEN }}" != "" ]; then
|
||||
echo "token=${{ secrets.GH_PERSONAL_ACCESS_TOKEN }}" >> $GITHUB_OUTPUT;
|
||||
else
|
||||
echo "token=${{ secrets.GITHUB_TOKEN }}" >> $GITHUB_OUTPUT;
|
||||
fi
|
||||
|
||||
- name: List artifacts
|
||||
run: |
|
||||
find . -type f -print
|
||||
|
||||
- name: Release
|
||||
uses: softprops/action-gh-release@v2
|
||||
with:
|
||||
token: ${{ steps.set-token.outputs.token }}
|
||||
name: ${{ inputs.RELEASE_NAME }}
|
||||
tag_name: ${{ inputs.TAG }}
|
||||
body: ${{ github.event.pull_request.body }}
|
||||
draft: ${{ inputs.DRAFT }}
|
||||
prerelease: false
|
||||
fail_on_unmatched_files: true
|
||||
files: |
|
||||
./checksums.sha256
|
||||
./kubescape-${{ env.MAC_OS }}
|
||||
./kubescape-${{ env.MAC_OS }}.sbom
|
||||
./kubescape-${{ env.MAC_OS }}.tar.gz
|
||||
./kubescape-${{ env.UBUNTU_OS }}
|
||||
./kubescape-${{ env.UBUNTU_OS }}.sbom
|
||||
./kubescape-${{ env.UBUNTU_OS }}.tar.gz
|
||||
./kubescape-${{ env.WINDOWS_OS }}.exe
|
||||
./kubescape-${{ env.WINDOWS_OS }}.exe.sbom
|
||||
./kubescape-${{ env.WINDOWS_OS }}.tar.gz
|
||||
./kubescape-arm64-${{ env.MAC_OS }}
|
||||
./kubescape-arm64-${{ env.MAC_OS }}.sbom
|
||||
./kubescape-arm64-${{ env.MAC_OS }}.tar.gz
|
||||
./kubescape-arm64-${{ env.UBUNTU_OS }}
|
||||
./kubescape-arm64-${{ env.UBUNTU_OS }}.sbom
|
||||
./kubescape-arm64-${{ env.UBUNTU_OS }}.tar.gz
|
||||
./kubescape-arm64-${{ env.WINDOWS_OS }}.exe
|
||||
./kubescape-arm64-${{ env.WINDOWS_OS }}.exe.sbom
|
||||
./kubescape-arm64-${{ env.WINDOWS_OS }}.tar.gz
|
||||
./kubescape-riscv64-${{ env.UBUNTU_OS }}
|
||||
./kubescape-riscv64-${{ env.UBUNTU_OS }}.sbom
|
||||
./kubescape-riscv64-${{ env.UBUNTU_OS }}.tar.gz
|
||||
./kubescape.exe
|
||||
108
.github/workflows/d-publish-image.yaml
vendored
108
.github/workflows/d-publish-image.yaml
vendored
@@ -1,108 +0,0 @@
|
||||
name: d-publish-image
|
||||
permissions:
|
||||
actions: read
|
||||
checks: read
|
||||
contents: write
|
||||
deployments: read
|
||||
discussions: read
|
||||
id-token: write
|
||||
issues: read
|
||||
models: read
|
||||
packages: read
|
||||
pages: read
|
||||
pull-requests: read
|
||||
repository-projects: read
|
||||
statuses: read
|
||||
security-events: read
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
client:
|
||||
description: 'client name'
|
||||
required: true
|
||||
type: string
|
||||
image_tag:
|
||||
description: 'image tag'
|
||||
required: true
|
||||
type: string
|
||||
image_name:
|
||||
description: 'image registry and name'
|
||||
required: true
|
||||
type: string
|
||||
cosign:
|
||||
required: false
|
||||
default: false
|
||||
type: boolean
|
||||
description: 'run cosign on released image'
|
||||
support_platforms:
|
||||
required: false
|
||||
default: true
|
||||
type: boolean
|
||||
description: 'support amd64/arm64'
|
||||
jobs:
|
||||
check-secret:
|
||||
name: check if QUAYIO_REGISTRY_USERNAME & QUAYIO_REGISTRY_PASSWORD is set in github secrets
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
is-secret-set: ${{ steps.check-secret-set.outputs.is-secret-set }}
|
||||
steps:
|
||||
- name: check if QUAYIO_REGISTRY_USERNAME & QUAYIO_REGISTRY_PASSWORD is set in github secrets
|
||||
id: check-secret-set
|
||||
env:
|
||||
QUAYIO_REGISTRY_USERNAME: ${{ secrets.QUAYIO_REGISTRY_USERNAME }}
|
||||
QUAYIO_REGISTRY_PASSWORD: ${{ secrets.QUAYIO_REGISTRY_PASSWORD }}
|
||||
run: |
|
||||
echo "is-secret-set=${{ env.QUAYIO_REGISTRY_USERNAME != '' && env.QUAYIO_REGISTRY_PASSWORD != '' }}" >> $GITHUB_OUTPUT
|
||||
|
||||
build-cli-image:
|
||||
needs: [check-secret]
|
||||
if: needs.check-secret.outputs.is-secret-set == 'true'
|
||||
name: Build image and upload to registry
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: recursive
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v3
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
- name: Login to Quay.io
|
||||
env:
|
||||
QUAY_PASSWORD: ${{ secrets.QUAYIO_REGISTRY_PASSWORD }}
|
||||
QUAY_USERNAME: ${{ secrets.QUAYIO_REGISTRY_USERNAME }}
|
||||
run: docker login -u="${QUAY_USERNAME}" -p="${QUAY_PASSWORD}" quay.io
|
||||
- uses: actions/download-artifact@v4
|
||||
id: download-artifact
|
||||
with:
|
||||
name: kubescape
|
||||
path: .
|
||||
- name: mv kubescape amd64 binary
|
||||
run: mv kubescape-ubuntu-latest kubescape-amd64-ubuntu-latest
|
||||
- name: chmod +x
|
||||
run: chmod +x -v kubescape-a*
|
||||
- name: Build and push images
|
||||
run: docker buildx build . --file build/kubescape-cli.Dockerfile --tag ${{ inputs.image_name }}:${{ inputs.image_tag }} --tag ${{ inputs.image_name }}:latest --build-arg image_version=${{ inputs.image_tag }} --build-arg client=${{ inputs.client }} --push --platform linux/amd64,linux/arm64
|
||||
- name: Install cosign
|
||||
uses: sigstore/cosign-installer@main
|
||||
with:
|
||||
cosign-release: 'v2.2.2'
|
||||
- name: sign kubescape container image
|
||||
if: ${{ inputs.cosign }}
|
||||
env:
|
||||
COSIGN_EXPERIMENTAL: "true"
|
||||
COSIGN_PRIVATE_KEY: ${{ secrets.COSIGN_PRIVATE_KEY_V1 }}
|
||||
COSIGN_PRIVATE_KEY_PASSWORD: ${{ secrets.COSIGN_PRIVATE_KEY_V1_PASSWORD }}
|
||||
COSIGN_PUBLIC_KEY: ${{ secrets.COSIGN_PUBLIC_KEY_V1 }}
|
||||
run: |
|
||||
# Sign the image with keyless mode
|
||||
cosign sign -y ${{ inputs.image_name }}:${{ inputs.image_tag }}
|
||||
|
||||
# Sign the image with key for verifier clients without keyless support
|
||||
# Put the key from environment variable to a file
|
||||
echo "$COSIGN_PRIVATE_KEY" > cosign.key
|
||||
printf "$COSIGN_PRIVATE_KEY_PASSWORD" | cosign sign -key cosign.key -y ${{ inputs.image_name }}:${{ inputs.image_tag }}
|
||||
rm cosign.key
|
||||
# Verify the image
|
||||
echo "$COSIGN_PUBLIC_KEY" > cosign.pub
|
||||
cosign verify -key cosign.pub ${{ inputs.image_name }}:${{ inputs.image_tag }}
|
||||
46
.github/workflows/e-post-release.yaml
vendored
46
.github/workflows/e-post-release.yaml
vendored
@@ -1,46 +0,0 @@
|
||||
name: e-post_release
|
||||
permissions: read-all
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
TAG:
|
||||
description: 'Tag name'
|
||||
required: true
|
||||
type: string
|
||||
jobs:
|
||||
post_release:
|
||||
name: Post release jobs
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: recursive
|
||||
- name: Update new version in krew-index
|
||||
uses: rajatjindal/krew-release-bot@v0.0.47
|
||||
if: github.repository_owner == 'kubescape'
|
||||
env:
|
||||
GITHUB_REF: refs/tags/${{ inputs.TAG }}
|
||||
- name: Invoke workflow to update packaging
|
||||
uses: benc-uk/workflow-dispatch@v1
|
||||
if: github.repository_owner == 'kubescape'
|
||||
with:
|
||||
workflow: release.yml
|
||||
repo: kubescape/packaging
|
||||
ref: refs/heads/main
|
||||
token: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }}
|
||||
- name: Invoke workflow to update homebrew tap
|
||||
uses: benc-uk/workflow-dispatch@v1
|
||||
if: github.repository_owner == 'kubescape'
|
||||
with:
|
||||
workflow: release.yml
|
||||
repo: kubescape/homebrew-tap
|
||||
ref: refs/heads/main
|
||||
token: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }}
|
||||
- name: Invoke workflow to update github action
|
||||
uses: benc-uk/workflow-dispatch@v1
|
||||
if: github.repository_owner == 'kubescape'
|
||||
with:
|
||||
workflow: release.yaml
|
||||
repo: kubescape/github-action
|
||||
ref: refs/heads/main
|
||||
token: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }}
|
||||
2
.github/workflows/scorecard.yml
vendored
2
.github/workflows/scorecard.yml
vendored
@@ -37,7 +37,7 @@ jobs:
|
||||
persist-credentials: false
|
||||
|
||||
- name: "Run analysis"
|
||||
uses: ossf/scorecard-action@v2.4.0
|
||||
uses: ossf/scorecard-action@v2.4.3
|
||||
with:
|
||||
results_file: results.sarif
|
||||
results_format: sarif
|
||||
|
||||
20
.github/workflows/z-close-typos-issues.yaml
vendored
20
.github/workflows/z-close-typos-issues.yaml
vendored
@@ -1,20 +0,0 @@
|
||||
permissions: read-all
|
||||
on:
|
||||
issues:
|
||||
types: [opened, labeled]
|
||||
jobs:
|
||||
open_PR_message:
|
||||
if: github.event.label.name == 'typo'
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: ben-z/actions-comment-on-issue@1.0.2
|
||||
with:
|
||||
message: "Hello! :wave:\n\nThis issue is being automatically closed, Please open a PR with a relevant fix."
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
auto_close_issues:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: lee-dohm/close-matching-issues@v2
|
||||
with:
|
||||
query: 'label:typo'
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
5
.gitignore
vendored
5
.gitignore
vendored
@@ -9,5 +9,10 @@
|
||||
ca.srl
|
||||
*.out
|
||||
ks
|
||||
cosign.key
|
||||
|
||||
dist/
|
||||
|
||||
# Test output files
|
||||
customFilename.pdf
|
||||
customFilename.xml
|
||||
|
||||
125
.goreleaser.yaml
125
.goreleaser.yaml
@@ -11,40 +11,108 @@ before:
|
||||
hooks:
|
||||
# You may remove this if you don't use go modules.
|
||||
- go mod tidy
|
||||
- go test -v ./...
|
||||
- go -C httphandler test -v ./...
|
||||
|
||||
archives:
|
||||
- id: binaries
|
||||
- id: cli
|
||||
ids:
|
||||
- cli
|
||||
formats:
|
||||
- binary
|
||||
name_template: >-
|
||||
{{ .Binary }}
|
||||
- id: default
|
||||
formats:
|
||||
- tar.gz
|
||||
name_template: >-
|
||||
{{ .Binary }}
|
||||
|
||||
builds:
|
||||
- goos:
|
||||
- id: cli
|
||||
binary: kubescape
|
||||
env:
|
||||
- CGO_ENABLED=0
|
||||
goos:
|
||||
- linux
|
||||
- windows
|
||||
- darwin
|
||||
- windows
|
||||
goarch:
|
||||
- amd64
|
||||
- arm64
|
||||
- riscv64
|
||||
ldflags:
|
||||
- -s -w
|
||||
- -X "github.com/kubescape/kubescape/v3/core/cautils.BuildNumber={{.Env.RELEASE}}"
|
||||
- -X "github.com/kubescape/kubescape/v3/core/cautils.Client={{.Env.CLIENT}}"
|
||||
binary: >-
|
||||
{{ .ProjectName }}-
|
||||
{{- if eq .Arch "amd64" }}
|
||||
{{- else }}{{ .Arch }}-{{ end }}
|
||||
{{- if eq .Os "darwin" }}macos
|
||||
{{- else if eq .Os "linux" }}ubuntu
|
||||
{{- else }}{{ .Os }}{{ end }}-latest
|
||||
no_unique_dist_dir: true
|
||||
hooks:
|
||||
post:
|
||||
- cmd: >
|
||||
{{ if eq .Arch "amd64" }}
|
||||
/bin/sh -lc 'sh build/goreleaser-post-e2e.sh'
|
||||
{{ end }}
|
||||
- id: downloader
|
||||
dir: downloader
|
||||
binary: downloader
|
||||
env:
|
||||
- CGO_ENABLED=0
|
||||
goos:
|
||||
- linux
|
||||
goarch:
|
||||
- amd64
|
||||
- arm64
|
||||
- id: http
|
||||
dir: httphandler
|
||||
binary: ksserver
|
||||
env:
|
||||
- CGO_ENABLED=0
|
||||
goos:
|
||||
- linux
|
||||
goarch:
|
||||
- amd64
|
||||
- arm64
|
||||
|
||||
nfpms:
|
||||
- id: cli
|
||||
package_name: kubescape
|
||||
ids:
|
||||
- cli
|
||||
vendor: Kubescape
|
||||
homepage: https://kubescape.io/
|
||||
maintainer: matthiasb@kubescape.io
|
||||
formats:
|
||||
- apk
|
||||
- deb
|
||||
- rpm
|
||||
bindir: /usr/bin
|
||||
|
||||
docker_signs:
|
||||
- stdin: "{{ .Env.COSIGN_PWD }}"
|
||||
|
||||
dockers_v2:
|
||||
- id: cli
|
||||
images:
|
||||
- "quay.io/kubescape/kubescape-cli"
|
||||
tags:
|
||||
- "{{ .Tag }}"
|
||||
labels:
|
||||
"org.opencontainers.image.description": "Kubescape CLI"
|
||||
"org.opencontainers.image.created": "{{.Date}}"
|
||||
"org.opencontainers.image.name": "{{.ProjectName}}"
|
||||
"org.opencontainers.image.revision": "{{.FullCommit}}"
|
||||
"org.opencontainers.image.version": "{{.Version}}"
|
||||
"org.opencontainers.image.source": "{{.GitURL}}"
|
||||
ids:
|
||||
- cli
|
||||
dockerfile: build/kubescape-cli.Dockerfile
|
||||
- id: http
|
||||
images:
|
||||
- "quay.io/kubescape/kubescape"
|
||||
tags:
|
||||
- "{{ .Tag }}"
|
||||
labels:
|
||||
"org.opencontainers.image.description": "Kubescape microservice"
|
||||
"org.opencontainers.image.created": "{{.Date}}"
|
||||
"org.opencontainers.image.name": "{{.ProjectName}}"
|
||||
"org.opencontainers.image.revision": "{{.FullCommit}}"
|
||||
"org.opencontainers.image.version": "{{.Version}}"
|
||||
"org.opencontainers.image.source": "{{.GitURL}}"
|
||||
ids:
|
||||
- downloader
|
||||
- http
|
||||
dockerfile: build/Dockerfile
|
||||
|
||||
changelog:
|
||||
sort: asc
|
||||
@@ -58,5 +126,20 @@ checksum:
|
||||
|
||||
sboms:
|
||||
- artifacts: binary
|
||||
documents:
|
||||
- "{{ .Binary }}.sbom"
|
||||
|
||||
krews:
|
||||
- name: kubescape
|
||||
ids:
|
||||
- cli
|
||||
skip_upload: true
|
||||
homepage: https://kubescape.io/
|
||||
description: It includes risk analysis, security compliance, and misconfiguration scanning with an easy-to-use CLI interface, flexible output formats, and automated scanning capabilities.
|
||||
short_description: Scan resources and cluster configs against security frameworks.
|
||||
|
||||
release:
|
||||
draft: false
|
||||
footer: >-
|
||||
|
||||
---
|
||||
|
||||
Released by [GoReleaser](https://github.com/goreleaser/goreleaser).
|
||||
|
||||
42
.krew.yaml
42
.krew.yaml
@@ -1,42 +0,0 @@
|
||||
apiVersion: krew.googlecontainertools.github.com/v1alpha2
|
||||
kind: Plugin
|
||||
metadata:
|
||||
name: kubescape
|
||||
spec:
|
||||
homepage: https://github.com/kubescape/kubescape/
|
||||
shortDescription: Scan resources and cluster configs against security frameworks.
|
||||
version: {{ .TagName }}
|
||||
description: |
|
||||
It includes risk analysis, security compliance, and misconfiguration scanning
|
||||
with an easy-to-use CLI interface, flexible output formats, and automated scanning capabilities.
|
||||
platforms:
|
||||
- selector:
|
||||
matchLabels:
|
||||
os: darwin
|
||||
arch: amd64
|
||||
{{ addURIAndSha "https://github.com/kubescape/kubescape/releases/download/{{ .TagName }}/kubescape-macos-latest.tar.gz" .TagName }}
|
||||
bin: kubescape
|
||||
- selector:
|
||||
matchLabels:
|
||||
os: darwin
|
||||
arch: arm64
|
||||
{{ addURIAndSha "https://github.com/kubescape/kubescape/releases/download/{{ .TagName }}/kubescape-arm64-macos-latest.tar.gz" .TagName }}
|
||||
bin: kubescape
|
||||
- selector:
|
||||
matchLabels:
|
||||
os: linux
|
||||
arch: amd64
|
||||
{{ addURIAndSha "https://github.com/kubescape/kubescape/releases/download/{{ .TagName }}/kubescape-ubuntu-latest.tar.gz" .TagName }}
|
||||
bin: kubescape
|
||||
- selector:
|
||||
matchLabels:
|
||||
os: linux
|
||||
arch: arm64
|
||||
{{ addURIAndSha "https://github.com/kubescape/kubescape/releases/download/{{ .TagName }}/kubescape-arm64-ubuntu-latest.tar.gz" .TagName }}
|
||||
bin: kubescape
|
||||
- selector:
|
||||
matchLabels:
|
||||
os: windows
|
||||
arch: amd64
|
||||
{{ addURIAndSha "https://github.com/kubescape/kubescape/releases/download/{{ .TagName }}/kubescape-windows-latest.tar.gz" .TagName }}
|
||||
bin: kubescape.exe
|
||||
471
README.md
471
README.md
@@ -8,6 +8,7 @@
|
||||
[](https://app.fossa.com/projects/git%2Bgithub.com%2Fkubescape%2Fkubescape?ref=badge_shield&issueType=license)
|
||||
[](https://www.bestpractices.dev/projects/6944)
|
||||
[](https://securityscorecards.dev/viewer/?uri=github.com/kubescape/kubescape)
|
||||
[](https://kubescape.io/docs/)
|
||||
[](https://github.com/kubescape/kubescape/stargazers)
|
||||
[](https://twitter.com/kubescape)
|
||||
[](https://cloud-native.slack.com/archives/C04EY3ZF9GE)
|
||||
@@ -22,100 +23,478 @@
|
||||
|
||||
_Comprehensive Kubernetes Security from Development to Runtime_
|
||||
|
||||
Kubescape is an open-source Kubernetes security platform that provides comprehensive security coverage, from left to right across the entire development and deployment lifecycle. It offers hardening, posture management, and runtime security capabilities to ensure robust protection for Kubernetes environments. It saves Kubernetes users and admins precious time, effort, and resources.
|
||||
|
||||
Kubescape scans clusters, YAML files, and Helm charts. It detects misconfigurations according to multiple frameworks (including [NSA-CISA](https://www.armosec.io/blog/kubernetes-hardening-guidance-summary-by-armo/?utm_source=github&utm_medium=repository), [MITRE ATT&CK®](https://www.armosec.io/glossary/mitre-attck-framework/?utm_source=github&utm_medium=repository) and the [CIS Benchmark](https://www.armosec.io/blog/cis-kubernetes-benchmark-framework-scanning-tools-comparison/?utm_source=github&utm_medium=repository)).
|
||||
Kubescape is an open-source Kubernetes security platform that provides comprehensive security coverage, from left to right across the entire development and deployment lifecycle. It offers hardening, posture management, and runtime security capabilities to ensure robust protection for Kubernetes environments.
|
||||
|
||||
Kubescape was created by [ARMO](https://www.armosec.io/?utm_source=github&utm_medium=repository) and is a [Cloud Native Computing Foundation (CNCF) incubating project](https://www.cncf.io/projects/).
|
||||
|
||||
_Please [star ⭐](https://github.com/kubescape/kubescape/stargazers) the repo if you want us to continue developing and improving Kubescape! 😀_
|
||||
_Please [star ⭐](https://github.com/kubescape/kubescape/stargazers) the repo if you want us to continue developing and improving Kubescape!_
|
||||
|
||||
## Demo
|
||||
---
|
||||
|
||||
Kubescape has a command line tool that you can use to quickly get a report on the security posture of a Kubernetes cluster:
|
||||
## 📑 Table of Contents
|
||||
|
||||
<img src="docs/img/demo-v3.gif">
|
||||
- [Features](#-features)
|
||||
- [Demo](#-demo)
|
||||
- [Quick Start](#-quick-start)
|
||||
- [Installation](#-installation)
|
||||
- [CLI Commands](#-cli-commands)
|
||||
- [Usage Examples](#-usage-examples)
|
||||
- [Architecture](#-architecture)
|
||||
- [In-Cluster Operator](#-in-cluster-operator)
|
||||
- [Integrations](#-integrations)
|
||||
- [Community](#-community)
|
||||
- [Changelog](#changelog)
|
||||
- [License](#license)
|
||||
|
||||
## Getting started
|
||||
---
|
||||
|
||||
Experimenting with Kubescape is as easy as:
|
||||
## ✨ Features
|
||||
|
||||
| Feature | Description |
|
||||
|---------|-------------|
|
||||
| 🔍 **Misconfiguration Scanning** | Scan clusters, YAML files, and Helm charts against NSA-CISA, MITRE ATT&CK®, and CIS Benchmarks |
|
||||
| 🐳 **Image Vulnerability Scanning** | Detect CVEs in container images using [Grype](https://github.com/anchore/grype) |
|
||||
| 🩹 **Image Patching** | Automatically patch vulnerable images using [Copacetic](https://github.com/project-copacetic/copacetic) |
|
||||
| 🔧 **Auto-Remediation** | Automatically fix misconfigurations in Kubernetes manifests |
|
||||
| 🛡️ **Admission Control** | Enforce security policies with Validating Admission Policies (VAP) |
|
||||
| 📊 **Runtime Security** | eBPF-based runtime monitoring via [Inspektor Gadget](https://github.com/inspektor-gadget) |
|
||||
| 🤖 **AI Integration** | MCP server for AI assistant integration |
|
||||
|
||||
---
|
||||
|
||||
## 🎬 Demo
|
||||
|
||||
<img src="docs/img/demo-v3.gif" alt="Kubescape CLI demo">
|
||||
|
||||
---
|
||||
|
||||
## 🚀 Quick Start
|
||||
|
||||
### 1. Install Kubescape
|
||||
|
||||
```sh
|
||||
curl -s https://raw.githubusercontent.com/kubescape/kubescape/master/install.sh | /bin/bash
|
||||
```
|
||||
|
||||
This script will automatically download the latest Kubescape CLI release and scan the Kubernetes cluster in your current kubectl context.
|
||||
> 💡 See [Installation](#-installation) for more options (Homebrew, Krew, Windows, etc.)
|
||||
|
||||
Learn more about:
|
||||
### 2. Run Your First Scan
|
||||
|
||||
* [Installing the Kubescape CLI](https://kubescape.io/docs/install-cli/)
|
||||
* [Running your first scan](https://kubescape.io/docs/scanning/)
|
||||
* [Accepting risk with exceptions](https://kubescape.io/docs/accepting-risk/)
|
||||
```sh
|
||||
# Scan your current cluster
|
||||
kubescape scan
|
||||
|
||||
_Did you know you can use Kubescape in all these places?_
|
||||
# Scan a specific YAML file or directory
|
||||
kubescape scan /path/to/manifests/
|
||||
|
||||
# Scan a container image for vulnerabilities
|
||||
kubescape scan image nginx:latest
|
||||
```
|
||||
|
||||
### 3. Explore the Results
|
||||
|
||||
Kubescape provides a detailed security posture overview including:
|
||||
- Control plane security status
|
||||
- Access control risks
|
||||
- Workload misconfigurations
|
||||
- Network policy gaps
|
||||
- Compliance scores (MITRE, NSA)
|
||||
|
||||
---
|
||||
|
||||
## 📦 Installation
|
||||
|
||||
### One-Line Install (Linux/macOS)
|
||||
|
||||
```bash
|
||||
curl -s https://raw.githubusercontent.com/kubescape/kubescape/master/install.sh | /bin/bash
|
||||
```
|
||||
|
||||
### Package Managers
|
||||
|
||||
| Platform | Command |
|
||||
|----------|---------|
|
||||
| **Homebrew** | `brew install kubescape` |
|
||||
| **Krew** | `kubectl krew install kubescape` |
|
||||
| **Arch Linux** | `yay -S kubescape` |
|
||||
| **Ubuntu** | `sudo add-apt-repository ppa:kubescape/kubescape && sudo apt install kubescape` |
|
||||
| **NixOS** | `nix-shell -p kubescape` |
|
||||
| **Chocolatey** | `choco install kubescape` |
|
||||
| **Scoop** | `scoop install kubescape` |
|
||||
|
||||
### Windows (PowerShell)
|
||||
|
||||
```powershell
|
||||
iwr -useb https://raw.githubusercontent.com/kubescape/kubescape/master/install.ps1 | iex
|
||||
```
|
||||
|
||||
📖 **[Full Installation Guide →](docs/installation.md)**
|
||||
|
||||
---
|
||||
|
||||
## 🛠️ CLI Commands
|
||||
|
||||
Kubescape provides a comprehensive CLI with the following commands:
|
||||
|
||||
| Command | Description |
|
||||
|---------|-------------|
|
||||
| [`kubescape scan`](#scanning) | Scan cluster, files, or images for security issues |
|
||||
| [`kubescape scan image`](#image-scanning) | Scan container images for vulnerabilities |
|
||||
| [`kubescape fix`](#auto-fix) | Auto-fix misconfigurations in manifest files |
|
||||
| [`kubescape patch`](#image-patching) | Patch container images to fix vulnerabilities |
|
||||
| [`kubescape list`](#list-frameworks-and-controls) | List available frameworks and controls |
|
||||
| [`kubescape download`](#offline-support) | Download artifacts for offline/air-gapped use |
|
||||
| [`kubescape config`](#configuration) | Manage cached configurations |
|
||||
| [`kubescape operator`](#operator-commands) | Interact with in-cluster Kubescape operator |
|
||||
| [`kubescape vap`](#validating-admission-policies) | Manage Validating Admission Policies |
|
||||
| [`kubescape mcpserver`](#mcp-server) | Start MCP server for AI assistant integration |
|
||||
| `kubescape completion` | Generate shell completion scripts |
|
||||
| `kubescape version` | Display version information |
|
||||
|
||||
---
|
||||
|
||||
## 📖 Usage Examples
|
||||
|
||||
### Scanning
|
||||
|
||||
#### Scan a Running Cluster
|
||||
|
||||
```bash
|
||||
# Default scan (all frameworks)
|
||||
kubescape scan
|
||||
|
||||
# Scan with a specific framework
|
||||
kubescape scan framework nsa
|
||||
kubescape scan framework mitre
|
||||
kubescape scan framework cis-v1.23-t1.0.1
|
||||
|
||||
# Scan a specific control
|
||||
kubescape scan control C-0005 -v
|
||||
```
|
||||
|
||||
#### Scan Files and Repositories
|
||||
|
||||
```bash
|
||||
# Scan local YAML files
|
||||
kubescape scan /path/to/manifests/
|
||||
|
||||
# Scan a Helm chart
|
||||
kubescape scan /path/to/helm/chart/
|
||||
|
||||
# Scan a Git repository
|
||||
kubescape scan https://github.com/kubescape/kubescape
|
||||
|
||||
# Scan with Kustomize
|
||||
kubescape scan /path/to/kustomize/directory/
|
||||
```
|
||||
|
||||
#### Scan Options
|
||||
|
||||
```bash
|
||||
# Include/exclude namespaces
|
||||
kubescape scan --include-namespaces production,staging
|
||||
kubescape scan --exclude-namespaces kube-system,kube-public
|
||||
|
||||
# Use alternative kubeconfig
|
||||
kubescape scan --kubeconfig /path/to/kubeconfig
|
||||
|
||||
# Set compliance threshold (exit code 1 if below threshold)
|
||||
kubescape scan --compliance-threshold 80
|
||||
|
||||
# Set severity threshold
|
||||
kubescape scan --severity-threshold high
|
||||
```
|
||||
|
||||
#### Output Formats
|
||||
|
||||
```bash
|
||||
# JSON output
|
||||
kubescape scan --format json --output results.json
|
||||
|
||||
# JUnit XML (for CI/CD)
|
||||
kubescape scan --format junit --output results.xml
|
||||
|
||||
# SARIF (for GitHub Code Scanning)
|
||||
kubescape scan --format sarif --output results.sarif
|
||||
|
||||
# HTML report
|
||||
kubescape scan --format html --output report.html
|
||||
|
||||
# PDF report
|
||||
kubescape scan --format pdf --output report.pdf
|
||||
```
|
||||
|
||||
### Image Scanning
|
||||
|
||||
```bash
|
||||
# Scan a public image
|
||||
kubescape scan image nginx:1.21
|
||||
|
||||
# Scan with verbose output
|
||||
kubescape scan image nginx:1.21 -v
|
||||
|
||||
# Scan a private registry image
|
||||
kubescape scan image myregistry/myimage:tag --username user --password pass
|
||||
```
|
||||
|
||||
### Auto-Fix
|
||||
|
||||
Automatically fix misconfigurations in your manifest files:
|
||||
|
||||
```bash
|
||||
# First, scan and save results to JSON
|
||||
kubescape scan /path/to/manifests --format json --output results.json
|
||||
|
||||
# Then apply fixes
|
||||
kubescape fix results.json
|
||||
|
||||
# Dry run (preview changes without applying)
|
||||
kubescape fix results.json --dry-run
|
||||
|
||||
# Apply fixes without confirmation prompts
|
||||
kubescape fix results.json --no-confirm
|
||||
```
|
||||
|
||||
### Image Patching
|
||||
|
||||
Patch container images to fix OS-level vulnerabilities:
|
||||
|
||||
```bash
|
||||
# Start buildkitd (required)
|
||||
sudo buildkitd &
|
||||
|
||||
# Patch an image
|
||||
sudo kubescape patch --image docker.io/library/nginx:1.22
|
||||
|
||||
# Specify custom output tag
|
||||
sudo kubescape patch --image nginx:1.22 --tag nginx:1.22-patched
|
||||
|
||||
# See detailed vulnerability report
|
||||
sudo kubescape patch --image nginx:1.22 -v
|
||||
```
|
||||
|
||||
📖 **[Full Patch Command Documentation →](cmd/patch/README.md)**
|
||||
|
||||
### List Frameworks and Controls
|
||||
|
||||
```bash
|
||||
# List available frameworks
|
||||
kubescape list frameworks
|
||||
|
||||
# List all controls
|
||||
kubescape list controls
|
||||
|
||||
# Output as JSON
|
||||
kubescape list controls --format json
|
||||
```
|
||||
|
||||
### Offline Support
|
||||
|
||||
Download artifacts for air-gapped environments:
|
||||
|
||||
```bash
|
||||
# Download all artifacts
|
||||
kubescape download artifacts --output /path/to/offline/dir
|
||||
|
||||
# Download a specific framework
|
||||
kubescape download framework nsa --output /path/to/nsa.json
|
||||
|
||||
# Scan using downloaded artifacts
|
||||
kubescape scan --use-artifacts-from /path/to/offline/dir
|
||||
```
|
||||
|
||||
### Configuration
|
||||
|
||||
```bash
|
||||
# View current configuration
|
||||
kubescape config view
|
||||
|
||||
# Set account ID
|
||||
kubescape config set accountID <your-account-id>
|
||||
|
||||
# Delete cached configuration
|
||||
kubescape config delete
|
||||
```
|
||||
|
||||
### Operator Commands
|
||||
|
||||
Interact with the in-cluster Kubescape operator:
|
||||
|
||||
```bash
|
||||
# Trigger a configuration scan
|
||||
kubescape operator scan configurations
|
||||
|
||||
# Trigger a vulnerability scan
|
||||
kubescape operator scan vulnerabilities
|
||||
```
|
||||
|
||||
### Validating Admission Policies
|
||||
|
||||
Manage Kubernetes Validating Admission Policies:
|
||||
|
||||
```bash
|
||||
# Deploy the Kubescape CEL admission policy library
|
||||
kubescape vap deploy-library | kubectl apply -f -
|
||||
|
||||
# Create a policy binding
|
||||
kubescape vap create-policy-binding \
|
||||
--name my-policy-binding \
|
||||
--policy c-0016 \
|
||||
--namespace my-namespace | kubectl apply -f -
|
||||
```
|
||||
|
||||
### MCP Server
|
||||
|
||||
Start an MCP (Model Context Protocol) server for AI assistant integration:
|
||||
|
||||
```bash
|
||||
kubescape mcpserver
|
||||
```
|
||||
|
||||
The MCP server exposes Kubescape's vulnerability and configuration scan data to AI assistants, enabling natural language queries about your cluster's security posture.
|
||||
|
||||
**Available MCP Tools:**
|
||||
- `list_vulnerability_manifests` - Discover vulnerability manifests
|
||||
- `list_vulnerabilities_in_manifest` - List CVEs in a manifest
|
||||
- `list_vulnerability_matches_for_cve` - Get details for a specific CVE
|
||||
- `list_configuration_security_scan_manifests` - List configuration scan results
|
||||
- `get_configuration_security_scan_manifest` - Get configuration scan details
|
||||
|
||||
---
|
||||
|
||||
## 🏗️ Architecture
|
||||
|
||||
Kubescape can run in two modes:
|
||||
|
||||
### CLI Mode
|
||||
|
||||
The CLI is a standalone tool that scans clusters, files, and images on-demand.
|
||||
|
||||
<div align="center">
|
||||
<img src="docs/img/ksfromcodetodeploy.png" alt="Places you can use Kubescape: in your IDE, CI, CD, or against a running cluster.">
|
||||
<img src="docs/img/ks-cli-arch.png" width="600" alt="CLI Architecture">
|
||||
</div>
|
||||
|
||||
### Continuous security monitoring with the Kubescape Operator
|
||||
**Key Components:**
|
||||
- **[Open Policy Agent (OPA)](https://github.com/open-policy-agent/opa)** - Policy evaluation engine
|
||||
- **[Regolibrary](https://github.com/kubescape/regolibrary)** - Library of security controls
|
||||
- **[Grype](https://github.com/anchore/grype)** - Image vulnerability scanning
|
||||
- **[Copacetic](https://github.com/project-copacetic/copacetic)** - Image patching
|
||||
|
||||
As well as a CLI, Kubescape provides an in-cluster mode, which is installed via a Helm chart. Kubescape in-cluster provides extensive features such as continuous scanning, image vulnerability scanning, runtime analysis, network policy generation, and more. [Learn more about the Kubescape operator](https://kubescape.io/docs/operator/).
|
||||
### Operator Mode (In-Cluster)
|
||||
|
||||
### Using Kubescape as a GitHub Action
|
||||
For continuous monitoring, deploy the Kubescape operator via Helm.
|
||||
|
||||
Kubescape can be used as a GitHub Action. This is a great way to integrate Kubescape into your CI/CD pipeline. You can find the Kubescape GitHub Action in the [GitHub Action marketplace](https://github.com/marketplace/actions/kubescape).
|
||||
<div align="center">
|
||||
<img src="docs/img/ks-operator-arch.png" width="600" alt="Operator Architecture">
|
||||
</div>
|
||||
|
||||
## Under the hood
|
||||
**Additional Capabilities:**
|
||||
- Continuous configuration scanning
|
||||
- Image vulnerability scanning
|
||||
- Runtime analysis with eBPF
|
||||
- Network policy generation
|
||||
|
||||
Kubescape uses [Open Policy Agent](https://github.com/open-policy-agent/opa) to verify Kubernetes objects against [a library of posture controls](https://github.com/kubescape/regolibrary).
|
||||
For image scanning, it uses [Grype](https://github.com/anchore/grype).
|
||||
For image patching, it uses [Copacetic](https://github.com/project-copacetic/copacetic).
|
||||
For eBPF, it uses [Inspektor Gadget](https://github.com/inspektor-gadget)
|
||||
📖 **[Full Architecture Documentation →](docs/architecture.md)**
|
||||
|
||||
By default, CLI scan results are printed in a console-friendly manner, but they can be:
|
||||
---
|
||||
|
||||
* exported to JSON, junit XML or SARIF
|
||||
* rendered to HTML or PDF
|
||||
* submitted to a [cloud service](docs/providers.md)
|
||||
## ☸️ In-Cluster Operator
|
||||
|
||||
### In-cluster architecture
|
||||
The Kubescape operator provides continuous security monitoring in your cluster:
|
||||
|
||||

|
||||
```bash
|
||||
# Add the Kubescape Helm repository
|
||||
helm repo add kubescape https://kubescape.github.io/helm-charts/
|
||||
|
||||
## Community
|
||||
# Install the operator
|
||||
helm upgrade --install kubescape kubescape/kubescape-operator \
|
||||
--namespace kubescape \
|
||||
--create-namespace
|
||||
```
|
||||
|
||||
Kubescape is an open source project. We welcome your feedback and ideas for improvement. We are part of the CNCF community and are evolving Kubescape in sync with the security needs of Kubernetes users. To learn more about where Kubescape is heading, please check out our [ROADMAP](https://github.com/kubescape/project-governance/blob/main/ROADMAP.md).
|
||||
**Operator Features:**
|
||||
- 🔄 Continuous misconfiguration scanning
|
||||
- 🐳 Image vulnerability scanning for all workloads
|
||||
- 🔍 Runtime threat detection (eBPF-based)
|
||||
- 🌐 Network policy generation
|
||||
- 📈 Prometheus metrics integration
|
||||
|
||||
If you feel inspired to contribute to Kubescape, check out our [CONTRIBUTING](https://github.com/kubescape/project-governance/blob/main/CONTRIBUTING.md) file to learn how. You can find the issues we are working on (triage to development) on the [Kubescaping board](https://github.com/orgs/kubescape/projects/4/views/1)
|
||||
📖 **[Operator Installation Guide →](https://kubescape.io/docs/operator/)**
|
||||
|
||||
* Feel free to pick a task from the [board](https://github.com/orgs/kubescape/projects/4) or suggest a feature of your own.
|
||||
* Open an issue on the board. We aim to respond to all issues within 48 hours.
|
||||
* [Join the CNCF Slack](https://slack.cncf.io/) and then our [users](https://cloud-native.slack.com/archives/C04EY3ZF9GE) or [developers](https://cloud-native.slack.com/archives/C04GY6H082K) channel.
|
||||
---
|
||||
|
||||
The Kubescape project follows the [CNCF Code of Conduct](https://github.com/cncf/foundation/blob/master/code-of-conduct.md).
|
||||
## 🔌 Integrations
|
||||
|
||||
For more information about the Kubescape community, please visit [COMMUNITY](https://github.com/kubescape/project-governance/blob/main/COMMUNITY.md).
|
||||
### CI/CD
|
||||
|
||||
| Platform | Integration |
|
||||
|----------|-------------|
|
||||
| **GitHub Actions** | [kubescape/github-action](https://github.com/marketplace/actions/kubescape) |
|
||||
| **GitLab CI** | [Documentation](https://kubescape.io/docs/integrations/gitlab/) |
|
||||
| **Jenkins** | [Documentation](https://kubescape.io/docs/integrations/jenkins/) |
|
||||
|
||||
We would like to take this opportunity to thank all our contibutors to date.
|
||||
### IDE Extensions
|
||||
|
||||
<br>
|
||||
| IDE | Extension |
|
||||
|-----|-----------|
|
||||
| **VS Code** | [Kubescape Extension](https://marketplace.visualstudio.com/items?itemName=kubescape.kubescape) |
|
||||
| **Lens** | [Kubescape Lens Extension](https://github.com/armosec/lens-kubescape) |
|
||||
|
||||
<a href = "https://github.com/kubescape/kubescape/graphs/contributors">
|
||||
<img src = "https://contrib.rocks/image?repo=kubescape/kubescape"/>
|
||||
### Where You Can Use Kubescape
|
||||
|
||||
<div align="center">
|
||||
<img src="docs/img/ksfromcodetodeploy.png" alt="Kubescape integration points: IDE, CI, CD, Runtime">
|
||||
</div>
|
||||
|
||||
---
|
||||
|
||||
## 👥 Community
|
||||
|
||||
Kubescape is a CNCF incubating project with an active community.
|
||||
|
||||
### Get Involved
|
||||
|
||||
- 💬 **[Slack - Users Channel](https://cloud-native.slack.com/archives/C04EY3ZF9GE)** - Ask questions, get help
|
||||
- 💬 **[Slack - Developers Channel](https://cloud-native.slack.com/archives/C04GY6H082K)** - Contribute to development
|
||||
- 🐛 **[GitHub Issues](https://github.com/kubescape/kubescape/issues)** - Report bugs and request features
|
||||
- 📋 **[Project Board](https://github.com/orgs/kubescape/projects/4)** - See what we're working on
|
||||
- 🗺️ **[Roadmap](https://github.com/kubescape/project-governance/blob/main/ROADMAP.md)** - Future plans
|
||||
|
||||
### Contributing
|
||||
|
||||
We welcome contributions! Please see our:
|
||||
- **[Contributing Guide](https://github.com/kubescape/project-governance/blob/main/CONTRIBUTING.md)**
|
||||
- **[Code of Conduct](https://github.com/cncf/foundation/blob/master/code-of-conduct.md)**
|
||||
|
||||
### Community Resources
|
||||
|
||||
- **[Community Info](https://github.com/kubescape/project-governance/blob/main/COMMUNITY.md)**
|
||||
- **[Governance](https://github.com/kubescape/project-governance/blob/main/GOVERNANCE.md)**
|
||||
- **[Security Policy](https://github.com/kubescape/project-governance/blob/main/SECURITY.md)**
|
||||
- **[Maintainers](https://github.com/kubescape/project-governance/blob/main/MAINTAINERS.md)**
|
||||
|
||||
### Contributors
|
||||
|
||||
<a href="https://github.com/kubescape/kubescape/graphs/contributors">
|
||||
<img src="https://contrib.rocks/image?repo=kubescape/kubescape"/>
|
||||
</a>
|
||||
|
||||
---
|
||||
|
||||
## Changelog
|
||||
|
||||
Kubescape changes are tracked on the [release](https://github.com/kubescape/kubescape/releases) page.
|
||||
Kubescape changes are tracked on the [releases page](https://github.com/kubescape/kubescape/releases).
|
||||
|
||||
---
|
||||
|
||||
## License
|
||||
|
||||
Copyright 2021-2025, the Kubescape Authors. All rights reserved. Kubescape is released under the Apache 2.0 license. See the [LICENSE](LICENSE) file for details.
|
||||
Copyright 2021-2025, the Kubescape Authors. All rights reserved.
|
||||
|
||||
Kubescape is released under the [Apache 2.0 license](LICENSE).
|
||||
|
||||
Kubescape is a [Cloud Native Computing Foundation (CNCF) incubating project](https://www.cncf.io/projects/kubescape/) and was contributed by [ARMO](https://www.armosec.io/?utm_source=github&utm_medium=repository).
|
||||
|
||||
<div align="center">
|
||||
<img src="https://raw.githubusercontent.com/cncf/artwork/refs/heads/main/other/cncf-member/incubating/color/cncf-incubating-color.svg" width="300" alt="CNCF Incubating Project">
|
||||
</div>
|
||||
</div>
|
||||
@@ -1,25 +1,12 @@
|
||||
FROM --platform=$BUILDPLATFORM golang:1.24-bookworm AS builder
|
||||
|
||||
ENV GO111MODULE=on CGO_ENABLED=0
|
||||
WORKDIR /work
|
||||
ARG TARGETOS TARGETARCH
|
||||
|
||||
RUN --mount=target=. \
|
||||
--mount=type=cache,target=/root/.cache/go-build \
|
||||
--mount=type=cache,target=/go/pkg \
|
||||
cd httphandler && GOOS=$TARGETOS GOARCH=$TARGETARCH go build -o /out/ksserver .
|
||||
RUN --mount=target=. \
|
||||
--mount=type=cache,target=/root/.cache/go-build \
|
||||
--mount=type=cache,target=/go/pkg \
|
||||
go run downloader/main.go
|
||||
|
||||
FROM gcr.io/distroless/static-debian12:nonroot
|
||||
FROM gcr.io/distroless/static-debian13:nonroot
|
||||
|
||||
USER nonroot
|
||||
WORKDIR /home/nonroot/
|
||||
|
||||
COPY --from=builder /out/ksserver /usr/bin/ksserver
|
||||
COPY --from=builder /root/.kubescape /home/nonroot/.kubescape
|
||||
ARG TARGETPLATFORM
|
||||
COPY $TARGETPLATFORM/downloader /usr/bin/downloader
|
||||
RUN ["downloader"]
|
||||
COPY $TARGETPLATFORM/ksserver /usr/bin/ksserver
|
||||
|
||||
ARG image_version client
|
||||
ENV RELEASE=$image_version CLIENT=$client
|
||||
|
||||
244
build/README.md
244
build/README.md
@@ -1,19 +1,241 @@
|
||||
## Docker Build
|
||||
# Building Kubescape
|
||||
|
||||
### Build your own Docker image
|
||||
This guide covers how to build Kubescape from source.
|
||||
|
||||
1. Clone Project
|
||||
```
|
||||
git clone https://github.com/kubescape/kubescape.git kubescape && cd "$_"
|
||||
## Table of Contents
|
||||
|
||||
- [Prerequisites](#prerequisites)
|
||||
- [Building the CLI](#building-the-cli)
|
||||
- [Building Docker Images](#building-docker-images)
|
||||
- [Build Options](#build-options)
|
||||
- [Development Setup](#development-setup)
|
||||
- [Troubleshooting](#troubleshooting)
|
||||
|
||||
---
|
||||
|
||||
## Prerequisites
|
||||
|
||||
### Required
|
||||
|
||||
- **Go 1.23+** - [Installation Guide](https://golang.org/doc/install)
|
||||
- **Git** - For cloning the repository
|
||||
- **Make** - For running build commands
|
||||
|
||||
### Optional (for Docker builds)
|
||||
|
||||
- **Docker** - [Installation Guide](https://docs.docker.com/get-docker/)
|
||||
- **Docker Buildx** - For multi-platform builds (included with Docker Desktop)
|
||||
- **GoReleaser** - [Installation Guide](https://goreleaser.com/install/)
|
||||
|
||||
### Verify Prerequisites
|
||||
|
||||
```bash
|
||||
go version # Should be 1.23 or higher
|
||||
git --version
|
||||
make --version
|
||||
docker --version # Optional
|
||||
goreleaser --version # Optional
|
||||
```
|
||||
|
||||
2. Build kubescape CLI Docker image
|
||||
```
|
||||
make all
|
||||
docker buildx build -t kubescape-cli -f build/kubescape-cli.Dockerfile --build-arg="ks_binary=kubescape" --load .
|
||||
---
|
||||
|
||||
## Building the CLI
|
||||
|
||||
### Clone the Repository
|
||||
|
||||
```bash
|
||||
git clone https://github.com/kubescape/kubescape.git
|
||||
cd kubescape
|
||||
```
|
||||
|
||||
3. Build kubescape Docker image
|
||||
### Build with Make
|
||||
|
||||
```bash
|
||||
# Build for your current platform
|
||||
make build
|
||||
|
||||
# The binary will be at ./kubescape
|
||||
./kubescape version
|
||||
```
|
||||
docker buildx build -t kubescape -f build/Dockerfile --load .
|
||||
|
||||
### Build Directly with Go
|
||||
|
||||
```bash
|
||||
go build -o kubescape .
|
||||
```
|
||||
|
||||
### Build with GoReleaser
|
||||
|
||||
```bash
|
||||
# Build for your current platform
|
||||
RELEASE=v0.0.1 CLIENT=local goreleaser build --snapshot --clean --single-target
|
||||
```
|
||||
|
||||
### Cross-Compilation
|
||||
|
||||
Build for different platforms:
|
||||
|
||||
```bash
|
||||
# Linux (amd64)
|
||||
GOOS=linux GOARCH=amd64 go build -o kubescape-linux-amd64 .
|
||||
|
||||
# Linux (arm64)
|
||||
GOOS=linux GOARCH=arm64 go build -o kubescape-linux-arm64 .
|
||||
|
||||
# macOS (amd64)
|
||||
GOOS=darwin GOARCH=amd64 go build -o kubescape-darwin-amd64 .
|
||||
|
||||
# macOS (arm64 / Apple Silicon)
|
||||
GOOS=darwin GOARCH=arm64 go build -o kubescape-darwin-arm64 .
|
||||
|
||||
# Windows (amd64)
|
||||
GOOS=windows GOARCH=amd64 go build -o kubescape-windows-amd64.exe .
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Building Docker Images
|
||||
|
||||
Kubescape uses [GoReleaser](https://goreleaser.com/) to build its Docker images. The Dockerfiles are specifically designed to work with GoReleaser's build pipeline, which handles cross-compilation and places binaries in the expected directory structure.
|
||||
|
||||
### Build with GoReleaser
|
||||
|
||||
The recommended way to build Docker images locally is using GoReleaser. Note that `RELEASE`, `CLIENT`, and `RUN_E2E` environment variables are required:
|
||||
|
||||
```bash
|
||||
# Build all artifacts and Docker images locally without publishing
|
||||
# --skip=before,krew,nfpm,sbom skips unnecessary steps for faster local builds
|
||||
RELEASE=v0.0.1 CLIENT=local RUN_E2E=false goreleaser release --snapshot --clean --skip=before,nfpm,sbom
|
||||
```
|
||||
|
||||
Please read the [GoReleaser documentation](https://goreleaser.com/customization/dockers_v2/#testing-locally) for more details on using it for local testing.
|
||||
|
||||
---
|
||||
|
||||
## Build Options
|
||||
|
||||
### Make Targets
|
||||
|
||||
| Target | Description |
|
||||
|--------|-------------|
|
||||
| `make build` | Build the Kubescape binary |
|
||||
| `make test` | Run unit tests |
|
||||
| `make all` | Build everything |
|
||||
| `make clean` | Remove build artifacts |
|
||||
|
||||
### Build Tags
|
||||
|
||||
You can use Go build tags to customize the build:
|
||||
|
||||
```bash
|
||||
# Example with build tags
|
||||
go build -tags "netgo" -o kubescape .
|
||||
```
|
||||
|
||||
### Version Information
|
||||
|
||||
To embed version information in the build:
|
||||
|
||||
```bash
|
||||
VERSION=$(git describe --tags --always)
|
||||
BUILD_DATE=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
|
||||
COMMIT=$(git rev-parse HEAD)
|
||||
|
||||
go build -ldflags "-X main.version=$VERSION -X main.buildDate=$BUILD_DATE -X main.commit=$COMMIT" -o kubescape .
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Development Setup
|
||||
|
||||
### Install Development Dependencies
|
||||
|
||||
```bash
|
||||
# Install golangci-lint for linting
|
||||
go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
|
||||
|
||||
# Install other tools as needed
|
||||
go mod download
|
||||
```
|
||||
|
||||
### Run Tests
|
||||
|
||||
```bash
|
||||
# Run all tests
|
||||
make test
|
||||
|
||||
# Run tests with coverage
|
||||
go test -cover ./...
|
||||
|
||||
# Run specific package tests
|
||||
go test ./core/...
|
||||
```
|
||||
|
||||
### Run Linter
|
||||
|
||||
```bash
|
||||
golangci-lint run
|
||||
```
|
||||
|
||||
### Code Formatting
|
||||
|
||||
```bash
|
||||
go fmt ./...
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
### Build Fails with "module not found"
|
||||
|
||||
```bash
|
||||
# Update dependencies
|
||||
go mod tidy
|
||||
go mod download
|
||||
```
|
||||
|
||||
### CGO-related Errors
|
||||
|
||||
If you encounter CGO errors, try building with CGO disabled:
|
||||
|
||||
```bash
|
||||
CGO_ENABLED=0 go build -o kubescape .
|
||||
```
|
||||
|
||||
### Docker Build Fails
|
||||
|
||||
Ensure Docker daemon is running and you have sufficient permissions.
|
||||
|
||||
If you encounter an error like `failed to calculate checksum ... "/linux/amd64/kubescape": not found`, it usually means you are trying to run `docker build` manually. Because the Dockerfiles are optimized for GoReleaser, you should use the `goreleaser release --snapshot` command described in the [Building Docker Images](#building-docker-images) section instead.
|
||||
|
||||
```bash
|
||||
# Check Docker status
|
||||
docker info
|
||||
```
|
||||
|
||||
### Out of Memory During Build
|
||||
|
||||
For systems with limited memory:
|
||||
|
||||
```bash
|
||||
# Limit Go's memory usage
|
||||
GOGC=50 go build -o kubescape .
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Dockerfiles
|
||||
|
||||
| File | Description |
|
||||
|------|-------------|
|
||||
| `build/Dockerfile` | Full Kubescape image with HTTP handler |
|
||||
| `build/kubescape-cli.Dockerfile` | Minimal CLI-only image |
|
||||
|
||||
---
|
||||
|
||||
## Related Documentation
|
||||
|
||||
- [Contributing Guide](https://github.com/kubescape/project-governance/blob/main/CONTRIBUTING.md)
|
||||
- [Architecture](../docs/architecture.md)
|
||||
- [Getting Started](../docs/getting-started.md)
|
||||
|
||||
151
build/goreleaser-post-e2e.sh
Normal file
151
build/goreleaser-post-e2e.sh
Normal file
@@ -0,0 +1,151 @@
|
||||
#!/usr/bin/env sh
|
||||
#
|
||||
# goreleaser-post-e2e.sh
|
||||
#
|
||||
# A small, robust POSIX shell script intended to be called from the goreleaser
|
||||
# `builds[].hooks.post` entry. It is responsible for optionally running the
|
||||
# repository smoke tests against the artifact produced in `dist/`.
|
||||
#
|
||||
# Usage:
|
||||
# RUN_E2E=true -> enable running smoke tests
|
||||
# E2E_FAIL_ON_ERROR=1 -> (default) treat test failures as fatal (exit non-zero)
|
||||
# E2E_FAIL_ON_ERROR=0 -> treat test failures as non-fatal (log, but exit 0)
|
||||
#
|
||||
# The script is written to be defensive and to work under /bin/sh on CI runners.
|
||||
# Use POSIX-safe flags only.
|
||||
set -eu
|
||||
|
||||
# Helper for logging
|
||||
_now() {
|
||||
date --iso-8601=seconds 2>/dev/null || date
|
||||
}
|
||||
log() {
|
||||
printf '%s [goreleaser-post-e2e] %s\n' "$(_now)" "$*"
|
||||
}
|
||||
|
||||
# GitHub Actions log grouping helpers (no-op outside Actions)
|
||||
gha_group_start() {
|
||||
if [ "${GITHUB_ACTIONS:-}" = "true" ]; then
|
||||
# Titles must be on a single line
|
||||
printf '::group::%s\n' "$*"
|
||||
fi
|
||||
}
|
||||
gha_group_end() {
|
||||
if [ "${GITHUB_ACTIONS:-}" = "true" ]; then
|
||||
printf '::endgroup::\n'
|
||||
fi
|
||||
}
|
||||
|
||||
# Small helper to interpret various truthy forms (1/true/yes/y)
|
||||
is_true() {
|
||||
case "${1:-}" in
|
||||
1|true|TRUE|yes|YES|y|Y) return 0 ;;
|
||||
*) return 1 ;;
|
||||
esac
|
||||
}
|
||||
|
||||
# Determine repo root relative to this script (script is expected to live in kubescape/build/)
|
||||
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
||||
REPO_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
|
||||
|
||||
: "${RUN_E2E:=false}"
|
||||
# Default to fatal E2E failures.
|
||||
: "${E2E_FAIL_ON_ERROR:=1}"
|
||||
|
||||
log "Starting goreleaser post-build e2e script"
|
||||
log "RUN_E2E=${RUN_E2E}"
|
||||
log "E2E_FAIL_ON_ERROR=${E2E_FAIL_ON_ERROR}"
|
||||
|
||||
# Only run on linux/amd64 to avoid running multiple times (once per build)
|
||||
# and to ensure we can run the binary on the current host (assuming host is amd64).
|
||||
if [ -n "${GOARCH:-}" ] && [ "${GOARCH}" != "amd64" ]; then
|
||||
log "Skipping smoke tests for non-amd64 build (GOARCH=${GOARCH})."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if ! is_true "${RUN_E2E}"; then
|
||||
log "RUN_E2E is not enabled. Skipping smoke tests. (RUN_E2E=${RUN_E2E})"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Locate the amd64 artifact in dist/.
|
||||
# Goreleaser v2 puts binaries in dist/<id>_<os>_<arch>_<version>/<binary>
|
||||
# Example: dist/cli_linux_amd64_v1/kubescape
|
||||
ART_PATH=""
|
||||
if [ -d "$REPO_ROOT/dist" ]; then
|
||||
# Find any file named 'kubescape' inside a directory containing 'linux_amd64' inside 'dist'
|
||||
# We use 'find' for robustness against varying directory names
|
||||
ART_PATH=$(find "$REPO_ROOT/dist" -type f -name "kubescape" -path "*linux_amd64*" | head -n 1)
|
||||
fi
|
||||
|
||||
if [ -z "$ART_PATH" ] || [ ! -f "$ART_PATH" ]; then
|
||||
log "No kubescape artifact found in dist/ matching *linux_amd64*/kubescape. Skipping smoke tests."
|
||||
# If we are supposed to run E2E, not finding the artifact is probably an error.
|
||||
if is_true "${E2E_FAIL_ON_ERROR}"; then
|
||||
log "E2E_FAIL_ON_ERROR enabled -> failing because artifact was not found."
|
||||
exit 1
|
||||
fi
|
||||
exit 0
|
||||
fi
|
||||
|
||||
log "Using artifact: $ART_PATH"
|
||||
# Make binary executable if it is a binary
|
||||
chmod +x "$ART_PATH" >/dev/null 2>&1 || true
|
||||
|
||||
# Locate python runner
|
||||
PYTHON=""
|
||||
if command -v python3 >/dev/null 2>&1; then
|
||||
PYTHON=python3
|
||||
elif command -v python >/dev/null 2>&1; then
|
||||
PYTHON=python
|
||||
fi
|
||||
|
||||
if [ -z "$PYTHON" ]; then
|
||||
log "python3 (or python) not found in PATH."
|
||||
if is_true "${E2E_FAIL_ON_ERROR}"; then
|
||||
log "E2E_FAIL_ON_ERROR enabled -> failing the release because python is missing."
|
||||
exit 2
|
||||
else
|
||||
log "E2E_FAIL_ON_ERROR disabled -> continuing without running tests."
|
||||
exit 0
|
||||
fi
|
||||
fi
|
||||
|
||||
# Check for smoke test runner
|
||||
SMOKE_RUNNER="$REPO_ROOT/smoke_testing/init.py"
|
||||
if [ ! -f "$SMOKE_RUNNER" ]; then
|
||||
log "Smoke test runner not found at $SMOKE_RUNNER"
|
||||
if is_true "${E2E_FAIL_ON_ERROR}"; then
|
||||
log "E2E_FAIL_ON_ERROR enabled -> failing the release because smoke runner is missing."
|
||||
exit 3
|
||||
else
|
||||
log "E2E_FAIL_ON_ERROR disabled -> continuing without running tests."
|
||||
exit 0
|
||||
fi
|
||||
fi
|
||||
|
||||
gha_group_start "Smoke tests"
|
||||
log "Running smoke tests with $PYTHON $SMOKE_RUNNER \"$ART_PATH\""
|
||||
# Run the test runner, propagate exit code
|
||||
set +e
|
||||
"$PYTHON" "$SMOKE_RUNNER" "$ART_PATH"
|
||||
rc=$?
|
||||
set -e
|
||||
|
||||
if [ $rc -eq 0 ]; then
|
||||
log "Smoke tests passed (exit code 0)."
|
||||
fi
|
||||
|
||||
log "Smoke tests exited with code: $rc"
|
||||
gha_group_end
|
||||
|
||||
if [ $rc -ne 0 ]; then
|
||||
if is_true "${E2E_FAIL_ON_ERROR}"; then
|
||||
log "E2E_FAIL_ON_ERROR enabled -> failing the release (exit code $rc)."
|
||||
exit $rc
|
||||
else
|
||||
log "E2E_FAIL_ON_ERROR disabled -> continuing despite test failures."
|
||||
fi
|
||||
fi
|
||||
|
||||
exit 0
|
||||
@@ -1,4 +1,4 @@
|
||||
FROM gcr.io/distroless/static-debian12:debug-nonroot
|
||||
FROM gcr.io/distroless/static-debian13:debug-nonroot
|
||||
|
||||
USER nonroot
|
||||
WORKDIR /home/nonroot/
|
||||
@@ -6,7 +6,8 @@ WORKDIR /home/nonroot/
|
||||
ARG image_version client TARGETARCH
|
||||
ENV RELEASE=$image_version CLIENT=$client
|
||||
|
||||
COPY kubescape-${TARGETARCH}-ubuntu-latest /usr/bin/kubescape
|
||||
ARG TARGETPLATFORM
|
||||
COPY $TARGETPLATFORM/kubescape /usr/bin/kubescape
|
||||
RUN ["kubescape", "download", "artifacts"]
|
||||
|
||||
ENTRYPOINT ["kubescape"]
|
||||
|
||||
@@ -294,11 +294,19 @@ func (ksServer *KubescapeMcpserver) CallTool(name string, arguments map[string]i
|
||||
if !ok {
|
||||
namespace = "kubescape"
|
||||
}
|
||||
namespaceStr, ok := namespace.(string)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("namespace must be a string")
|
||||
}
|
||||
manifestName, ok := arguments["manifest_name"]
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("manifest_name is required")
|
||||
}
|
||||
manifest, err := ksServer.ksClient.VulnerabilityManifests(namespace.(string)).Get(context.Background(), manifestName.(string), metav1.GetOptions{})
|
||||
manifestNameStr, ok := manifestName.(string)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("manifest_name must be a string")
|
||||
}
|
||||
manifest, err := ksServer.ksClient.VulnerabilityManifests(namespaceStr).Get(context.Background(), manifestNameStr, metav1.GetOptions{})
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to get vulnerability manifest: %s", err)
|
||||
}
|
||||
@@ -323,21 +331,33 @@ func (ksServer *KubescapeMcpserver) CallTool(name string, arguments map[string]i
|
||||
if !ok {
|
||||
namespace = "kubescape"
|
||||
}
|
||||
namespaceStr, ok := namespace.(string)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("namespace must be a string")
|
||||
}
|
||||
manifestName, ok := arguments["manifest_name"]
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("manifest_name is required")
|
||||
}
|
||||
manifestNameStr, ok := manifestName.(string)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("manifest_name must be a string")
|
||||
}
|
||||
cveID, ok := arguments["cve_id"]
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("cve_id is required")
|
||||
}
|
||||
manifest, err := ksServer.ksClient.VulnerabilityManifests(namespace.(string)).Get(context.Background(), manifestName.(string), metav1.GetOptions{})
|
||||
cveIDStr, ok := cveID.(string)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("cve_id must be a string")
|
||||
}
|
||||
manifest, err := ksServer.ksClient.VulnerabilityManifests(namespaceStr).Get(context.Background(), manifestNameStr, metav1.GetOptions{})
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to get vulnerability manifest: %s", err)
|
||||
}
|
||||
var match []v1beta1.Match
|
||||
for _, m := range manifest.Spec.Payload.Matches {
|
||||
if m.Vulnerability.ID == cveID.(string) {
|
||||
if m.Vulnerability.ID == cveIDStr {
|
||||
match = append(match, m)
|
||||
}
|
||||
}
|
||||
@@ -358,7 +378,11 @@ func (ksServer *KubescapeMcpserver) CallTool(name string, arguments map[string]i
|
||||
if !ok {
|
||||
namespace = "kubescape"
|
||||
}
|
||||
manifests, err := ksServer.ksClient.WorkloadConfigurationScans(namespace.(string)).List(context.Background(), metav1.ListOptions{})
|
||||
namespaceStr, ok := namespace.(string)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("namespace must be a string")
|
||||
}
|
||||
manifests, err := ksServer.ksClient.WorkloadConfigurationScans(namespaceStr).List(context.Background(), metav1.ListOptions{})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -394,11 +418,19 @@ func (ksServer *KubescapeMcpserver) CallTool(name string, arguments map[string]i
|
||||
if !ok {
|
||||
namespace = "kubescape"
|
||||
}
|
||||
namespaceStr, ok := namespace.(string)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("namespace must be a string")
|
||||
}
|
||||
manifestName, ok := arguments["manifest_name"]
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("manifest_name is required")
|
||||
}
|
||||
manifest, err := ksServer.ksClient.WorkloadConfigurationScans(namespace.(string)).Get(context.Background(), manifestName.(string), metav1.GetOptions{})
|
||||
manifestNameStr, ok := manifestName.(string)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("manifest_name must be a string")
|
||||
}
|
||||
manifest, err := ksServer.ksClient.WorkloadConfigurationScans(namespaceStr).Get(context.Background(), manifestNameStr, metav1.GetOptions{})
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to get configuration manifest: %s", err)
|
||||
}
|
||||
|
||||
@@ -73,7 +73,7 @@ We will demonstrate how to use the patch command with an example of [nginx](http
|
||||
sudo buildkitd
|
||||
```
|
||||
|
||||
2. In a seperate terminal, run the `kubescape patch` command:
|
||||
2. In a separate terminal, run the `kubescape patch` command:
|
||||
|
||||
```bash
|
||||
sudo kubescape patch --image docker.io/library/nginx:1.22
|
||||
|
||||
@@ -93,6 +93,7 @@ func GetScanCommand(ks meta.IKubescape) *cobra.Command {
|
||||
scanCmd.PersistentFlags().BoolVarP(&scanInfo.EnableRegoPrint, "enable-rego-prints", "", false, "Enable sending to rego prints to the logs (use with debug log level: -l debug)")
|
||||
scanCmd.PersistentFlags().BoolVarP(&scanInfo.ScanImages, "scan-images", "", false, "Scan resources images")
|
||||
scanCmd.PersistentFlags().BoolVarP(&scanInfo.UseDefaultMatchers, "use-default-matchers", "", true, "Use default matchers (true) or CPE matchers (false) for image scanning")
|
||||
scanCmd.PersistentFlags().StringSliceVar(&scanInfo.LabelsToCopy, "labels-to-copy", nil, "Labels to copy from workloads to scan reports for easy identification. e.g: --labels-to-copy=app,team,environment")
|
||||
|
||||
scanCmd.PersistentFlags().MarkDeprecated("fail-threshold", "use '--compliance-threshold' flag instead. Flag will be removed at 1.Dec.2023")
|
||||
scanCmd.PersistentFlags().MarkDeprecated("create-account", "Create account is no longer supported. In case of a missing Account ID and a configured backend server, a new account id will be generated automatically by Kubescape. Feel free to contact the Kubescape maintainers for more information.")
|
||||
|
||||
@@ -95,7 +95,7 @@ func setWorkloadScanInfo(scanInfo *cautils.ScanInfo, kind string, name string) {
|
||||
scanInfo.ScanObject.SetKind(kind)
|
||||
scanInfo.ScanObject.SetName(name)
|
||||
|
||||
scanInfo.SetPolicyIdentifiers([]string{"workloadscan"}, v1.KindFramework)
|
||||
scanInfo.SetPolicyIdentifiers([]string{"workloadscan", "allcontrols"}, v1.KindFramework)
|
||||
|
||||
if scanInfo.FilePath != "" {
|
||||
scanInfo.InputPatterns = []string{scanInfo.FilePath}
|
||||
|
||||
@@ -28,6 +28,10 @@ func TestSetWorkloadScanInfo(t *testing.T) {
|
||||
Identifier: "workloadscan",
|
||||
Kind: v1.KindFramework,
|
||||
},
|
||||
{
|
||||
Identifier: "allcontrols",
|
||||
Kind: v1.KindFramework,
|
||||
},
|
||||
},
|
||||
ScanType: cautils.ScanTypeWorkload,
|
||||
ScanObject: &objectsenvelopes.ScanObject{
|
||||
@@ -59,12 +63,19 @@ func TestSetWorkloadScanInfo(t *testing.T) {
|
||||
t.Errorf("got: %v, want: %v", scanInfo.ScanObject.Metadata.Name, tc.want.ScanObject.Metadata.Name)
|
||||
}
|
||||
|
||||
if len(scanInfo.PolicyIdentifier) != 1 {
|
||||
t.Errorf("got: %v, want: %v", len(scanInfo.PolicyIdentifier), 1)
|
||||
if len(scanInfo.PolicyIdentifier) != len(tc.want.PolicyIdentifier) {
|
||||
t.Errorf("got: %v policy identifiers, want: %v", len(scanInfo.PolicyIdentifier), len(tc.want.PolicyIdentifier))
|
||||
}
|
||||
|
||||
if scanInfo.PolicyIdentifier[0].Identifier != tc.want.PolicyIdentifier[0].Identifier {
|
||||
t.Errorf("got: %v, want: %v", scanInfo.PolicyIdentifier[0].Identifier, tc.want.PolicyIdentifier[0].Identifier)
|
||||
for i, wantPolicy := range tc.want.PolicyIdentifier {
|
||||
if i < len(scanInfo.PolicyIdentifier) {
|
||||
if scanInfo.PolicyIdentifier[i].Identifier != wantPolicy.Identifier {
|
||||
t.Errorf("got: %v, want: %v", scanInfo.PolicyIdentifier[i].Identifier, wantPolicy.Identifier)
|
||||
}
|
||||
if scanInfo.PolicyIdentifier[i].Kind != wantPolicy.Kind {
|
||||
t.Errorf("got: %v, want: %v", scanInfo.PolicyIdentifier[i].Kind, wantPolicy.Kind)
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
)
|
||||
|
||||
250
core/README.md
250
core/README.md
@@ -1,14 +1,248 @@
|
||||
# Kubescape core package
|
||||
# Kubescape Core Package
|
||||
|
||||
The `core` package provides the main Kubescape scanning engine as a Go library, allowing you to integrate Kubescape security scanning directly into your applications.
|
||||
|
||||
## Table of Contents
|
||||
|
||||
- [Installation](#installation)
|
||||
- [Quick Start](#quick-start)
|
||||
- [API Reference](#api-reference)
|
||||
- [Examples](#examples)
|
||||
- [Configuration Options](#configuration-options)
|
||||
|
||||
---
|
||||
|
||||
## Installation
|
||||
|
||||
```bash
|
||||
go get github.com/kubescape/kubescape/v3/core
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Quick Start
|
||||
|
||||
```go
|
||||
package main
|
||||
|
||||
// initialize kubescape
|
||||
ks := core.NewKubescape()
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"log"
|
||||
|
||||
// scan cluster
|
||||
results, err := ks.Scan(&cautils.ScanInfo{})
|
||||
"github.com/kubescape/kubescape/v3/core"
|
||||
"github.com/kubescape/kubescape/v3/core/cautils"
|
||||
)
|
||||
|
||||
// convert scan results to json
|
||||
jsonRes, err := results.ToJson()
|
||||
func main() {
|
||||
ctx := context.Background()
|
||||
|
||||
```
|
||||
// Initialize Kubescape
|
||||
ks := core.NewKubescape(ctx)
|
||||
|
||||
// Configure scan
|
||||
scanInfo := &cautils.ScanInfo{
|
||||
// Scan the current cluster
|
||||
ScanAll: true,
|
||||
}
|
||||
|
||||
// Run scan
|
||||
results, err := ks.Scan(scanInfo)
|
||||
if err != nil {
|
||||
log.Fatalf("Scan failed: %v", err)
|
||||
}
|
||||
|
||||
// Convert results to JSON
|
||||
jsonRes, err := results.ToJson()
|
||||
if err != nil {
|
||||
log.Fatalf("Failed to convert results: %v", err)
|
||||
}
|
||||
|
||||
fmt.Println(string(jsonRes))
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## API Reference
|
||||
|
||||
### Creating a Kubescape Instance
|
||||
|
||||
```go
|
||||
// Create with context
|
||||
ks := core.NewKubescape(ctx)
|
||||
```
|
||||
|
||||
### Scanning
|
||||
|
||||
```go
|
||||
// Scan with configuration
|
||||
results, err := ks.Scan(scanInfo)
|
||||
```
|
||||
|
||||
### Listing Frameworks and Controls
|
||||
|
||||
```go
|
||||
// List available policies
|
||||
err := ks.List(listPolicies)
|
||||
```
|
||||
|
||||
### Downloading Artifacts
|
||||
|
||||
```go
|
||||
// Download for offline use
|
||||
err := ks.Download(downloadInfo)
|
||||
```
|
||||
|
||||
### Image Scanning
|
||||
|
||||
```go
|
||||
// Scan container image
|
||||
exceedsSeverity, err := ks.ScanImage(imgScanInfo, scanInfo)
|
||||
```
|
||||
|
||||
### Fixing Misconfigurations
|
||||
|
||||
```go
|
||||
// Apply fixes to manifests
|
||||
err := ks.Fix(fixInfo)
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Examples
|
||||
|
||||
### Scan a Specific Framework
|
||||
|
||||
```go
|
||||
scanInfo := &cautils.ScanInfo{}
|
||||
scanInfo.SetPolicyIdentifiers([]string{"nsa"}, "framework")
|
||||
|
||||
results, err := ks.Scan(scanInfo)
|
||||
```
|
||||
|
||||
### Scan Specific Namespaces
|
||||
|
||||
```go
|
||||
scanInfo := &cautils.ScanInfo{
|
||||
IncludeNamespaces: "production,staging",
|
||||
}
|
||||
|
||||
results, err := ks.Scan(scanInfo)
|
||||
```
|
||||
|
||||
### Scan Local YAML Files
|
||||
|
||||
```go
|
||||
scanInfo := &cautils.ScanInfo{
|
||||
InputPatterns: []string{"/path/to/manifests"},
|
||||
}
|
||||
scanInfo.SetScanType(cautils.ScanTypeRepo)
|
||||
|
||||
results, err := ks.Scan(scanInfo)
|
||||
```
|
||||
|
||||
### Export Results to Different Formats
|
||||
|
||||
```go
|
||||
results, _ := ks.Scan(scanInfo)
|
||||
|
||||
// JSON
|
||||
jsonData, _ := results.ToJson()
|
||||
|
||||
// Get summary
|
||||
summary := results.GetData().Report.SummaryDetails
|
||||
fmt.Printf("Compliance Score: %.2f%%\n", summary.ComplianceScore)
|
||||
```
|
||||
|
||||
### Scan with Compliance Threshold
|
||||
|
||||
```go
|
||||
scanInfo := &cautils.ScanInfo{
|
||||
ComplianceThreshold: 80.0, // Fail if below 80%
|
||||
}
|
||||
|
||||
results, err := ks.Scan(scanInfo)
|
||||
if err != nil {
|
||||
// Handle scan failure
|
||||
}
|
||||
|
||||
// Check if threshold was exceeded
|
||||
if results.GetData().Report.SummaryDetails.ComplianceScore < scanInfo.ComplianceThreshold {
|
||||
log.Fatal("Compliance score below threshold")
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Configuration Options
|
||||
|
||||
### ScanInfo Fields
|
||||
|
||||
| Field | Type | Description |
|
||||
|-------|------|-------------|
|
||||
| `AccountID` | string | Kubescape SaaS account ID |
|
||||
| `AccessKey` | string | Kubescape SaaS access key |
|
||||
| `InputPatterns` | []string | Paths to scan (files, directories, URLs) |
|
||||
| `ExcludedNamespaces` | string | Comma-separated namespaces to exclude |
|
||||
| `IncludeNamespaces` | string | Comma-separated namespaces to include |
|
||||
| `Format` | string | Output format (json, junit, sarif, etc.) |
|
||||
| `Output` | string | Output file path |
|
||||
| `VerboseMode` | bool | Show all resources in output |
|
||||
| `FailThreshold` | float32 | Fail threshold percentage |
|
||||
| `ComplianceThreshold` | float32 | Compliance threshold percentage |
|
||||
| `UseExceptions` | string | Path to exceptions file |
|
||||
| `UseArtifactsFrom` | string | Path to offline artifacts |
|
||||
| `Submit` | bool | Submit results to SaaS |
|
||||
| `Local` | bool | Keep results local (don't submit) |
|
||||
|
||||
---
|
||||
|
||||
## Error Handling
|
||||
|
||||
```go
|
||||
results, err := ks.Scan(scanInfo)
|
||||
if err != nil {
|
||||
switch {
|
||||
case errors.Is(err, context.DeadlineExceeded):
|
||||
log.Fatal("Scan timed out")
|
||||
case errors.Is(err, context.Canceled):
|
||||
log.Fatal("Scan was canceled")
|
||||
default:
|
||||
log.Fatalf("Scan error: %v", err)
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Thread Safety
|
||||
|
||||
The Kubescape instance is safe for concurrent use. You can run multiple scans in parallel:
|
||||
|
||||
```go
|
||||
var wg sync.WaitGroup
|
||||
|
||||
for _, ns := range namespaces {
|
||||
wg.Add(1)
|
||||
go func(namespace string) {
|
||||
defer wg.Done()
|
||||
|
||||
scanInfo := &cautils.ScanInfo{
|
||||
IncludeNamespaces: namespace,
|
||||
}
|
||||
results, _ := ks.Scan(scanInfo)
|
||||
// Process results...
|
||||
}(ns)
|
||||
}
|
||||
|
||||
wg.Wait()
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Related Documentation
|
||||
|
||||
- [CLI Reference](../docs/cli-reference.md)
|
||||
- [Getting Started Guide](../docs/getting-started.md)
|
||||
- [Architecture](../docs/architecture.md)
|
||||
@@ -2,19 +2,25 @@ package cautils
|
||||
|
||||
import (
|
||||
"os"
|
||||
"runtime/debug"
|
||||
|
||||
"github.com/kubescape/backend/pkg/versioncheck"
|
||||
)
|
||||
|
||||
var BuildNumber string
|
||||
var Client string
|
||||
|
||||
func init() {
|
||||
if BuildNumber != "" {
|
||||
versioncheck.BuildNumber = BuildNumber
|
||||
} else {
|
||||
// Try to get version from build info (Go 1.24+ automatically populates this from VCS tags)
|
||||
if info, ok := debug.ReadBuildInfo(); ok && info.Main.Version != "" && info.Main.Version != "(devel)" {
|
||||
versioncheck.BuildNumber = info.Main.Version
|
||||
}
|
||||
|
||||
// Fallback to RELEASE environment variable
|
||||
if versioncheck.BuildNumber == "" {
|
||||
versioncheck.BuildNumber = os.Getenv("RELEASE")
|
||||
}
|
||||
|
||||
// Client is typically set via ldflags: -X "github.com/kubescape/kubescape/v3/core/cautils.Client=..."
|
||||
if Client != "" {
|
||||
versioncheck.Client = Client
|
||||
}
|
||||
|
||||
@@ -69,6 +69,7 @@ type OPASessionObj struct {
|
||||
TopWorkloadsByScore []reporthandling.IResource
|
||||
TemplateMapping map[string]MappingNodes // Map chart obj to template (only for rendering from path)
|
||||
TriggeredByCLI bool
|
||||
LabelsToCopy []string // Labels to copy from workloads to scan reports
|
||||
}
|
||||
|
||||
func NewOPASessionObj(ctx context.Context, frameworks []reporthandling.Framework, k8sResources K8SResources, scanInfo *ScanInfo) *OPASessionObj {
|
||||
@@ -87,6 +88,7 @@ func NewOPASessionObj(ctx context.Context, frameworks []reporthandling.Framework
|
||||
OmitRawResources: scanInfo.OmitRawResources,
|
||||
TriggeredByCLI: scanInfo.TriggeredByCLI,
|
||||
TemplateMapping: make(map[string]MappingNodes),
|
||||
LabelsToCopy: scanInfo.LabelsToCopy,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@ import (
|
||||
"github.com/kubescape/k8s-interface/workloadinterface"
|
||||
"github.com/kubescape/opa-utils/objectsenvelopes/localworkload"
|
||||
"sigs.k8s.io/kustomize/api/krusty"
|
||||
"sigs.k8s.io/kustomize/api/types"
|
||||
"sigs.k8s.io/kustomize/kyaml/filesys"
|
||||
)
|
||||
|
||||
@@ -75,7 +76,11 @@ func getKustomizeDirectoryName(path string) string {
|
||||
func (kd *KustomizeDirectory) GetWorkloads(kustomizeDirectoryPath string) (map[string][]workloadinterface.IMetadata, []error) {
|
||||
|
||||
fSys := filesys.MakeFsOnDisk()
|
||||
kustomizer := krusty.MakeKustomizer(krusty.MakeDefaultOptions())
|
||||
// Use LoadRestrictionsNone to allow loading resources from outside the kustomize directory.
|
||||
// This is necessary for overlays that reference base configurations in parent directories.
|
||||
opts := krusty.MakeDefaultOptions()
|
||||
opts.LoadRestrictions = types.LoadRestrictionsNone
|
||||
kustomizer := krusty.MakeKustomizer(opts)
|
||||
resmap, err := kustomizer.Run(fSys, kustomizeDirectoryPath)
|
||||
|
||||
if err != nil {
|
||||
|
||||
@@ -4,6 +4,8 @@ import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestGetKustomizeDirectoryName(t *testing.T) {
|
||||
@@ -61,3 +63,83 @@ func TestGetKustomizeDirectoryName(t *testing.T) {
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func kustomizeTestdataPath() string {
|
||||
o, _ := os.Getwd()
|
||||
return filepath.Join(o, "testdata", "kustomize")
|
||||
}
|
||||
|
||||
// TestKustomizeOverlayWithBase tests that kustomize overlays can properly load
|
||||
// resources from base directories. This is the main fix for issue #1617.
|
||||
func TestKustomizeOverlayWithBase(t *testing.T) {
|
||||
overlayPath := filepath.Join(kustomizeTestdataPath(), "overlays", "prod")
|
||||
|
||||
// Verify it's detected as a kustomize directory
|
||||
assert.True(t, isKustomizeDirectory(overlayPath), "overlay should be detected as kustomize directory")
|
||||
|
||||
// Create kustomize directory and get workloads
|
||||
kd := NewKustomizeDirectory(overlayPath)
|
||||
workloads, errs := kd.GetWorkloads(overlayPath)
|
||||
|
||||
// Should not have errors - this was failing before the fix because
|
||||
// overlays couldn't load resources from parent base directories
|
||||
assert.Empty(t, errs, "should not have errors loading overlay with base reference")
|
||||
|
||||
// Should have workloads from the rendered overlay
|
||||
assert.NotEmpty(t, workloads, "should have workloads from rendered kustomize overlay")
|
||||
|
||||
// The overlay should have produced exactly one deployment with the merged configuration
|
||||
var deploymentFound bool
|
||||
for _, wls := range workloads {
|
||||
for _, wl := range wls {
|
||||
if wl.GetKind() == "Deployment" && wl.GetName() == "test-app" {
|
||||
deploymentFound = true
|
||||
|
||||
// Verify the deployment has the resource limits from the base
|
||||
obj := wl.GetObject()
|
||||
spec, ok := obj["spec"].(map[string]interface{})
|
||||
assert.True(t, ok, "deployment should have spec")
|
||||
|
||||
template, ok := spec["template"].(map[string]interface{})
|
||||
assert.True(t, ok, "deployment should have template")
|
||||
|
||||
templateSpec, ok := template["spec"].(map[string]interface{})
|
||||
assert.True(t, ok, "template should have spec")
|
||||
|
||||
containers, ok := templateSpec["containers"].([]interface{})
|
||||
assert.True(t, ok, "template spec should have containers")
|
||||
assert.NotEmpty(t, containers, "should have at least one container")
|
||||
|
||||
container, ok := containers[0].(map[string]interface{})
|
||||
assert.True(t, ok, "container should be a map")
|
||||
|
||||
resources, ok := container["resources"].(map[string]interface{})
|
||||
assert.True(t, ok, "container should have resources (from base)")
|
||||
|
||||
limits, ok := resources["limits"].(map[string]interface{})
|
||||
assert.True(t, ok, "resources should have limits")
|
||||
assert.Equal(t, "500m", limits["cpu"], "cpu limit should be from base")
|
||||
assert.Equal(t, "256Mi", limits["memory"], "memory limit should be from base")
|
||||
|
||||
// Verify overlay modifications were applied
|
||||
replicas, ok := spec["replicas"].(int)
|
||||
assert.True(t, ok, "replicas should be an int")
|
||||
assert.Equal(t, 3, replicas, "replicas should be modified by overlay")
|
||||
}
|
||||
}
|
||||
}
|
||||
assert.True(t, deploymentFound, "deployment should be found in rendered output")
|
||||
}
|
||||
|
||||
// TestKustomizeBaseDirectory tests that base directories work on their own
|
||||
func TestKustomizeBaseDirectory(t *testing.T) {
|
||||
basePath := filepath.Join(kustomizeTestdataPath(), "base")
|
||||
|
||||
assert.True(t, isKustomizeDirectory(basePath), "base should be detected as kustomize directory")
|
||||
|
||||
kd := NewKustomizeDirectory(basePath)
|
||||
workloads, errs := kd.GetWorkloads(basePath)
|
||||
|
||||
assert.Empty(t, errs, "should not have errors loading base directory")
|
||||
assert.NotEmpty(t, workloads, "should have workloads from base directory")
|
||||
}
|
||||
|
||||
@@ -140,6 +140,7 @@ type ScanInfo struct {
|
||||
UseDefaultMatchers bool
|
||||
ChartPath string
|
||||
FilePath string
|
||||
LabelsToCopy []string // Labels to copy from workloads to scan reports
|
||||
scanningContext *ScanningContext
|
||||
cleanups []func()
|
||||
}
|
||||
@@ -321,6 +322,9 @@ func (scanInfo *ScanInfo) getScanningContext(input string) ScanningContext {
|
||||
return ContextCluster
|
||||
}
|
||||
|
||||
// Check if input is a URL (http:// or https://)
|
||||
isURL := isHTTPURL(input)
|
||||
|
||||
// git url
|
||||
if _, err := giturl.NewGitURL(input); err == nil {
|
||||
if repo, err := CloneGitRepo(&input); err == nil {
|
||||
@@ -331,6 +335,18 @@ func (scanInfo *ScanInfo) getScanningContext(input string) ScanningContext {
|
||||
return ContextGitRemote
|
||||
}
|
||||
}
|
||||
// If giturl.NewGitURL succeeded but cloning failed, the input is a git URL
|
||||
// that couldn't be cloned. Don't treat it as a local path.
|
||||
// The clone error was already logged by CloneGitRepo.
|
||||
// Return ContextDir to prevent the URL from being joined with the current directory
|
||||
// and to trigger a "no files found" error with the actual URL (not a mangled path).
|
||||
return ContextDir
|
||||
}
|
||||
|
||||
// If it looks like a URL but wasn't recognized as a git URL, still don't treat it as a local path
|
||||
if isURL {
|
||||
logger.L().Error("URL provided but not recognized as a valid git repository. Ensure the URL is correct and accessible", helpers.String("url", input))
|
||||
return ContextDir
|
||||
}
|
||||
|
||||
if !filepath.IsAbs(input) { // parse path
|
||||
@@ -456,3 +472,8 @@ func getAbsPath(p string) string {
|
||||
}
|
||||
return p
|
||||
}
|
||||
|
||||
// isHTTPURL checks if the input string is an HTTP or HTTPS URL
|
||||
func isHTTPURL(input string) bool {
|
||||
return strings.HasPrefix(input, "http://") || strings.HasPrefix(input, "https://")
|
||||
}
|
||||
|
||||
@@ -88,6 +88,16 @@ func TestGetScanningContext(t *testing.T) {
|
||||
input: os.TempDir(),
|
||||
want: ContextDir,
|
||||
},
|
||||
{
|
||||
name: "self-hosted GitLab URL that can't be cloned",
|
||||
input: "https://gitlab.private-domain.com/my-org/my-repo.git",
|
||||
want: ContextDir, // Should return ContextDir when clone fails, not try to treat as local path
|
||||
},
|
||||
{
|
||||
name: "http URL that can't be cloned",
|
||||
input: "http://gitlab.example.com/org/repo",
|
||||
want: ContextDir, // Should return ContextDir when clone fails, not try to treat as local path
|
||||
},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
|
||||
28
core/cautils/testdata/kustomize/base/deployment.yaml
vendored
Normal file
28
core/cautils/testdata/kustomize/base/deployment.yaml
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: test-app
|
||||
labels:
|
||||
app: test-app
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app: test-app
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: test-app
|
||||
spec:
|
||||
containers:
|
||||
- name: test-container
|
||||
image: nginx:1.19
|
||||
resources:
|
||||
limits:
|
||||
cpu: "500m"
|
||||
memory: "256Mi"
|
||||
requests:
|
||||
cpu: "100m"
|
||||
memory: "128Mi"
|
||||
ports:
|
||||
- containerPort: 80
|
||||
5
core/cautils/testdata/kustomize/base/kustomization.yaml
vendored
Normal file
5
core/cautils/testdata/kustomize/base/kustomization.yaml
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||
kind: Kustomization
|
||||
|
||||
resources:
|
||||
- deployment.yaml
|
||||
13
core/cautils/testdata/kustomize/overlays/prod/kustomization.yaml
vendored
Normal file
13
core/cautils/testdata/kustomize/overlays/prod/kustomization.yaml
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||
kind: Kustomization
|
||||
|
||||
resources:
|
||||
- ../../base
|
||||
|
||||
images:
|
||||
- name: nginx
|
||||
newTag: "1.21"
|
||||
|
||||
replicas:
|
||||
- name: test-app
|
||||
count: 3
|
||||
@@ -90,7 +90,11 @@ func getResourceHandler(ctx context.Context, scanInfo *cautils.ScanInfo, tenantC
|
||||
return resourcehandler.NewFileResourceHandler()
|
||||
}
|
||||
|
||||
getter.GetKSCloudAPIConnector()
|
||||
// Only initialize cloud connector if not in air-gapped mode
|
||||
// This call initializes the global cloud API connector for later use
|
||||
if !isAirGappedMode(scanInfo) {
|
||||
_ = getter.GetKSCloudAPIConnector()
|
||||
}
|
||||
rbacObjects := getRBACHandler(tenantConfig, k8s, scanInfo.Submit)
|
||||
return resourcehandler.NewK8sResourceHandler(k8s, hostSensorHandler, rbacObjects, tenantConfig.GetContextName())
|
||||
}
|
||||
|
||||
@@ -66,9 +66,11 @@ func getInterfaces(ctx context.Context, scanInfo *cautils.ScanInfo) componentInt
|
||||
}
|
||||
|
||||
// ================== version testing ======================================
|
||||
|
||||
v := versioncheck.NewIVersionCheckHandler(ctx)
|
||||
_ = v.CheckLatestVersion(ctx, versioncheck.NewVersionCheckRequest(scanInfo.AccountID, versioncheck.BuildNumber, policyIdentifierIdentities(scanInfo.PolicyIdentifier), "", string(scanInfo.GetScanningContext()), k8sClient))
|
||||
// Skip version check in air-gapped mode (when keep-local flag is set)
|
||||
if !scanInfo.Local {
|
||||
v := versioncheck.NewIVersionCheckHandler(ctx)
|
||||
_ = v.CheckLatestVersion(ctx, versioncheck.NewVersionCheckRequest(scanInfo.AccountID, versioncheck.BuildNumber, policyIdentifierIdentities(scanInfo.PolicyIdentifier), "", string(scanInfo.GetScanningContext()), k8sClient))
|
||||
}
|
||||
|
||||
// ================== setup host scanner object ======================================
|
||||
ctxHostScanner, spanHostScanner := otel.Tracer("").Start(ctx, "setup host scanner")
|
||||
@@ -132,7 +134,15 @@ func (ks *Kubescape) Scan(scanInfo *cautils.ScanInfo) (*resultshandling.ResultsH
|
||||
interfaces := getInterfaces(ctxInit, scanInfo)
|
||||
interfaces.report.SetTenantConfig(interfaces.tenantConfig)
|
||||
|
||||
downloadReleasedPolicy := getter.NewDownloadReleasedPolicy() // download config inputs from github release
|
||||
// Only create DownloadReleasedPolicy if not in air-gapped mode
|
||||
var downloadReleasedPolicy *getter.DownloadReleasedPolicy
|
||||
if isAirGappedMode(scanInfo) {
|
||||
// In air-gapped mode (--keep-local or using local files via --use-from, --controls-config, --exceptions, or attack tracks),
|
||||
// don't initialize the downloader to prevent network access
|
||||
downloadReleasedPolicy = nil
|
||||
} else {
|
||||
downloadReleasedPolicy = getter.NewDownloadReleasedPolicy() // download config inputs from github release
|
||||
}
|
||||
|
||||
// set policy getter only after setting the customerGUID
|
||||
scanInfo.Getters.PolicyGetter = getPolicyGetter(ctxInit, scanInfo.UseFrom, interfaces.tenantConfig.GetAccountID(), scanInfo.FrameworkScan, downloadReleasedPolicy)
|
||||
@@ -274,3 +284,13 @@ func scanSingleImage(ctx context.Context, img string, svc *imagescan.Service, re
|
||||
func isPrioritizationScanType(scanType cautils.ScanTypes) bool {
|
||||
return scanType == cautils.ScanTypeCluster || scanType == cautils.ScanTypeRepo
|
||||
}
|
||||
|
||||
// isAirGappedMode returns true if the scan is configured to run in air-gapped mode
|
||||
// (i.e., without any network access to download policies, exceptions, or other artifacts)
|
||||
func isAirGappedMode(scanInfo *cautils.ScanInfo) bool {
|
||||
return scanInfo.Local ||
|
||||
len(scanInfo.UseFrom) > 0 ||
|
||||
scanInfo.ControlsInputs != "" ||
|
||||
scanInfo.UseExceptions != "" ||
|
||||
scanInfo.AttackTracks != ""
|
||||
}
|
||||
|
||||
@@ -58,3 +58,66 @@ func TestIsPrioritizationScanType(t *testing.T) {
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestIsAirGappedMode(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
scanInfo *cautils.ScanInfo
|
||||
want bool
|
||||
}{
|
||||
{
|
||||
name: "air-gapped with Local flag",
|
||||
scanInfo: &cautils.ScanInfo{
|
||||
Local: true,
|
||||
},
|
||||
want: true,
|
||||
},
|
||||
{
|
||||
name: "air-gapped with UseFrom",
|
||||
scanInfo: &cautils.ScanInfo{
|
||||
UseFrom: []string{"/path/to/policy"},
|
||||
},
|
||||
want: true,
|
||||
},
|
||||
{
|
||||
name: "air-gapped with ControlsInputs",
|
||||
scanInfo: &cautils.ScanInfo{
|
||||
ControlsInputs: "/path/to/controls",
|
||||
},
|
||||
want: true,
|
||||
},
|
||||
{
|
||||
name: "air-gapped with UseExceptions",
|
||||
scanInfo: &cautils.ScanInfo{
|
||||
UseExceptions: "/path/to/exceptions",
|
||||
},
|
||||
want: true,
|
||||
},
|
||||
{
|
||||
name: "air-gapped with AttackTracks",
|
||||
scanInfo: &cautils.ScanInfo{
|
||||
AttackTracks: "/path/to/attack-tracks",
|
||||
},
|
||||
want: true,
|
||||
},
|
||||
{
|
||||
name: "not air-gapped - all empty",
|
||||
scanInfo: &cautils.ScanInfo{},
|
||||
want: false,
|
||||
},
|
||||
{
|
||||
name: "air-gapped with multiple flags",
|
||||
scanInfo: &cautils.ScanInfo{
|
||||
Local: true,
|
||||
UseFrom: []string{"/path/to/policy"},
|
||||
},
|
||||
want: true,
|
||||
},
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
assert.Equal(t, tt.want, isAirGappedMode(tt.scanInfo))
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,7 +37,6 @@ spec:
|
||||
allowPrivilegeEscalation: true
|
||||
privileged: true
|
||||
readOnlyRootFilesystem: true
|
||||
procMount: Unmasked
|
||||
ports:
|
||||
- name: scanner # Do not change port name
|
||||
containerPort: 7888
|
||||
|
||||
@@ -37,7 +37,6 @@ spec:
|
||||
allowPrivilegeEscalation: true
|
||||
privileged: true
|
||||
readOnlyRootFilesystem: true
|
||||
procMount: Unmasked
|
||||
ports:
|
||||
- name: scanner # Do not change port name
|
||||
containerPort: 7888
|
||||
|
||||
@@ -4,7 +4,7 @@ import (
|
||||
"context"
|
||||
|
||||
"github.com/google/go-containerregistry/pkg/name"
|
||||
"github.com/sigstore/cosign/v2/pkg/cosign"
|
||||
"github.com/sigstore/cosign/v3/pkg/cosign"
|
||||
)
|
||||
|
||||
func has_signature(img string) bool {
|
||||
|
||||
@@ -6,12 +6,12 @@ import (
|
||||
"fmt"
|
||||
|
||||
"github.com/google/go-containerregistry/pkg/name"
|
||||
"github.com/sigstore/cosign/v2/cmd/cosign/cli/options"
|
||||
"github.com/sigstore/cosign/v2/cmd/cosign/cli/sign"
|
||||
"github.com/sigstore/cosign/v2/pkg/cosign"
|
||||
"github.com/sigstore/cosign/v2/pkg/cosign/pkcs11key"
|
||||
ociremote "github.com/sigstore/cosign/v2/pkg/oci/remote"
|
||||
sigs "github.com/sigstore/cosign/v2/pkg/signature"
|
||||
"github.com/sigstore/cosign/v3/cmd/cosign/cli/options"
|
||||
"github.com/sigstore/cosign/v3/cmd/cosign/cli/sign"
|
||||
"github.com/sigstore/cosign/v3/pkg/cosign"
|
||||
"github.com/sigstore/cosign/v3/pkg/cosign/pkcs11key"
|
||||
ociremote "github.com/sigstore/cosign/v3/pkg/oci/remote"
|
||||
sigs "github.com/sigstore/cosign/v3/pkg/signature"
|
||||
)
|
||||
|
||||
// VerifyCommand verifies a signature on a supplied container image
|
||||
|
||||
@@ -120,7 +120,12 @@ func printConfigurationsScanning(opaSessionObj *cautils.OPASessionObj, imageScan
|
||||
opaSessionObj.Report.SummaryDetails.Vulnerabilities.Images = imageScanSummary.Images
|
||||
}
|
||||
|
||||
r, err := json.Marshal(FinalizeResults(opaSessionObj))
|
||||
// Convert to PostureReportWithSeverity to add severity field to controls
|
||||
// and extract specified labels from workloads
|
||||
finalizedReport := FinalizeResults(opaSessionObj)
|
||||
reportWithSeverity := ConvertToPostureReportWithSeverityAndLabels(finalizedReport, opaSessionObj.LabelsToCopy, opaSessionObj.AllResources)
|
||||
|
||||
r, err := json.Marshal(reportWithSeverity)
|
||||
_, err = jp.writer.Write(r)
|
||||
|
||||
return err
|
||||
|
||||
@@ -7,6 +7,8 @@ import (
|
||||
|
||||
"github.com/kubescape/kubescape/v3/core/pkg/resultshandling/printer/v2/prettyprinter/tableprinter/imageprinter"
|
||||
"github.com/kubescape/opa-utils/reporthandling/results/v1/reportsummary"
|
||||
"github.com/kubescape/opa-utils/reporthandling/results/v1/resourcesresults"
|
||||
reporthandlingv2 "github.com/kubescape/opa-utils/reporthandling/v2"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
@@ -192,3 +194,154 @@ func TestConvertToReportSummary(t *testing.T) {
|
||||
|
||||
assert.Equal(t, want, got)
|
||||
}
|
||||
|
||||
func TestEnrichControlsWithSeverity(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
scoreFactor float32
|
||||
wantSeverity string
|
||||
}{
|
||||
{
|
||||
name: "Critical severity",
|
||||
scoreFactor: 9.0,
|
||||
wantSeverity: "Critical",
|
||||
},
|
||||
{
|
||||
name: "High severity",
|
||||
scoreFactor: 8.0,
|
||||
wantSeverity: "High",
|
||||
},
|
||||
{
|
||||
name: "Medium severity",
|
||||
scoreFactor: 6.0,
|
||||
wantSeverity: "Medium",
|
||||
},
|
||||
{
|
||||
name: "Low severity",
|
||||
scoreFactor: 3.0,
|
||||
wantSeverity: "Low",
|
||||
},
|
||||
{
|
||||
name: "Unknown severity",
|
||||
scoreFactor: 0.0,
|
||||
wantSeverity: "Unknown",
|
||||
},
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
controls := reportsummary.ControlSummaries{
|
||||
"C-0001": reportsummary.ControlSummary{
|
||||
ControlID: "C-0001",
|
||||
Name: "Test Control",
|
||||
ScoreFactor: tt.scoreFactor,
|
||||
},
|
||||
}
|
||||
|
||||
enrichedControls := enrichControlsWithSeverity(controls)
|
||||
|
||||
assert.Equal(t, 1, len(enrichedControls))
|
||||
assert.Equal(t, tt.wantSeverity, enrichedControls["C-0001"].Severity)
|
||||
assert.Equal(t, "Test Control", enrichedControls["C-0001"].Name)
|
||||
assert.Equal(t, tt.scoreFactor, enrichedControls["C-0001"].ScoreFactor)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestConvertToPostureReportWithSeverity(t *testing.T) {
|
||||
// Create a mock PostureReport with controls having different severity levels
|
||||
mockReport := reportsummary.MockSummaryDetails()
|
||||
|
||||
// Get the controls from mock data
|
||||
controls := mockReport.Controls
|
||||
|
||||
// Create a minimal PostureReport
|
||||
report := &reporthandlingv2.PostureReport{
|
||||
SummaryDetails: *mockReport,
|
||||
}
|
||||
|
||||
// Convert to PostureReportWithSeverity
|
||||
reportWithSeverity := ConvertToPostureReportWithSeverity(report)
|
||||
|
||||
// Verify controls have severity field
|
||||
assert.NotNil(t, reportWithSeverity)
|
||||
assert.NotNil(t, reportWithSeverity.SummaryDetails.Controls)
|
||||
|
||||
// Verify each control in the original report has a corresponding enriched control with severity
|
||||
for controlID, control := range controls {
|
||||
enrichedControl, exists := reportWithSeverity.SummaryDetails.Controls[controlID]
|
||||
assert.True(t, exists, "Control %s should exist in enriched controls", controlID)
|
||||
assert.NotEmpty(t, enrichedControl.Severity, "Severity should not be empty for control %s", controlID)
|
||||
assert.Equal(t, control.ControlID, enrichedControl.ControlID, "Control ID should match")
|
||||
assert.Equal(t, control.ScoreFactor, enrichedControl.ScoreFactor, "ScoreFactor should match")
|
||||
}
|
||||
}
|
||||
|
||||
func TestConvertToPostureReportWithSeverityNilCheck(t *testing.T) {
|
||||
// Test that nil report returns nil
|
||||
result := ConvertToPostureReportWithSeverity(nil)
|
||||
assert.Nil(t, result, "Converting nil report should return nil")
|
||||
}
|
||||
|
||||
func TestEnrichResultsWithSeverity(t *testing.T) {
|
||||
// Create mock control summaries
|
||||
controlSummaries := reportsummary.ControlSummaries{
|
||||
"C-0001": reportsummary.ControlSummary{
|
||||
ControlID: "C-0001",
|
||||
Name: "Test Control High",
|
||||
ScoreFactor: 8.0,
|
||||
},
|
||||
"C-0002": reportsummary.ControlSummary{
|
||||
ControlID: "C-0002",
|
||||
Name: "Test Control Medium",
|
||||
ScoreFactor: 6.0,
|
||||
},
|
||||
}
|
||||
|
||||
// Create mock results with associated controls
|
||||
results := []resourcesresults.Result{
|
||||
{
|
||||
ResourceID: "test-resource-1",
|
||||
AssociatedControls: []resourcesresults.ResourceAssociatedControl{
|
||||
{
|
||||
ControlID: "C-0001",
|
||||
Name: "Test Control High",
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
ResourceID: "test-resource-2",
|
||||
AssociatedControls: []resourcesresults.ResourceAssociatedControl{
|
||||
{
|
||||
ControlID: "C-0002",
|
||||
Name: "Test Control Medium",
|
||||
},
|
||||
{
|
||||
ControlID: "C-0003", // Not in control summaries
|
||||
Name: "Unknown Control",
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
// Enrich results with severity
|
||||
enrichedResults := enrichResultsWithSeverity(results, controlSummaries)
|
||||
|
||||
// Verify results structure
|
||||
assert.Equal(t, 2, len(enrichedResults))
|
||||
|
||||
// Verify first result
|
||||
assert.Equal(t, "test-resource-1", enrichedResults[0].ResourceID)
|
||||
assert.Equal(t, 1, len(enrichedResults[0].AssociatedControls))
|
||||
assert.Equal(t, "High", enrichedResults[0].AssociatedControls[0].Severity)
|
||||
assert.Equal(t, "C-0001", enrichedResults[0].AssociatedControls[0].ControlID)
|
||||
|
||||
// Verify second result
|
||||
assert.Equal(t, "test-resource-2", enrichedResults[1].ResourceID)
|
||||
assert.Equal(t, 2, len(enrichedResults[1].AssociatedControls))
|
||||
assert.Equal(t, "Medium", enrichedResults[1].AssociatedControls[0].Severity)
|
||||
assert.Equal(t, "C-0002", enrichedResults[1].AssociatedControls[0].ControlID)
|
||||
// Verify unknown control gets "Unknown" severity
|
||||
assert.Equal(t, "Unknown", enrichedResults[1].AssociatedControls[1].Severity)
|
||||
assert.Equal(t, "C-0003", enrichedResults[1].AssociatedControls[1].ControlID)
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
docsPrefix = "https://kubescape.io/docs"
|
||||
docsPrefix = "https://kubescape.io/docs/controls"
|
||||
scanControlPrefix = "$ kubescape scan control"
|
||||
controlNameHeader = "Control name"
|
||||
statusHeader = ""
|
||||
|
||||
@@ -102,7 +102,7 @@ func TestGenerateCategoryStatusRow(t *testing.T) {
|
||||
Status: apis.StatusFailed,
|
||||
ControlID: "ctrlID",
|
||||
},
|
||||
expectedRows: table.Row{"❌", "test", "https://kubescape.io/docs/ctrlid"},
|
||||
expectedRows: table.Row{"❌", "test", "https://kubescape.io/docs/controls/ctrlid"},
|
||||
},
|
||||
{
|
||||
name: "skipped control",
|
||||
@@ -114,7 +114,7 @@ func TestGenerateCategoryStatusRow(t *testing.T) {
|
||||
},
|
||||
ControlID: "ctrlID",
|
||||
},
|
||||
expectedRows: table.Row{"⚠️", "test", "https://kubescape.io/docs/ctrlid"},
|
||||
expectedRows: table.Row{"⚠️", "test", "https://kubescape.io/docs/controls/ctrlid"},
|
||||
infoToPrintInfo: []utils.InfoStars{
|
||||
{
|
||||
Info: "testInfo",
|
||||
@@ -129,7 +129,7 @@ func TestGenerateCategoryStatusRow(t *testing.T) {
|
||||
Status: apis.StatusPassed,
|
||||
ControlID: "ctrlID",
|
||||
},
|
||||
expectedRows: table.Row{"✅", "test", "https://kubescape.io/docs/ctrlid"},
|
||||
expectedRows: table.Row{"✅", "test", "https://kubescape.io/docs/controls/ctrlid"},
|
||||
},
|
||||
{
|
||||
name: "big name",
|
||||
@@ -138,7 +138,7 @@ func TestGenerateCategoryStatusRow(t *testing.T) {
|
||||
Status: apis.StatusFailed,
|
||||
ControlID: "ctrlID",
|
||||
},
|
||||
expectedRows: table.Row{"❌", "testtesttesttesttesttesttesttesttesttesttesttestte...", "https://kubescape.io/docs/ctrlid"},
|
||||
expectedRows: table.Row{"❌", "testtesttesttesttesttesttesttesttesttesttesttestte...", "https://kubescape.io/docs/controls/ctrlid"},
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
@@ -542,14 +542,14 @@ func TestGetDocsForControl(t *testing.T) {
|
||||
controlSummary: &reportsummary.ControlSummary{
|
||||
ControlID: "ctrlID1",
|
||||
},
|
||||
expectedDocsLink: "https://kubescape.io/docs/ctrlid1",
|
||||
expectedDocsLink: "https://kubescape.io/docs/controls/ctrlid1",
|
||||
},
|
||||
{
|
||||
name: "control with lowercase ID",
|
||||
controlSummary: &reportsummary.ControlSummary{
|
||||
ControlID: "ctrlid1",
|
||||
},
|
||||
expectedDocsLink: "https://kubescape.io/docs/ctrlid1",
|
||||
expectedDocsLink: "https://kubescape.io/docs/controls/ctrlid1",
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
@@ -144,14 +144,23 @@ func CheckShortTerminalWidth(rows []table.Row, headers table.Row) bool {
|
||||
for _, row := range rows {
|
||||
rowWidth := 0
|
||||
for idx, cell := range row {
|
||||
cellLen := len(cell.(string))
|
||||
cellStr, ok := cell.(string)
|
||||
if !ok {
|
||||
// If cell is not a string, skip this calculation
|
||||
continue
|
||||
}
|
||||
cellLen := len(cellStr)
|
||||
if cellLen > 50 { // Take only 50 characters of each sentence for counting size
|
||||
cellLen = 50
|
||||
}
|
||||
if cellLen > len(headers[idx].(string)) {
|
||||
headerStr, ok := headers[idx].(string)
|
||||
if !ok {
|
||||
// If header is not a string, use cell length
|
||||
rowWidth += cellLen
|
||||
} else if cellLen > len(headerStr) {
|
||||
rowWidth += cellLen
|
||||
} else {
|
||||
rowWidth += len(headers[idx].(string))
|
||||
rowWidth += len(headerStr)
|
||||
}
|
||||
rowWidth += 2
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import (
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
"github.com/jedib0t/go-pretty/v6/table"
|
||||
"github.com/jwalton/gchalk"
|
||||
"github.com/kubescape/opa-utils/reporthandling/apis"
|
||||
"github.com/stretchr/testify/assert"
|
||||
@@ -334,3 +335,69 @@ func TestGetColorForVulnerabilitySeverity(t *testing.T) {
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestCheckShortTerminalWidth(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
rows []table.Row
|
||||
headers table.Row
|
||||
// We can't predict the exact result since it depends on terminal size
|
||||
// but we can test it doesn't panic with various inputs
|
||||
shouldNotPanic bool
|
||||
}{
|
||||
{
|
||||
name: "Normal string rows",
|
||||
rows: []table.Row{
|
||||
{"cell1", "cell2", "cell3"},
|
||||
{"longer cell 1", "longer cell 2", "longer cell 3"},
|
||||
},
|
||||
headers: table.Row{"Header1", "Header2", "Header3"},
|
||||
shouldNotPanic: true,
|
||||
},
|
||||
{
|
||||
name: "Rows with non-string values (map)",
|
||||
rows: []table.Row{
|
||||
{"cell1", map[string]interface{}{"key": "value"}, "cell3"},
|
||||
{"cell4", "cell5", "cell6"},
|
||||
},
|
||||
headers: table.Row{"Header1", "Header2", "Header3"},
|
||||
shouldNotPanic: true,
|
||||
},
|
||||
{
|
||||
name: "Headers with non-string values",
|
||||
rows: []table.Row{
|
||||
{"cell1", "cell2", "cell3"},
|
||||
},
|
||||
headers: table.Row{"Header1", map[string]interface{}{"key": "value"}, "Header3"},
|
||||
shouldNotPanic: true,
|
||||
},
|
||||
{
|
||||
name: "Both rows and headers with non-string values",
|
||||
rows: []table.Row{
|
||||
{map[string]interface{}{"key": "value"}, "cell2", 123},
|
||||
},
|
||||
headers: table.Row{[]string{"a", "b"}, "Header2", true},
|
||||
shouldNotPanic: true,
|
||||
},
|
||||
{
|
||||
name: "Empty rows",
|
||||
rows: []table.Row{},
|
||||
headers: table.Row{"Header1", "Header2"},
|
||||
shouldNotPanic: true,
|
||||
},
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
defer func() {
|
||||
if r := recover(); r != nil {
|
||||
if tt.shouldNotPanic {
|
||||
t.Errorf("CheckShortTerminalWidth() panicked when it shouldn't: %v", r)
|
||||
}
|
||||
}
|
||||
}()
|
||||
// Call the function - we just want to ensure it doesn't panic
|
||||
_ = CheckShortTerminalWidth(tt.rows, tt.headers)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -199,7 +199,7 @@ func (sp *SARIFPrinter) printConfigurationScan(ctx context.Context, opaSessionOb
|
||||
filepath := resourceSource.RelativePath
|
||||
|
||||
// Github Code Scanning considers results not associated to a file path meaningless and invalid when uploading
|
||||
if filepath == "" || basePath == "" {
|
||||
if filepath == "" && basePath == "" {
|
||||
continue
|
||||
}
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@ import (
|
||||
"github.com/kubescape/kubescape/v3/core/pkg/resultshandling/printer/v2/prettyprinter/tableprinter/imageprinter"
|
||||
"github.com/kubescape/kubescape/v3/core/pkg/resultshandling/printer/v2/prettyprinter/tableprinter/utils"
|
||||
"github.com/kubescape/opa-utils/reporthandling"
|
||||
"github.com/kubescape/opa-utils/reporthandling/apis"
|
||||
"github.com/kubescape/opa-utils/reporthandling/results/v1/prioritization"
|
||||
"github.com/kubescape/opa-utils/reporthandling/results/v1/reportsummary"
|
||||
"github.com/kubescape/opa-utils/reporthandling/results/v1/resourcesresults"
|
||||
@@ -16,6 +17,168 @@ import (
|
||||
|
||||
const indicator = "†"
|
||||
|
||||
// ControlSummaryWithSeverity wraps ControlSummary to add severity field for JSON output
|
||||
type ControlSummaryWithSeverity struct {
|
||||
reportsummary.ControlSummary
|
||||
Severity string `json:"severity"`
|
||||
}
|
||||
|
||||
// ResourceAssociatedControlWithSeverity wraps ResourceAssociatedControl to add severity field
|
||||
type ResourceAssociatedControlWithSeverity struct {
|
||||
resourcesresults.ResourceAssociatedControl
|
||||
Severity string `json:"severity"`
|
||||
}
|
||||
|
||||
// ResultWithSeverity wraps Result to include severity in associated controls
|
||||
type ResultWithSeverity struct {
|
||||
ResourceID string `json:"resourceID"`
|
||||
AssociatedControls []ResourceAssociatedControlWithSeverity `json:"controls,omitempty"`
|
||||
PrioritizedResource *prioritization.PrioritizedResource `json:"prioritizedResource,omitempty"`
|
||||
}
|
||||
|
||||
// SummaryDetailsWithSeverity wraps SummaryDetails to include enriched controls
|
||||
type SummaryDetailsWithSeverity struct {
|
||||
Controls map[string]ControlSummaryWithSeverity `json:"controls,omitempty"`
|
||||
Status apis.ScanningStatus `json:"status"`
|
||||
Frameworks []reportsummary.FrameworkSummary `json:"frameworks"`
|
||||
ResourcesSeverityCounters reportsummary.SeverityCounters `json:"resourcesSeverityCounters,omitempty"`
|
||||
ControlsSeverityCounters reportsummary.SeverityCounters `json:"controlsSeverityCounters,omitempty"`
|
||||
StatusCounters reportsummary.StatusCounters `json:"ResourceCounters"`
|
||||
Vulnerabilities reportsummary.VulnerabilitySummary `json:"vulnerabilities,omitempty"`
|
||||
Score float32 `json:"score"`
|
||||
ComplianceScore float32 `json:"complianceScore"`
|
||||
}
|
||||
|
||||
// PostureReportWithSeverity wraps PostureReport to include severity in controls
|
||||
type PostureReportWithSeverity struct {
|
||||
ReportGenerationTime string `json:"generationTime"`
|
||||
ClusterAPIServerInfo interface{} `json:"clusterAPIServerInfo"`
|
||||
ClusterCloudProvider string `json:"clusterCloudProvider"`
|
||||
CustomerGUID string `json:"customerGUID"`
|
||||
ClusterName string `json:"clusterName"`
|
||||
SummaryDetails SummaryDetailsWithSeverity `json:"summaryDetails,omitempty"`
|
||||
Resources []reporthandling.Resource `json:"resources,omitempty"`
|
||||
Attributes []reportsummary.PostureAttributes `json:"attributes"`
|
||||
Results []ResultWithSeverity `json:"results,omitempty"`
|
||||
Metadata reporthandlingv2.Metadata `json:"metadata,omitempty"`
|
||||
ResourceLabels map[string]map[string]string `json:"resourceLabels,omitempty"` // map[resourceID]map[labelKey]labelValue - extracted labels from workloads
|
||||
}
|
||||
|
||||
// enrichControlsWithSeverity adds severity field to controls based on scoreFactor
|
||||
func enrichControlsWithSeverity(controls reportsummary.ControlSummaries) map[string]ControlSummaryWithSeverity {
|
||||
enrichedControls := make(map[string]ControlSummaryWithSeverity)
|
||||
for controlID, control := range controls {
|
||||
enrichedControl := ControlSummaryWithSeverity{
|
||||
ControlSummary: control,
|
||||
Severity: apis.ControlSeverityToString(control.GetScoreFactor()),
|
||||
}
|
||||
enrichedControls[controlID] = enrichedControl
|
||||
}
|
||||
return enrichedControls
|
||||
}
|
||||
|
||||
// enrichResultsWithSeverity adds severity field to controls in results
|
||||
func enrichResultsWithSeverity(results []resourcesresults.Result, controlSummaries reportsummary.ControlSummaries) []ResultWithSeverity {
|
||||
enrichedResults := make([]ResultWithSeverity, len(results))
|
||||
for i, result := range results {
|
||||
enrichedControls := make([]ResourceAssociatedControlWithSeverity, len(result.AssociatedControls))
|
||||
for j, control := range result.AssociatedControls {
|
||||
// Get the severity from the control summary
|
||||
severity := "Unknown"
|
||||
if controlSummary, exists := controlSummaries[control.GetID()]; exists {
|
||||
severity = apis.ControlSeverityToString(controlSummary.GetScoreFactor())
|
||||
}
|
||||
enrichedControls[j] = ResourceAssociatedControlWithSeverity{
|
||||
ResourceAssociatedControl: control,
|
||||
Severity: severity,
|
||||
}
|
||||
}
|
||||
enrichedResults[i] = ResultWithSeverity{
|
||||
ResourceID: result.ResourceID,
|
||||
AssociatedControls: enrichedControls,
|
||||
PrioritizedResource: result.PrioritizedResource,
|
||||
}
|
||||
}
|
||||
return enrichedResults
|
||||
}
|
||||
|
||||
// ConvertToPostureReportWithSeverity converts PostureReport to PostureReportWithSeverity
|
||||
func ConvertToPostureReportWithSeverity(report *reporthandlingv2.PostureReport) *PostureReportWithSeverity {
|
||||
return ConvertToPostureReportWithSeverityAndLabels(report, nil, nil)
|
||||
}
|
||||
|
||||
// ConvertToPostureReportWithSeverityAndLabels converts PostureReport to PostureReportWithSeverity
|
||||
// and extracts specified labels from workloads
|
||||
func ConvertToPostureReportWithSeverityAndLabels(report *reporthandlingv2.PostureReport, labelsToCopy []string, allResources map[string]workloadinterface.IMetadata) *PostureReportWithSeverity {
|
||||
if report == nil {
|
||||
return nil
|
||||
}
|
||||
enrichedControls := enrichControlsWithSeverity(report.SummaryDetails.Controls)
|
||||
enrichedResults := enrichResultsWithSeverity(report.Results, report.SummaryDetails.Controls)
|
||||
|
||||
// Extract labels from resources if labelsToCopy is specified
|
||||
var resourceLabels map[string]map[string]string
|
||||
if len(labelsToCopy) > 0 && allResources != nil {
|
||||
resourceLabels = extractResourceLabels(allResources, labelsToCopy)
|
||||
}
|
||||
|
||||
return &PostureReportWithSeverity{
|
||||
ReportGenerationTime: report.ReportGenerationTime.Format("2006-01-02T15:04:05Z07:00"),
|
||||
ClusterAPIServerInfo: report.ClusterAPIServerInfo,
|
||||
ClusterCloudProvider: report.ClusterCloudProvider,
|
||||
CustomerGUID: report.CustomerGUID,
|
||||
ClusterName: report.ClusterName,
|
||||
SummaryDetails: SummaryDetailsWithSeverity{
|
||||
Controls: enrichedControls,
|
||||
Status: report.SummaryDetails.Status,
|
||||
Frameworks: report.SummaryDetails.Frameworks,
|
||||
ResourcesSeverityCounters: report.SummaryDetails.ResourcesSeverityCounters,
|
||||
ControlsSeverityCounters: report.SummaryDetails.ControlsSeverityCounters,
|
||||
StatusCounters: report.SummaryDetails.StatusCounters,
|
||||
Vulnerabilities: report.SummaryDetails.Vulnerabilities,
|
||||
Score: report.SummaryDetails.Score,
|
||||
ComplianceScore: report.SummaryDetails.ComplianceScore,
|
||||
},
|
||||
Resources: report.Resources,
|
||||
Attributes: report.Attributes,
|
||||
Results: enrichedResults,
|
||||
Metadata: report.Metadata,
|
||||
ResourceLabels: resourceLabels,
|
||||
}
|
||||
}
|
||||
|
||||
// extractResourceLabels extracts specified labels from all resources
|
||||
func extractResourceLabels(allResources map[string]workloadinterface.IMetadata, labelsToCopy []string) map[string]map[string]string {
|
||||
resourceLabels := make(map[string]map[string]string)
|
||||
|
||||
for resourceID, resource := range allResources {
|
||||
// IMetadata doesn't have GetLabels, need to cast to IBasicWorkload
|
||||
basicWorkload, ok := resource.(workloadinterface.IBasicWorkload)
|
||||
if !ok {
|
||||
continue
|
||||
}
|
||||
|
||||
labels := basicWorkload.GetLabels()
|
||||
if labels == nil {
|
||||
continue
|
||||
}
|
||||
|
||||
extractedLabels := make(map[string]string)
|
||||
for _, labelKey := range labelsToCopy {
|
||||
if value, exists := labels[labelKey]; exists {
|
||||
extractedLabels[labelKey] = value
|
||||
}
|
||||
}
|
||||
|
||||
// Only add to result if at least one label was found
|
||||
if len(extractedLabels) > 0 {
|
||||
resourceLabels[resourceID] = extractedLabels
|
||||
}
|
||||
}
|
||||
|
||||
return resourceLabels
|
||||
}
|
||||
|
||||
// FinalizeResults finalize the results objects by copying data from map to lists
|
||||
func FinalizeResults(data *cautils.OPASessionObj) *reporthandlingv2.PostureReport {
|
||||
report := reporthandlingv2.PostureReport{
|
||||
|
||||
@@ -1,12 +1,14 @@
|
||||
package printer
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"testing"
|
||||
|
||||
v5 "github.com/anchore/grype/grype/db/v5"
|
||||
"github.com/anchore/grype/grype/match"
|
||||
"github.com/anchore/grype/grype/pkg"
|
||||
"github.com/anchore/grype/grype/vulnerability"
|
||||
"github.com/kubescape/k8s-interface/workloadinterface"
|
||||
"github.com/kubescape/kubescape/v3/core/pkg/resultshandling/printer/v2/prettyprinter/tableprinter/imageprinter"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
@@ -742,3 +744,131 @@ func TestSetSeverityToSummaryMap(t *testing.T) {
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func createWorkloadWithLabels(name, namespace string, labels map[string]string) workloadinterface.IMetadata {
|
||||
// Convert labels to map[string]interface{} for JSON marshaling
|
||||
labelsInterface := make(map[string]interface{})
|
||||
for k, v := range labels {
|
||||
labelsInterface[k] = v
|
||||
}
|
||||
|
||||
obj := map[string]interface{}{
|
||||
"apiVersion": "apps/v1",
|
||||
"kind": "Deployment",
|
||||
"metadata": map[string]interface{}{
|
||||
"name": name,
|
||||
"namespace": namespace,
|
||||
"labels": labelsInterface,
|
||||
},
|
||||
"spec": map[string]interface{}{
|
||||
"template": map[string]interface{}{
|
||||
"spec": map[string]interface{}{
|
||||
"containers": []interface{}{},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
objBytes, _ := json.Marshal(obj)
|
||||
workload, _ := workloadinterface.NewWorkload(objBytes)
|
||||
return workload
|
||||
}
|
||||
|
||||
func TestExtractResourceLabels(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
allResources map[string]workloadinterface.IMetadata
|
||||
labelsToCopy []string
|
||||
want map[string]map[string]string
|
||||
}{
|
||||
{
|
||||
name: "empty resources",
|
||||
allResources: map[string]workloadinterface.IMetadata{},
|
||||
labelsToCopy: []string{"app", "team"},
|
||||
want: map[string]map[string]string{},
|
||||
},
|
||||
{
|
||||
name: "empty labels to copy",
|
||||
allResources: map[string]workloadinterface.IMetadata{},
|
||||
labelsToCopy: []string{},
|
||||
want: map[string]map[string]string{},
|
||||
},
|
||||
{
|
||||
name: "single resource with matching labels",
|
||||
allResources: map[string]workloadinterface.IMetadata{
|
||||
"resource-1": createWorkloadWithLabels("test-deploy", "default", map[string]string{
|
||||
"app": "myapp",
|
||||
"team": "platform",
|
||||
"version": "v1",
|
||||
}),
|
||||
},
|
||||
labelsToCopy: []string{"app", "team"},
|
||||
want: map[string]map[string]string{
|
||||
"resource-1": {
|
||||
"app": "myapp",
|
||||
"team": "platform",
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "single resource with partial matching labels",
|
||||
allResources: map[string]workloadinterface.IMetadata{
|
||||
"resource-1": createWorkloadWithLabels("test-deploy", "default", map[string]string{
|
||||
"app": "myapp",
|
||||
}),
|
||||
},
|
||||
labelsToCopy: []string{"app", "team"},
|
||||
want: map[string]map[string]string{
|
||||
"resource-1": {
|
||||
"app": "myapp",
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "single resource with no matching labels",
|
||||
allResources: map[string]workloadinterface.IMetadata{
|
||||
"resource-1": createWorkloadWithLabels("test-deploy", "default", map[string]string{
|
||||
"version": "v1",
|
||||
}),
|
||||
},
|
||||
labelsToCopy: []string{"app", "team"},
|
||||
want: map[string]map[string]string{},
|
||||
},
|
||||
{
|
||||
name: "multiple resources with various labels",
|
||||
allResources: map[string]workloadinterface.IMetadata{
|
||||
"resource-1": createWorkloadWithLabels("deploy-1", "default", map[string]string{
|
||||
"app": "app1",
|
||||
"team": "team1",
|
||||
}),
|
||||
"resource-2": createWorkloadWithLabels("deploy-2", "default", map[string]string{
|
||||
"app": "app2",
|
||||
}),
|
||||
"resource-3": createWorkloadWithLabels("deploy-3", "default", map[string]string{
|
||||
"version": "v1",
|
||||
}),
|
||||
},
|
||||
labelsToCopy: []string{"app", "team"},
|
||||
want: map[string]map[string]string{
|
||||
"resource-1": {
|
||||
"app": "app1",
|
||||
"team": "team1",
|
||||
},
|
||||
"resource-2": {
|
||||
"app": "app2",
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
got := extractResourceLabels(tt.allResources, tt.labelsToCopy)
|
||||
assert.Equal(t, len(tt.want), len(got), "number of resources with extracted labels should match")
|
||||
for resourceID, wantLabels := range tt.want {
|
||||
gotLabels, ok := got[resourceID]
|
||||
assert.True(t, ok, "resource %s should be present in result", resourceID)
|
||||
assert.Equal(t, wantLabels, gotLabels, "labels for resource %s should match", resourceID)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
97
docs/README.md
Normal file
97
docs/README.md
Normal file
@@ -0,0 +1,97 @@
|
||||
# Kubescape Documentation
|
||||
|
||||
Welcome to the Kubescape documentation. This directory contains detailed guides and references for using Kubescape.
|
||||
|
||||
[](https://kubescape.io/docs/)
|
||||
[](https://github.com/kubescape/kubescape/blob/master/LICENSE)
|
||||
[](https://github.com/kubescape/project-governance/blob/main/CONTRIBUTING.md)
|
||||
|
||||
## 📚 Documentation Index
|
||||
|
||||
### Getting Started
|
||||
|
||||
| Document | Description |
|
||||
|----------|-------------|
|
||||
| [Installation Guide](installation.md) | How to install Kubescape on various platforms |
|
||||
| [Getting Started](getting-started.md) | First steps with Kubescape, basic usage examples |
|
||||
|
||||
### Reference
|
||||
|
||||
| Document | Description |
|
||||
|----------|-------------|
|
||||
| [CLI Reference](cli-reference.md) | Complete command-line reference for all Kubescape commands |
|
||||
| [Architecture](architecture.md) | Technical architecture of Kubescape CLI and Operator |
|
||||
|
||||
### Features
|
||||
|
||||
| Document | Description |
|
||||
|----------|-------------|
|
||||
| [MCP Server](mcp-server.md) | AI assistant integration via Model Context Protocol |
|
||||
| [Providers](providers.md) | Backend services compatible with Kubescape |
|
||||
|
||||
### Support
|
||||
|
||||
| Document | Description |
|
||||
|----------|-------------|
|
||||
| [Troubleshooting](troubleshooting.md) | Common issues and solutions |
|
||||
|
||||
### Additional Resources
|
||||
|
||||
| Document | Description |
|
||||
|----------|-------------|
|
||||
| [Environment Dependencies Policy](environment-dependencies-policy.md) | Policy on external dependencies |
|
||||
| [Roadmap](roadmap.md) | Project roadmap (see centralized governance repo) |
|
||||
|
||||
## 📁 Subdirectories
|
||||
|
||||
| Directory | Description |
|
||||
|-----------|-------------|
|
||||
| [img/](img/) | Images and diagrams used in documentation |
|
||||
| [proposals/](proposals/) | Design proposals and RFCs |
|
||||
| [providers/](providers/) | Provider-specific documentation |
|
||||
|
||||
## 🔗 External Documentation
|
||||
|
||||
- **[Kubescape Website](https://kubescape.io)** - Official website with additional guides
|
||||
- **[Kubescape Docs Hub](https://kubescape.io/docs/)** - Comprehensive online documentation
|
||||
- **[Controls Reference](https://kubescape.io/docs/controls/)** - List of all security controls
|
||||
- **[Helm Charts](https://github.com/kubescape/helm-charts)** - Operator installation
|
||||
- **[Regolibrary](https://github.com/kubescape/regolibrary)** - Security controls library
|
||||
|
||||
## 🤝 Contributing to Documentation
|
||||
|
||||
We welcome contributions to improve our documentation! Please see the [Contributing Guide](https://github.com/kubescape/project-governance/blob/main/CONTRIBUTING.md) for details.
|
||||
|
||||
### Documentation Style
|
||||
|
||||
- Use clear, concise language
|
||||
- Include code examples where applicable
|
||||
- Keep command examples copy-pasteable
|
||||
- Update the table of contents when adding sections
|
||||
- Test all commands before documenting them
|
||||
|
||||
## 📝 Document Status
|
||||
|
||||
| Document | Status | Description |
|
||||
|----------|--------|-------------|
|
||||
| [installation.md](installation.md) | ✅ Current | Installation methods for all platforms |
|
||||
| [getting-started.md](getting-started.md) | ✅ Current | Quick start and usage examples |
|
||||
| [cli-reference.md](cli-reference.md) | ✅ Current | Complete CLI command reference |
|
||||
| [architecture.md](architecture.md) | ✅ Current | Technical architecture documentation |
|
||||
| [mcp-server.md](mcp-server.md) | ✅ Current | AI assistant integration (MCP) |
|
||||
| [troubleshooting.md](troubleshooting.md) | ✅ Current | Common issues and solutions |
|
||||
| [providers.md](providers.md) | ✅ Current | Backend service providers |
|
||||
| [environment-dependencies-policy.md](environment-dependencies-policy.md) | ✅ Current | Dependency policies |
|
||||
|
||||
---
|
||||
|
||||
## 📖 Quick Links
|
||||
|
||||
| I want to... | Go to... |
|
||||
|--------------|----------|
|
||||
| Install Kubescape | [Installation Guide](installation.md) |
|
||||
| Run my first scan | [Getting Started](getting-started.md#run-your-first-scan) |
|
||||
| See all CLI options | [CLI Reference](cli-reference.md) |
|
||||
| Use Kubescape with AI assistants | [MCP Server](mcp-server.md) |
|
||||
| Fix a problem | [Troubleshooting](troubleshooting.md) |
|
||||
| Understand the architecture | [Architecture](architecture.md) |
|
||||
131
docs/TODO_GORELEASER_E2E.md
Normal file
131
docs/TODO_GORELEASER_E2E.md
Normal file
@@ -0,0 +1,131 @@
|
||||
# TODO: Goreleaser E2E / Smoke Test Integration
|
||||
Path: `kubescape/docs/TODO_GORELEASER_E2E.md`
|
||||
|
||||
Summary
|
||||
-------
|
||||
This document lists ideas, constraints, and next steps for moving e2e / smoke testing into the `goreleaser` pipeline via `build` hooks. The repository already contains a smoke test runner at `smoke_testing/init.py`. The goal is to provide a robust, configurable, and CI-friendly approach that runs tests only when the environment supports them.
|
||||
|
||||
Design principles
|
||||
-----------------
|
||||
- Keep heavy integration/tests opt-in. Building and releasing should not require kind/docker/python unless explicitly requested.
|
||||
- Make the goreleaser hook a single shell script (single invocation) so `if/fi`, variables, and state persist across lines.
|
||||
- Prefer discovery of artifacts (glob) over hardcoded filenames when possible, but keep sensible defaults.
|
||||
- Make failures configurable: sometimes tests should fail the release; sometimes they should be advisory (continue on error).
|
||||
|
||||
Prerequisites (runner)
|
||||
----------------------
|
||||
- `python3` available on PATH (or adjust to use a virtualenv in CI).
|
||||
- Container runtime and `kind` if running cluster-based tests.
|
||||
- Sufficient disk and RAM for `kind` clusters.
|
||||
- Required secrets/environment variables present in CI for any tests that need authentication (see "Secrets" below).
|
||||
|
||||
High-level TODOs
|
||||
----------------
|
||||
1. Ensure goreleaser hook is a single script
|
||||
- Update `builds[].hooks.post` in `.goreleaser.yaml` to be one multi-line script (YAML literal) so the entire script runs in a single shell.
|
||||
- Confirm behavior locally by running goreleaser snapshot in an environment with `RUN_E2E=true`.
|
||||
|
||||
2. Add opt-in trigger and documented env flag
|
||||
- Use `RUN_E2E` (boolean-like) to decide whether to run post-build tests.
|
||||
- Document how to enable it in CI:
|
||||
- Example (GitHub Actions env):
|
||||
- `RUN_E2E: "true"`
|
||||
- `RELEASE: ${{ inputs.RELEASE }}`
|
||||
- `CLIENT: ${{ inputs.CLIENT }}`
|
||||
- Consider also adding a `GORELEASER_E2E_MODE` with values `smoke|system|none`.
|
||||
|
||||
3. Artifact discovery
|
||||
- Avoid relying on a single filename. Implement a small discovery step:
|
||||
- Look for `dist/kubescape*` and pick the most appropriate artifact (prefer linux binary or the packaged format you want).
|
||||
- Example logic:
|
||||
- `ARTIFACT="$(ls dist | grep kubescape | grep -v '\.sha256' | head -n1)"`
|
||||
- Use `ART_PATH="$(pwd)/dist/$ARTIFACT"`
|
||||
- Add a fallback or an informative message when no artifact is found.
|
||||
|
||||
4. Decide failure policy
|
||||
- Two possible behaviors:
|
||||
- Fail the goreleaser run when tests fail (useful for gating releases).
|
||||
- Allow the release to continue and treat tests as best-effort (useful when you want to still publish).
|
||||
- Implement via environment flag `E2E_FAIL_ON_ERROR=true|false`. If `false`, wrap test command with `|| true`.
|
||||
|
||||
5. Integrate with existing smoke tests
|
||||
- Use the existing `smoke_testing/init.py` to run basic smoke tests.
|
||||
- Ensure the test runner can accept local artifact path as an argument (it already does in repository).
|
||||
- If tests require additional args or secrets, allow passing them via env vars into the goreleaser hook.
|
||||
|
||||
6. Optional: Run full system-tests (more complex)
|
||||
- Steps the goreleaser hook would perform if `GORELEASER_E2E_MODE=system`:
|
||||
- Clone `armosec/system-tests` into a temp directory.
|
||||
- Create and activate Python virtualenv and `pip install -r requirements.txt`.
|
||||
- Create a `kind` cluster (requires docker + kind).
|
||||
- Pass the built artifact path to the test runner (similar to the GitHub workflow `run-tests` job).
|
||||
- This is heavy and should be gated behind explicit flags and runner capabilities.
|
||||
- Consider running this only in a dedicated CI job (not on goreleaser invoked in arbitrary environments).
|
||||
|
||||
7. Secrets and CI environment
|
||||
- Document secrets required by system tests (examples found in current GH Actions workflow):
|
||||
- `CUSTOMER`, `USERNAME`, `PASSWORD`, `CLIENT_ID_PROD`, `SECRET_KEY_PROD`, `REGISTRY_USERNAME`, `REGISTRY_PASSWORD`.
|
||||
- If tests need image pushes or pulls, ensure `QUAYIO_REGISTRY_USERNAME` and `QUAYIO_REGISTRY_PASSWORD` (or equivalent) are available.
|
||||
- Ensure secrets are not echoed in logs.
|
||||
|
||||
8. Logging and artifacts
|
||||
- Ensure test output is streamed to the goreleaser logs for debugging.
|
||||
- Upload test results (JUnit XML, screenshots) as artifacts in CI (not possible directly from goreleaser, but CI can capture logs/artifacts).
|
||||
- If goreleaser is running in GitHub Actions, consider writing a step after goreleaser to run tests instead of embedding them in goreleaser. This allows richer workflows and artifact uploading.
|
||||
|
||||
9. Implement robust teardown / cleanup
|
||||
- If running `kind` clusters, ensure proper cleanup of clusters and temporary resources on success or failure.
|
||||
|
||||
10. Security considerations
|
||||
- Don't run privileged operations or accept untrusted input in the goreleaser hook.
|
||||
- Avoid storing secrets in plaintext in config files. Use CI secret stores.
|
||||
- If running tests that push signed artifacts or containers, ensure signing keys/passwords are protected (e.g., use cosign with ephemeral or protected secrets).
|
||||
|
||||
11. Optional: Containerize test runner
|
||||
- Create a small container image that contains all test dependencies (python, kind, kubectl, etc.).
|
||||
- Instead of running tests directly in the goreleaser hook, run the container and mount the `dist/` dir into it. This reduces host dependency issues and makes execution reproducible.
|
||||
- Example pattern: `docker run --rm -v $(pwd)/dist:/dist my-test-runner:latest /dist/kubescape-...`
|
||||
|
||||
12. Example hook behaviour (concept)
|
||||
- Single-script pattern to put in `.goreleaser.yaml`:
|
||||
- check `RUN_E2E`
|
||||
- discover artifact
|
||||
- set `E2E_FAIL_ON_ERROR` behavior
|
||||
- run `python3 smoke_testing/init.py "$ART_PATH"`
|
||||
- exit non-zero or continue depending on policy
|
||||
|
||||
13. Testing and validation
|
||||
- Test the hook locally with goreleaser snapshot on a machine that has python3 installed:
|
||||
- `RUN_E2E=true goreleaser release --snapshot --clean`
|
||||
- Validate the script works both when `RUN_E2E` is unset and when set.
|
||||
- Add unit/integration tests for the discovery logic if possible (small shell script unit tests).
|
||||
|
||||
14. Documentation
|
||||
- Add a short how-to in `CONTRIBUTING.md` or `docs/` describing:
|
||||
- How to enable e2e tests in CI (env vars).
|
||||
- What prerequisites the runner must provide.
|
||||
- The meaning of `RUN_E2E`, `E2E_FAIL_ON_ERROR`, and `GORELEASER_E2E_MODE`.
|
||||
|
||||
Concrete next steps (priority order)
|
||||
-----------------------------------
|
||||
1. Replace the current split-line hook with a single-script hook (already implemented locally). Verify the script runs end-to-end in CI.
|
||||
2. Implement artifact discovery (glob) in the script and add `E2E_FAIL_ON_ERROR` support.
|
||||
3. Add a short README entry (this TODO) into `docs/` explaining how to enable the tests and what runner prerequisites exist.
|
||||
4. If required, implement an optional containerized test-runner image to reduce host dependencies.
|
||||
5. If full system-tests are desired in goreleaser, implement a gated flow using `GORELEASER_E2E_MODE=system` that clones `armosec/system-tests` and runs the test runner (requires careful gating, secrets and runner capability checks).
|
||||
6. Add a CI job (GitHub Actions) that runs goreleaser with `RUN_E2E=true` on a runner that has all required tools, captures test artifacts and test reports, and properly tears down resources.
|
||||
|
||||
Notes & caveats
|
||||
--------------
|
||||
- Running heavy system tests from within goreleaser can make releases brittle. Consider keeping goreleaser focused on build/release and run heavyweight tests as separate CI jobs that depend on goreleaser artifacts.
|
||||
- The goreleaser action may run in containers where tools are limited; prefer invoking goreleaser in a full runner if you want to run `kind` and docker-based tests.
|
||||
- If you want the release to be atomic (only publish if tests pass), make sure the goreleaser invocation happens in a CI job that has the necessary environment and ensures test success before pushing artifacts upstream.
|
||||
|
||||
Where to go from here
|
||||
---------------------
|
||||
- I can:
|
||||
- Provide a ready-to-drop `hooks.post` script with artifact discovery and configurable failure behavior.
|
||||
- Prepare a sample GitHub Actions job that runs goreleaser with `RUN_E2E=true` on a runner that has `python3`, `docker`, and `kind`.
|
||||
- Draft a simple containerized test-runner Dockerfile for reliable execution.
|
||||
|
||||
Pick which of these you'd like me to do next and I will produce the code/snippets (hook script, GitHub Actions job, or Dockerfile).
|
||||
@@ -1,19 +1,346 @@
|
||||
# Kubescape architecture
|
||||
# Kubescape Architecture
|
||||
|
||||
_Please check back soon for more: until then, enjoy these fine diagrams._
|
||||
This document describes the architecture of Kubescape, covering both the CLI tool and the in-cluster operator.
|
||||
|
||||
### [Component architecture](img/architecture.drawio.svg)
|
||||
## Overview
|
||||
|
||||
Kubescape is designed as a modular security platform that can run in two primary modes:
|
||||
|
||||
1. **CLI Mode** - On-demand scanning from your local machine
|
||||
2. **Operator Mode** - Continuous monitoring within your Kubernetes cluster
|
||||
|
||||
Both modes share core scanning logic but differ in how they collect data and report results.
|
||||
|
||||
---
|
||||
|
||||
## CLI Architecture
|
||||
|
||||
The Kubescape CLI is a standalone binary that performs security assessments on-demand.
|
||||
|
||||
<div align="center">
|
||||
<img src="img/architecture.drawio.svg" width="600" alt="Component architecture">
|
||||
<img src="img/ks-cli-arch.png" width="600" alt="CLI Architecture Diagram">
|
||||
</div>
|
||||
|
||||
### [CLI](#kubescape-cli)
|
||||
### Core Components
|
||||
|
||||
#### 1. Command Layer (`cmd/`)
|
||||
|
||||
The entry point for all CLI operations. Key commands include:
|
||||
|
||||
| Command | Description |
|
||||
|---------|-------------|
|
||||
| `scan` | Orchestrates misconfiguration and vulnerability scanning |
|
||||
| `scan image` | Container image vulnerability scanning |
|
||||
| `fix` | Auto-remediation of misconfigurations |
|
||||
| `patch` | Container image patching |
|
||||
| `list` | Lists available frameworks and controls |
|
||||
| `download` | Downloads artifacts for offline use |
|
||||
| `vap` | Validating Admission Policy management |
|
||||
| `mcpserver` | MCP server for AI integration |
|
||||
| `operator` | Communicates with in-cluster operator |
|
||||
|
||||
#### 2. Core Engine (`core/`)
|
||||
|
||||
The main scanning engine that:
|
||||
|
||||
- Loads and parses Kubernetes resources
|
||||
- Evaluates resources against security controls
|
||||
- Aggregates and formats results
|
||||
- Manages scan lifecycle and configuration
|
||||
|
||||
#### 3. Policy Evaluation (OPA/Rego)
|
||||
|
||||
Kubescape uses [Open Policy Agent (OPA)](https://www.openpolicyagent.org/) as its policy engine:
|
||||
|
||||
```
|
||||
┌─────────────────────────────────────────────────────────────┐
|
||||
│ Policy Evaluation Flow │
|
||||
├─────────────────────────────────────────────────────────────┤
|
||||
│ │
|
||||
│ K8s Resources ──► OPA Engine ──► Rego Policies ──► Results │
|
||||
│ │ │ │
|
||||
│ │ ▼ │
|
||||
│ │ Regolibrary │
|
||||
│ │ (Control Library) │
|
||||
│ │ │
|
||||
│ ▼ │
|
||||
│ - YAML files │
|
||||
│ - Helm charts │
|
||||
│ - Live cluster │
|
||||
│ - Git repositories │
|
||||
│ │
|
||||
└─────────────────────────────────────────────────────────────┘
|
||||
```
|
||||
|
||||
**[Regolibrary](https://github.com/kubescape/regolibrary)** contains:
|
||||
- Security controls (200+)
|
||||
- Framework definitions (NSA-CISA, MITRE ATT&CK®, CIS Benchmarks)
|
||||
- Control metadata and remediation guidance
|
||||
|
||||
#### 4. Image Scanner (Grype Integration)
|
||||
|
||||
For vulnerability scanning, Kubescape integrates [Grype](https://github.com/anchore/grype):
|
||||
|
||||
```
|
||||
┌─────────────────────────────────────────────────────────────┐
|
||||
│ Image Scanning Pipeline │
|
||||
├─────────────────────────────────────────────────────────────┤
|
||||
│ │
|
||||
│ Container Image ──► SBOM Generation ──► Vulnerability DB │
|
||||
│ │ │ │
|
||||
│ ▼ ▼ │
|
||||
│ Syft Engine Grype Matching │
|
||||
│ │ │ │
|
||||
│ └────────┬───────────┘ │
|
||||
│ ▼ │
|
||||
│ CVE Results │
|
||||
│ │
|
||||
└─────────────────────────────────────────────────────────────┘
|
||||
```
|
||||
|
||||
#### 5. Image Patcher (Copacetic Integration)
|
||||
|
||||
For patching vulnerable images, Kubescape uses [Copacetic](https://github.com/project-copacetic/copacetic):
|
||||
|
||||
```
|
||||
┌─────────────────────────────────────────────────────────────┐
|
||||
│ Image Patching Pipeline │
|
||||
├─────────────────────────────────────────────────────────────┤
|
||||
│ │
|
||||
│ Vulnerable Image ──► Copa ──► BuildKit ──► Patched Image │
|
||||
│ │ │ │
|
||||
│ ▼ ▼ │
|
||||
│ - Scan for CVEs - Apply OS patches │
|
||||
│ - Identify fixes - Rebuild layers │
|
||||
│ - Generate patch plan - Push to registry │
|
||||
│ │
|
||||
└─────────────────────────────────────────────────────────────┘
|
||||
```
|
||||
|
||||
### Data Flow (CLI Scan)
|
||||
|
||||
```
|
||||
┌──────────────────────────────────────────────────────────────────────┐
|
||||
│ CLI Scan Data Flow │
|
||||
├──────────────────────────────────────────────────────────────────────┤
|
||||
│ │
|
||||
│ Input Sources Processing Output │
|
||||
│ ───────────── ────────── ────── │
|
||||
│ │
|
||||
│ ┌─────────────┐ ┌─────────────────┐ ┌─────────────────┐ │
|
||||
│ │ Kubernetes │────────►│ │ │ Console │ │
|
||||
│ │ Cluster │ │ │───►│ (pretty-print) │ │
|
||||
│ └─────────────┘ │ │ └─────────────────┘ │
|
||||
│ │ │ │
|
||||
│ ┌─────────────┐ │ Kubescape │ ┌─────────────────┐ │
|
||||
│ │ YAML Files │────────►│ Core Engine │───►│ JSON/SARIF │ │
|
||||
│ └─────────────┘ │ │ └─────────────────┘ │
|
||||
│ │ │ │
|
||||
│ ┌─────────────┐ │ │ ┌─────────────────┐ │
|
||||
│ │ Helm Charts │────────►│ │───►│ HTML/PDF │ │
|
||||
│ └─────────────┘ │ │ └─────────────────┘ │
|
||||
│ │ │ │
|
||||
│ ┌─────────────┐ │ │ ┌─────────────────┐ │
|
||||
│ │ Git Repos │────────►│ │───►│ JUnit XML │ │
|
||||
│ └─────────────┘ └─────────────────┘ └─────────────────┘ │
|
||||
│ │
|
||||
└──────────────────────────────────────────────────────────────────────┘
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Operator Architecture (In-Cluster)
|
||||
|
||||
The Kubescape Operator provides continuous security monitoring within the cluster.
|
||||
|
||||
<div align="center">
|
||||
<img src="img/ks-cli-arch.png" width="600" alt="cli-diagram">
|
||||
<img src="img/ks-operator-arch.png" width="600" alt="Operator Architecture Diagram">
|
||||
</div>
|
||||
|
||||
### [Operator](https://github.com/kubescape/helm-charts#readme)
|
||||
<div align="center">
|
||||
<img src="img/ks-operator-arch.png" width="600" alt="operator-diagram">
|
||||
</div>
|
||||
### Components
|
||||
|
||||
#### 1. Kubescape Operator
|
||||
|
||||
The main controller that:
|
||||
- Watches for changes to Kubernetes resources
|
||||
- Triggers scans on schedule or on-demand
|
||||
- Manages scan lifecycle
|
||||
- Stores results in Custom Resources
|
||||
|
||||
#### 2. Kubevuln
|
||||
|
||||
Handles container image vulnerability scanning:
|
||||
- Scans images running in the cluster
|
||||
- Generates SBOMs (Software Bill of Materials)
|
||||
- Matches against vulnerability databases
|
||||
- Creates `VulnerabilityManifest` CRs
|
||||
|
||||
#### 3. Host Scanner
|
||||
|
||||
Collects security-relevant information from cluster nodes:
|
||||
- Kernel parameters
|
||||
- Kubelet configuration
|
||||
- Container runtime settings
|
||||
- File permissions
|
||||
|
||||
#### 4. Storage
|
||||
|
||||
Kubescape uses Custom Resources to store scan results:
|
||||
|
||||
| CRD | Description |
|
||||
|-----|-------------|
|
||||
| `VulnerabilityManifest` | Image vulnerability scan results |
|
||||
| `VulnerabilityManifestSummary` | Aggregated vulnerability summaries |
|
||||
| `WorkloadConfigurationScan` | Misconfiguration scan results |
|
||||
| `WorkloadConfigurationScanSummary` | Aggregated configuration summaries |
|
||||
| `ApplicationProfile` | Runtime behavior profiles |
|
||||
| `NetworkNeighborhood` | Observed network connections |
|
||||
|
||||
#### 5. Node Agent (Runtime Security)
|
||||
|
||||
For runtime security, the Node Agent uses eBPF via [Inspektor Gadget](https://github.com/inspektor-gadget/inspektor-gadget):
|
||||
|
||||
```
|
||||
┌─────────────────────────────────────────────────────────────┐
|
||||
│ Runtime Security Flow │
|
||||
├─────────────────────────────────────────────────────────────┤
|
||||
│ │
|
||||
│ Kernel ──► eBPF Probes ──► Node Agent ──► Kubescape │
|
||||
│ │ │ │
|
||||
│ ▼ ▼ │
|
||||
│ System calls - Process exec │
|
||||
│ Network events - File access │
|
||||
│ File operations - Network connections │
|
||||
│ - Anomaly detection │
|
||||
│ │
|
||||
└─────────────────────────────────────────────────────────────┘
|
||||
```
|
||||
|
||||
### Data Flow (Operator)
|
||||
|
||||
```
|
||||
┌──────────────────────────────────────────────────────────────────────┐
|
||||
│ Operator Data Flow │
|
||||
├──────────────────────────────────────────────────────────────────────┤
|
||||
│ │
|
||||
│ ┌─────────────┐ ┌─────────────┐ ┌─────────────────────────┐ │
|
||||
│ │ Kubernetes │ │ Kubescape │ │ Custom Resources │ │
|
||||
│ │ API Server │────►│ Operator │────►│ (Scan Results) │ │
|
||||
│ └─────────────┘ └─────────────┘ └─────────────────────────┘ │
|
||||
│ │ │ │ │
|
||||
│ │ │ ▼ │
|
||||
│ │ │ ┌─────────────────────────┐ │
|
||||
│ │ │ │ Prometheus Metrics │ │
|
||||
│ │ │ └─────────────────────────┘ │
|
||||
│ │ │ │ │
|
||||
│ ▼ ▼ ▼ │
|
||||
│ ┌─────────────┐ ┌─────────────┐ ┌─────────────────────────┐ │
|
||||
│ │ Kubevuln │ │ Node Agent │ │ External Integrations │ │
|
||||
│ │ (Images) │ │ (Runtime) │ │ (ARMO Platform, etc.) │ │
|
||||
│ └─────────────┘ └─────────────┘ └─────────────────────────┘ │
|
||||
│ │
|
||||
└──────────────────────────────────────────────────────────────────────┘
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Frameworks and Controls
|
||||
|
||||
Kubescape evaluates resources against security frameworks:
|
||||
|
||||
### Supported Frameworks
|
||||
|
||||
| Framework | Description |
|
||||
|-----------|-------------|
|
||||
| **NSA-CISA** | Kubernetes Hardening Guidance |
|
||||
| **MITRE ATT&CK®** | Threat-based security framework |
|
||||
| **CIS Benchmarks** | Center for Internet Security best practices |
|
||||
| **SOC2** | Service Organization Control 2 |
|
||||
| **HIPAA** | Healthcare compliance requirements |
|
||||
| **PCI-DSS** | Payment Card Industry standards |
|
||||
|
||||
### Control Structure
|
||||
|
||||
```yaml
|
||||
Control:
|
||||
id: C-0005
|
||||
name: API server insecure port is enabled
|
||||
description: Check if the API server insecure port is enabled
|
||||
frameworks:
|
||||
- NSA
|
||||
- MITRE
|
||||
severity: High
|
||||
remediation: |
|
||||
Disable the insecure port by setting --insecure-port=0
|
||||
rules:
|
||||
- rego: |
|
||||
# OPA/Rego policy code
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Security Model
|
||||
|
||||
### CLI Mode
|
||||
|
||||
- Runs with the permissions of the executing user
|
||||
- Uses kubeconfig for cluster access
|
||||
- No persistent state in the cluster
|
||||
- Results stored locally or sent to configured backend
|
||||
|
||||
### Operator Mode
|
||||
|
||||
- Runs as a Kubernetes workload
|
||||
- Uses ServiceAccount with defined RBAC
|
||||
- Stores results as Custom Resources
|
||||
- Can send data to external backends (optional)
|
||||
|
||||
### Network Requirements
|
||||
|
||||
| Component | Outbound Connections |
|
||||
|-----------|---------------------|
|
||||
| CLI | Vulnerability DB updates, framework downloads |
|
||||
| Operator | Vulnerability DB updates, optional backend |
|
||||
| Offline | All artifacts can be pre-downloaded |
|
||||
|
||||
---
|
||||
|
||||
## Extensibility
|
||||
|
||||
### Custom Controls
|
||||
|
||||
You can create custom controls using Rego:
|
||||
|
||||
```rego
|
||||
package armo_builtins
|
||||
|
||||
deny[msga] {
|
||||
# Your custom policy logic
|
||||
input.kind == "Deployment"
|
||||
not input.spec.template.spec.securityContext.runAsNonRoot
|
||||
|
||||
msga := {
|
||||
"alertMessage": "Deployment should run as non-root",
|
||||
"alertScore": 7,
|
||||
"failedPaths": ["spec.template.spec.securityContext.runAsNonRoot"],
|
||||
"fixPaths": [{"path": "spec.template.spec.securityContext.runAsNonRoot", "value": "true"}]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Integration Points
|
||||
|
||||
- **HTTP API** - For programmatic access ([see httphandler docs](../httphandler/README.md))
|
||||
- **MCP Server** - For AI assistant integration ([see mcp-server docs](mcp-server.md))
|
||||
- **Prometheus Metrics** - For monitoring and alerting
|
||||
- **Webhook** - For external notifications
|
||||
|
||||
---
|
||||
|
||||
## Further Reading
|
||||
|
||||
- [Getting Started Guide](getting-started.md)
|
||||
- [Installation Guide](installation.md)
|
||||
- [Regolibrary (Controls)](https://github.com/kubescape/regolibrary)
|
||||
- [Helm Charts](https://github.com/kubescape/helm-charts)
|
||||
- [ARMO Platform Integration](providers.md)
|
||||
581
docs/cli-reference.md
Normal file
581
docs/cli-reference.md
Normal file
@@ -0,0 +1,581 @@
|
||||
# Kubescape CLI Reference
|
||||
|
||||
This document provides a complete reference for all Kubescape CLI commands and options.
|
||||
|
||||
## Global Options
|
||||
|
||||
These options are available for all commands:
|
||||
|
||||
| Option | Description |
|
||||
|--------|-------------|
|
||||
| `--cache-dir <path>` | Cache directory (default: `~/.kubescape`) |
|
||||
| `--kube-context <context>` | Kubernetes context to use (default: current-context) |
|
||||
| `-l, --logger <level>` | Log level: `debug`, `info`, `warning`, `error`, `fatal` |
|
||||
| `--server <url>` | Backend discovery server URL |
|
||||
| `-h, --help` | Help for any command |
|
||||
|
||||
---
|
||||
|
||||
## kubescape scan
|
||||
|
||||
Scan Kubernetes clusters, files, or images for security issues.
|
||||
|
||||
### Synopsis
|
||||
|
||||
```bash
|
||||
kubescape scan [target] [flags]
|
||||
```
|
||||
|
||||
### Target Types
|
||||
|
||||
- No target: Scans the current cluster
|
||||
- Path: Scans local YAML files, Helm charts, or Kustomize directories
|
||||
- URL: Scans a Git repository
|
||||
|
||||
### Flags
|
||||
|
||||
| Flag | Description | Default |
|
||||
|------|-------------|---------|
|
||||
| `--account <id>` | Kubescape SaaS account ID | from cache |
|
||||
| `--access-key <key>` | Kubescape SaaS access key | from cache |
|
||||
| `--compliance-threshold <float>` | Fail if compliance score is below threshold | `0` |
|
||||
| `--controls-config <path>` | Path to controls configuration file | - |
|
||||
| `-e, --exclude-namespaces <ns>` | Namespaces to exclude (comma-separated) | - |
|
||||
| `--exceptions <path>` | Path to exceptions file | - |
|
||||
| `-f, --format <format>` | Output format: `pretty-printer`, `json`, `junit`, `sarif`, `html`, `pdf`, `prometheus` | `pretty-printer` |
|
||||
| `--include-namespaces <ns>` | Namespaces to include (comma-separated) | - |
|
||||
| `--keep-local` | Don't report results to backend | `false` |
|
||||
| `--kubeconfig <path>` | Path to kubeconfig file | - |
|
||||
| `-o, --output <path>` | Output file path | stdout |
|
||||
| `--scan-images` | Also scan container images for vulnerabilities | `false` |
|
||||
| `--severity-threshold <sev>` | Fail if findings at or above severity: `low`, `medium`, `high`, `critical` | - |
|
||||
| `--submit` | Submit results to Kubescape SaaS | `false` |
|
||||
| `--use-artifacts-from <path>` | Load artifacts from local directory (offline mode) | - |
|
||||
| `--use-from <path>` | Load specific policy from path | - |
|
||||
| `-v, --verbose` | Display all resources, not just failed ones | `false` |
|
||||
| `--view <type>` | View type: `security`, `control`, `resource` | `security` |
|
||||
|
||||
### Examples
|
||||
|
||||
```bash
|
||||
# Scan current cluster
|
||||
kubescape scan
|
||||
|
||||
# Scan with specific framework
|
||||
kubescape scan framework nsa
|
||||
kubescape scan framework mitre
|
||||
kubescape scan framework cis-v1.23-t1.0.1
|
||||
|
||||
# Scan specific control
|
||||
kubescape scan control C-0005 -v
|
||||
|
||||
# Scan local files
|
||||
kubescape scan /path/to/manifests/
|
||||
|
||||
# Scan Git repository
|
||||
kubescape scan https://github.com/org/repo
|
||||
|
||||
# Output to JSON file
|
||||
kubescape scan --format json --output results.json
|
||||
|
||||
# Set compliance threshold (exit 1 if below)
|
||||
kubescape scan --compliance-threshold 80
|
||||
|
||||
# Exclude namespaces
|
||||
kubescape scan --exclude-namespaces kube-system,kube-public
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## kubescape scan framework
|
||||
|
||||
Scan against a specific security framework.
|
||||
|
||||
### Synopsis
|
||||
|
||||
```bash
|
||||
kubescape scan framework <framework-name> [target] [flags]
|
||||
```
|
||||
|
||||
### Available Frameworks
|
||||
|
||||
| Framework | Description |
|
||||
|-----------|-------------|
|
||||
| `nsa` | NSA-CISA Kubernetes Hardening Guidance |
|
||||
| `mitre` | MITRE ATT&CK® for Kubernetes |
|
||||
| `cis-v1.23-t1.0.1` | CIS Kubernetes Benchmark |
|
||||
| `soc2` | SOC 2 compliance |
|
||||
| `pci-dss` | PCI DSS compliance |
|
||||
| `hipaa` | HIPAA compliance |
|
||||
|
||||
### Examples
|
||||
|
||||
```bash
|
||||
kubescape scan framework nsa
|
||||
kubescape scan framework mitre --include-namespaces production
|
||||
kubescape scan framework cis-v1.23-t1.0.1 /path/to/manifests
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## kubescape scan control
|
||||
|
||||
Scan for a specific control.
|
||||
|
||||
### Synopsis
|
||||
|
||||
```bash
|
||||
kubescape scan control <control-id> [target] [flags]
|
||||
```
|
||||
|
||||
### Examples
|
||||
|
||||
```bash
|
||||
# Scan for privileged containers
|
||||
kubescape scan control C-0057 -v
|
||||
|
||||
# Scan specific files for a control
|
||||
kubescape scan control C-0013 /path/to/deployment.yaml
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## kubescape scan workload
|
||||
|
||||
Scan a specific workload.
|
||||
|
||||
### Synopsis
|
||||
|
||||
```bash
|
||||
kubescape scan workload <kind>/<name> [flags]
|
||||
```
|
||||
|
||||
### Flags
|
||||
|
||||
| Flag | Description |
|
||||
|------|-------------|
|
||||
| `--namespace <ns>` | Namespace of the workload |
|
||||
|
||||
### Examples
|
||||
|
||||
```bash
|
||||
kubescape scan workload Deployment/nginx --namespace default
|
||||
kubescape scan workload DaemonSet/fluentd --namespace logging
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## kubescape scan image
|
||||
|
||||
Scan a container image for vulnerabilities.
|
||||
|
||||
### Synopsis
|
||||
|
||||
```bash
|
||||
kubescape scan image <image>:<tag> [flags]
|
||||
```
|
||||
|
||||
### Flags
|
||||
|
||||
| Flag | Description |
|
||||
|------|-------------|
|
||||
| `--exceptions <path>` | Path to exceptions file |
|
||||
| `-p, --password <pass>` | Registry password |
|
||||
| `-u, --username <user>` | Registry username |
|
||||
| `--use-default-matchers` | Use default vulnerability matchers | `true` |
|
||||
|
||||
### Examples
|
||||
|
||||
```bash
|
||||
# Scan public image
|
||||
kubescape scan image nginx:1.21
|
||||
|
||||
# Scan with verbose output
|
||||
kubescape scan image nginx:1.21 -v
|
||||
|
||||
# Scan private registry image
|
||||
kubescape scan image myregistry.io/myimage:tag -u myuser -p mypass
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## kubescape fix
|
||||
|
||||
Auto-fix misconfigurations in Kubernetes manifest files.
|
||||
|
||||
### Synopsis
|
||||
|
||||
```bash
|
||||
kubescape fix <report-file> [flags]
|
||||
```
|
||||
|
||||
### Flags
|
||||
|
||||
| Flag | Description | Default |
|
||||
|------|-------------|---------|
|
||||
| `--dry-run` | Preview changes without applying | `false` |
|
||||
| `--no-confirm` | Apply without confirmation | `false` |
|
||||
| `--skip-user-values` | Skip changes requiring user values | `true` |
|
||||
|
||||
### Examples
|
||||
|
||||
```bash
|
||||
# Generate scan results
|
||||
kubescape scan /path/to/manifests --format json --output results.json
|
||||
|
||||
# Apply fixes
|
||||
kubescape fix results.json
|
||||
|
||||
# Preview fixes
|
||||
kubescape fix results.json --dry-run
|
||||
|
||||
# Apply without prompts
|
||||
kubescape fix results.json --no-confirm
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## kubescape patch
|
||||
|
||||
Patch container images to fix OS-level vulnerabilities.
|
||||
|
||||
### Synopsis
|
||||
|
||||
```bash
|
||||
kubescape patch [flags]
|
||||
```
|
||||
|
||||
### Flags
|
||||
|
||||
| Flag | Description | Default |
|
||||
|------|-------------|---------|
|
||||
| `-i, --image <image>` | Image to patch (required) | - |
|
||||
| `-t, --tag <tag>` | Output image tag | `<image>-patched` |
|
||||
| `-a, --addr <addr>` | BuildKit daemon address | `unix:///run/buildkit/buildkitd.sock` |
|
||||
| `--timeout <duration>` | Patching timeout | `5m` |
|
||||
| `--ignore-errors` | Continue on errors | `false` |
|
||||
| `-u, --username <user>` | Registry username | - |
|
||||
| `-p, --password <pass>` | Registry password | - |
|
||||
| `-f, --format <format>` | Output format | - |
|
||||
| `-o, --output <path>` | Output file | stdout |
|
||||
| `-v, --verbose` | Verbose output | `false` |
|
||||
|
||||
### Examples
|
||||
|
||||
```bash
|
||||
# Start buildkitd first
|
||||
sudo buildkitd &
|
||||
|
||||
# Patch an image
|
||||
sudo kubescape patch --image nginx:1.22
|
||||
|
||||
# Custom output tag
|
||||
sudo kubescape patch --image nginx:1.22 --tag nginx:1.22-fixed
|
||||
|
||||
# Verbose output
|
||||
sudo kubescape patch --image nginx:1.22 -v
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## kubescape list
|
||||
|
||||
List available frameworks and controls.
|
||||
|
||||
### Synopsis
|
||||
|
||||
```bash
|
||||
kubescape list <type> [flags]
|
||||
```
|
||||
|
||||
### Types
|
||||
|
||||
| Type | Description |
|
||||
|------|-------------|
|
||||
| `frameworks` | List available security frameworks |
|
||||
| `controls` | List available security controls |
|
||||
|
||||
### Flags
|
||||
|
||||
| Flag | Description | Default |
|
||||
|------|-------------|---------|
|
||||
| `--account <id>` | Account ID for custom frameworks | - |
|
||||
| `--access-key <key>` | Access key | - |
|
||||
| `--format <format>` | Output format: `pretty-print`, `json` | `pretty-print` |
|
||||
|
||||
### Examples
|
||||
|
||||
```bash
|
||||
kubescape list frameworks
|
||||
kubescape list controls
|
||||
kubescape list controls --format json
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## kubescape download
|
||||
|
||||
Download artifacts for offline/air-gapped use.
|
||||
|
||||
### Synopsis
|
||||
|
||||
```bash
|
||||
kubescape download <type> [name] [flags]
|
||||
```
|
||||
|
||||
### Types
|
||||
|
||||
| Type | Description |
|
||||
|------|-------------|
|
||||
| `artifacts` | Download all artifacts (frameworks, controls, config) |
|
||||
| `framework` | Download a specific framework |
|
||||
| `control` | Download a specific control |
|
||||
|
||||
### Flags
|
||||
|
||||
| Flag | Description | Default |
|
||||
|------|-------------|---------|
|
||||
| `-o, --output <path>` | Output path | `~/.kubescape` |
|
||||
| `--account <id>` | Account ID | - |
|
||||
| `--access-key <key>` | Access key | - |
|
||||
|
||||
### Examples
|
||||
|
||||
```bash
|
||||
# Download all artifacts
|
||||
kubescape download artifacts --output /path/to/offline
|
||||
|
||||
# Download specific framework
|
||||
kubescape download framework nsa --output /path/to/nsa.json
|
||||
|
||||
# Use downloaded artifacts
|
||||
kubescape scan --use-artifacts-from /path/to/offline
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## kubescape config
|
||||
|
||||
Manage Kubescape configuration.
|
||||
|
||||
### Subcommands
|
||||
|
||||
| Subcommand | Description |
|
||||
|------------|-------------|
|
||||
| `view` | View current configuration |
|
||||
| `set` | Set configuration value |
|
||||
| `delete` | Delete cached configuration |
|
||||
|
||||
### Examples
|
||||
|
||||
```bash
|
||||
# View configuration
|
||||
kubescape config view
|
||||
|
||||
# Set account ID
|
||||
kubescape config set accountID <account-id>
|
||||
|
||||
# Set cloud report URL
|
||||
kubescape config set cloudReportURL https://api.example.com
|
||||
|
||||
# Delete configuration
|
||||
kubescape config delete
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## kubescape operator
|
||||
|
||||
Interact with the in-cluster Kubescape operator.
|
||||
|
||||
### Synopsis
|
||||
|
||||
```bash
|
||||
kubescape operator scan <type> [flags]
|
||||
```
|
||||
|
||||
### Scan Types
|
||||
|
||||
| Type | Description |
|
||||
|------|-------------|
|
||||
| `configurations` | Trigger configuration scan |
|
||||
| `vulnerabilities` | Trigger vulnerability scan |
|
||||
|
||||
### Examples
|
||||
|
||||
```bash
|
||||
kubescape operator scan configurations
|
||||
kubescape operator scan vulnerabilities
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## kubescape vap
|
||||
|
||||
Manage Kubernetes Validating Admission Policies.
|
||||
|
||||
### Subcommands
|
||||
|
||||
#### deploy-library
|
||||
|
||||
Deploy the Kubescape CEL admission policy library.
|
||||
|
||||
```bash
|
||||
kubescape vap deploy-library | kubectl apply -f -
|
||||
```
|
||||
|
||||
#### create-policy-binding
|
||||
|
||||
Create a ValidatingAdmissionPolicyBinding.
|
||||
|
||||
```bash
|
||||
kubescape vap create-policy-binding [flags]
|
||||
```
|
||||
|
||||
**Flags:**
|
||||
|
||||
| Flag | Description | Required |
|
||||
|------|-------------|----------|
|
||||
| `-n, --name <name>` | Binding name | Yes |
|
||||
| `-p, --policy <id>` | Policy/control ID | Yes |
|
||||
| `--namespace <ns>` | Namespace selector (repeatable) | No |
|
||||
| `--label <k=v>` | Label selector (repeatable) | No |
|
||||
| `-a, --action <action>` | Action: `Deny`, `Audit`, `Warn` | No (default: `Deny`) |
|
||||
| `-r, --parameter-reference <name>` | Parameter reference | No |
|
||||
|
||||
### Examples
|
||||
|
||||
```bash
|
||||
# Deploy policy library
|
||||
kubescape vap deploy-library | kubectl apply -f -
|
||||
|
||||
# Create binding
|
||||
kubescape vap create-policy-binding \
|
||||
--name deny-privileged \
|
||||
--policy c-0057 \
|
||||
--namespace production \
|
||||
--action Deny | kubectl apply -f -
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## kubescape mcpserver
|
||||
|
||||
Start the MCP (Model Context Protocol) server for AI assistant integration.
|
||||
|
||||
### Synopsis
|
||||
|
||||
```bash
|
||||
kubescape mcpserver
|
||||
```
|
||||
|
||||
### Description
|
||||
|
||||
Starts an MCP server that exposes Kubescape data to AI assistants. The server communicates via stdio.
|
||||
|
||||
### Prerequisites
|
||||
|
||||
- Kubescape operator installed in the cluster
|
||||
- kubectl configured with cluster access
|
||||
|
||||
### Examples
|
||||
|
||||
```bash
|
||||
# Start MCP server
|
||||
kubescape mcpserver
|
||||
```
|
||||
|
||||
### Claude Desktop Configuration
|
||||
|
||||
```json
|
||||
{
|
||||
"mcpServers": {
|
||||
"kubescape": {
|
||||
"command": "kubescape",
|
||||
"args": ["mcpserver"]
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## kubescape version
|
||||
|
||||
Display version information.
|
||||
|
||||
### Synopsis
|
||||
|
||||
```bash
|
||||
kubescape version
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## kubescape completion
|
||||
|
||||
Generate shell completion scripts.
|
||||
|
||||
### Synopsis
|
||||
|
||||
```bash
|
||||
kubescape completion <shell>
|
||||
```
|
||||
|
||||
### Supported Shells
|
||||
|
||||
- `bash`
|
||||
- `zsh`
|
||||
- `fish`
|
||||
- `powershell`
|
||||
|
||||
### Examples
|
||||
|
||||
```bash
|
||||
# Bash
|
||||
kubescape completion bash > /etc/bash_completion.d/kubescape
|
||||
|
||||
# Zsh
|
||||
kubescape completion zsh > "${fpath[1]}/_kubescape"
|
||||
|
||||
# Fish
|
||||
kubescape completion fish > ~/.config/fish/completions/kubescape.fish
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Environment Variables
|
||||
|
||||
Kubescape respects the following environment variables:
|
||||
|
||||
| Variable | Description |
|
||||
|----------|-------------|
|
||||
| `KS_ACCOUNT` | Default account ID |
|
||||
| `KS_CACHE_DIR` | Cache directory path |
|
||||
| `KS_EXCLUDE_NAMESPACES` | Default namespaces to exclude |
|
||||
| `KS_INCLUDE_NAMESPACES` | Default namespaces to include |
|
||||
| `KS_FORMAT` | Default output format |
|
||||
| `KS_LOGGER` | Log level |
|
||||
| `KS_LOGGER_NAME` | Logger name |
|
||||
| `KUBECONFIG` | Path to kubeconfig file |
|
||||
| `HTTPS_PROXY` | HTTPS proxy URL |
|
||||
| `HTTP_PROXY` | HTTP proxy URL |
|
||||
| `NO_PROXY` | Hosts to exclude from proxy |
|
||||
|
||||
---
|
||||
|
||||
## Exit Codes
|
||||
|
||||
| Code | Description |
|
||||
|------|-------------|
|
||||
| `0` | Success |
|
||||
| `1` | Failure (threshold exceeded, scan failed, etc.) |
|
||||
|
||||
---
|
||||
|
||||
## See Also
|
||||
|
||||
- [Getting Started Guide](getting-started.md)
|
||||
- [Architecture](architecture.md)
|
||||
- [Troubleshooting](troubleshooting.md)
|
||||
- [MCP Server Documentation](mcp-server.md)
|
||||
@@ -4,6 +4,22 @@ Kubescape can run as a command line tool on a client, as an operator inside a cl
|
||||
|
||||
The best way to get started with Kubescape is to download it to the machine you use to manage your Kubernetes cluster.
|
||||
|
||||
## Table of Contents
|
||||
|
||||
- [Install Kubescape](#install-kubescape)
|
||||
- [Run your first scan](#run-your-first-scan)
|
||||
- [Usage](#usage)
|
||||
- [Misconfigurations Scanning](#misconfigurations-scanning)
|
||||
- [Image Scanning](#image-scanning)
|
||||
- [Auto-Fix Misconfigurations](#auto-fix-misconfigurations)
|
||||
- [Image Patching](#image-patching)
|
||||
- [Validating Admission Policies (VAP)](#validating-admission-policies-vap)
|
||||
- [MCP Server (AI Integration)](#mcp-server-ai-integration)
|
||||
- [Configuration Management](#configuration-management)
|
||||
- [Offline/Air-gapped Support](#offlineair-gapped-environment-support)
|
||||
- [Other Ways to Use Kubescape](#other-ways-to-use-kubescape)
|
||||
- [Tutorial Videos](#tutorial-videos)
|
||||
|
||||
## Install Kubescape
|
||||
|
||||
```bash
|
||||
@@ -170,7 +186,7 @@ kubescape scan --exclude-namespaces kube-system,kube-public
|
||||
|
||||
#### Scan local YAML files
|
||||
```sh
|
||||
kubescape scan /path/to/directory-or-directory
|
||||
kubescape scan /path/to/directory-or-file
|
||||
```
|
||||
|
||||
Take a look at the [example](https://youtu.be/Ox6DaR7_4ZI).
|
||||
@@ -305,7 +321,7 @@ You can also download a single artifact, and scan with the `--use-from` flag:
|
||||
```
|
||||
## Image scanning
|
||||
|
||||
Kubescape can scan container images for vulnerabilities. It uses [Grype]() to scan the images.
|
||||
Kubescape can scan container images for vulnerabilities. It uses [Grype](https://github.com/anchore/grype) to scan the images.
|
||||
|
||||
### Examples
|
||||
|
||||
@@ -347,6 +363,207 @@ View Kubescape scan results directly in the [Lens IDE](https://k8slens.dev/) usi
|
||||
|
||||
Experiment with Kubescape in the [Kubescape playground](https://killercoda.com/saiyampathak/scenario/kubescape): this scenario will install a K3s cluster and Kubescape. You can start with any of the `kubescape scan` commands in the [examples](#examples).
|
||||
|
||||
## Auto-Fix Misconfigurations
|
||||
|
||||
Kubescape can automatically fix misconfigurations found in your Kubernetes manifest files.
|
||||
|
||||
### Usage
|
||||
|
||||
```bash
|
||||
# First, scan and save results to JSON
|
||||
kubescape scan /path/to/manifests --format json --output results.json
|
||||
|
||||
# Then apply fixes based on the scan results
|
||||
kubescape fix results.json
|
||||
```
|
||||
|
||||
### Options
|
||||
|
||||
| Flag | Description |
|
||||
|------|-------------|
|
||||
| `--dry-run` | Preview changes without applying them |
|
||||
| `--no-confirm` | Apply fixes without confirmation prompts |
|
||||
| `--skip-user-values` | Skip changes that require user-defined values (default: true) |
|
||||
|
||||
### Example
|
||||
|
||||
```bash
|
||||
# Preview fixes without applying
|
||||
kubescape fix results.json --dry-run
|
||||
|
||||
# Apply fixes without prompts (useful for CI/CD)
|
||||
kubescape fix results.json --no-confirm
|
||||
```
|
||||
|
||||
> **Warning**
|
||||
> The fix command modifies files in-place. Always review changes or use `--dry-run` first.
|
||||
|
||||
## Image Patching
|
||||
|
||||
Kubescape can patch container images to fix OS-level vulnerabilities using [Copacetic](https://github.com/project-copacetic/copacetic) and [BuildKit](https://github.com/moby/buildkit).
|
||||
|
||||
### Prerequisites
|
||||
|
||||
- Docker daemon installed and running
|
||||
- BuildKit daemon installed
|
||||
|
||||
### Usage
|
||||
|
||||
```bash
|
||||
# Start buildkitd (if not already running)
|
||||
sudo buildkitd &
|
||||
|
||||
# Patch an image
|
||||
sudo kubescape patch --image docker.io/library/nginx:1.22
|
||||
```
|
||||
|
||||
### Options
|
||||
|
||||
| Flag | Description | Default |
|
||||
|------|-------------|---------|
|
||||
| `-i, --image` | Image name to patch (required) | - |
|
||||
| `-t, --tag` | Tag for the patched image | `<image>-patched` |
|
||||
| `-a, --addr` | BuildKit daemon address | `unix:///run/buildkit/buildkitd.sock` |
|
||||
| `--timeout` | Patching timeout | `5m` |
|
||||
| `-u, --username` | Registry username | - |
|
||||
| `-p, --password` | Registry password | - |
|
||||
| `-v, --verbose` | Show detailed output | `false` |
|
||||
|
||||
### Example without sudo
|
||||
|
||||
```bash
|
||||
export BUILDKIT_VERSION=v0.11.4
|
||||
export BUILDKIT_PORT=8888
|
||||
|
||||
# Start BuildKit in Docker
|
||||
docker run --detach --rm --privileged \
|
||||
-p 127.0.0.1:$BUILDKIT_PORT:$BUILDKIT_PORT/tcp \
|
||||
--name buildkitd \
|
||||
--entrypoint buildkitd \
|
||||
"moby/buildkit:$BUILDKIT_VERSION" \
|
||||
--addr tcp://0.0.0.0:$BUILDKIT_PORT
|
||||
|
||||
# Patch using TCP connection
|
||||
kubescape patch -i nginx:1.22 -a tcp://0.0.0.0:$BUILDKIT_PORT
|
||||
```
|
||||
|
||||
> **Note**
|
||||
> Image patching can only fix OS-level vulnerabilities, not application-level ones.
|
||||
|
||||
For more details, see the [Patch Command Documentation](/cmd/patch/README.md).
|
||||
|
||||
## Validating Admission Policies (VAP)
|
||||
|
||||
Kubescape can help manage Kubernetes [Validating Admission Policies](https://kubernetes.io/docs/reference/access-authn-authz/validating-admission-policy/) using CEL (Common Expression Language).
|
||||
|
||||
### Deploy the Policy Library
|
||||
|
||||
Install the Kubescape CEL admission policy library:
|
||||
|
||||
```bash
|
||||
kubescape vap deploy-library | kubectl apply -f -
|
||||
```
|
||||
|
||||
This deploys:
|
||||
- Policy configuration CRD
|
||||
- Basic control configurations
|
||||
- Kubescape validating admission policies
|
||||
|
||||
### Create Policy Bindings
|
||||
|
||||
Bind policies to specific resources:
|
||||
|
||||
```bash
|
||||
kubescape vap create-policy-binding \
|
||||
--name my-policy-binding \
|
||||
--policy c-0016 \
|
||||
--namespace my-namespace | kubectl apply -f -
|
||||
```
|
||||
|
||||
### Options for `create-policy-binding`
|
||||
|
||||
| Flag | Description | Required |
|
||||
|------|-------------|----------|
|
||||
| `-n, --name` | Name of the policy binding | Yes |
|
||||
| `-p, --policy` | Policy/control to bind | Yes |
|
||||
| `--namespace` | Namespace selector (can be repeated) | No |
|
||||
| `--label` | Label selector in `key=value` format | No |
|
||||
| `-a, --action` | Action on failure: `Deny`, `Audit`, `Warn` | No (default: `Deny`) |
|
||||
| `-r, --parameter-reference` | Parameter reference object name | No |
|
||||
|
||||
### Example
|
||||
|
||||
```bash
|
||||
# Create a policy that denies non-compliant resources in production
|
||||
kubescape vap create-policy-binding \
|
||||
--name deny-privileged-containers \
|
||||
--policy c-0057 \
|
||||
--namespace production \
|
||||
--action Deny | kubectl apply -f -
|
||||
```
|
||||
|
||||
## MCP Server (AI Integration)
|
||||
|
||||
Kubescape provides an MCP (Model Context Protocol) server for AI assistant integration, allowing natural language queries about your cluster's security posture.
|
||||
|
||||
### Prerequisites
|
||||
|
||||
- Kubescape operator installed in your cluster
|
||||
- kubectl configured with cluster access
|
||||
|
||||
### Start the Server
|
||||
|
||||
```bash
|
||||
kubescape mcpserver
|
||||
```
|
||||
|
||||
### Available Tools
|
||||
|
||||
The MCP server exposes these tools to AI assistants:
|
||||
|
||||
| Tool | Description |
|
||||
|------|-------------|
|
||||
| `list_vulnerability_manifests` | Discover vulnerability scan results |
|
||||
| `list_vulnerabilities_in_manifest` | List CVEs in a specific manifest |
|
||||
| `list_vulnerability_matches_for_cve` | Get details for a specific CVE |
|
||||
| `list_configuration_security_scan_manifests` | List configuration scan results |
|
||||
| `get_configuration_security_scan_manifest` | Get configuration scan details |
|
||||
|
||||
### Integration with Claude Desktop
|
||||
|
||||
Add to your Claude Desktop configuration:
|
||||
|
||||
```json
|
||||
{
|
||||
"mcpServers": {
|
||||
"kubescape": {
|
||||
"command": "kubescape",
|
||||
"args": ["mcpserver"]
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
For more details, see the [MCP Server Documentation](mcp-server.md).
|
||||
|
||||
## Configuration Management
|
||||
|
||||
Manage Kubescape's cached configurations:
|
||||
|
||||
```bash
|
||||
# View current configuration
|
||||
kubescape config view
|
||||
|
||||
# Set account ID
|
||||
kubescape config set accountID <your-account-id>
|
||||
|
||||
# Set cloud report URL
|
||||
kubescape config set cloudReportURL <url>
|
||||
|
||||
# Delete cached configuration
|
||||
kubescape config delete
|
||||
```
|
||||
|
||||
## Tutorial videos
|
||||
|
||||
* [Kubescape overview](https://youtu.be/wdBkt_0Qhbg)
|
||||
|
||||
@@ -1,116 +1,251 @@
|
||||
# Installation
|
||||
## Manually
|
||||
> **Note**: We do not recommend this method if you want to get auto-updating from package managers or have more platforms supported.
|
||||
### X86_64 or ARM64 (M1/M2) Linux / macOS
|
||||
# Installation Guide
|
||||
|
||||
This guide covers all the ways to install Kubescape on your system.
|
||||
|
||||
## Table of Contents
|
||||
|
||||
- [Quick Install](#quick-install)
|
||||
- [Package Managers](#package-managers)
|
||||
- [Manual Installation](#manual-installation)
|
||||
- [Verification](#verification)
|
||||
- [Updating](#updating)
|
||||
- [Uninstalling](#uninstalling)
|
||||
|
||||
---
|
||||
|
||||
## Quick Install
|
||||
|
||||
### Linux / macOS (Recommended)
|
||||
|
||||
```bash
|
||||
curl -s https://raw.githubusercontent.com/kubescape/kubescape/master/install.sh | /bin/bash
|
||||
```
|
||||
|
||||
To install a previous version, you can specify it in the command line.
|
||||
This script:
|
||||
- Detects your OS and architecture (x86_64, ARM64/M1/M2)
|
||||
- Downloads the latest release
|
||||
- Installs to `~/.kubescape/`
|
||||
- Adds to your PATH
|
||||
|
||||
```bash
|
||||
curl -s https://raw.githubusercontent.com/kubescape/kubescape/master/install.sh | /bin/bash -s -- -v v2.3.6
|
||||
```
|
||||
### Windows (PowerShell)
|
||||
|
||||
Requires PowerShell v5.0 or higher:
|
||||
|
||||
### X86_64 Windows
|
||||
You must have PowerShell v5.0 or higher:
|
||||
```powershell
|
||||
iwr -useb https://raw.githubusercontent.com/kubescape/kubescape/master/install.ps1 | iex
|
||||
```
|
||||
|
||||
If you get an error, you may need to change the execution policy:
|
||||
If you get an execution policy error:
|
||||
```powershell
|
||||
Set-ExecutionPolicy RemoteSigned -scope CurrentUser
|
||||
Set-ExecutionPolicy RemoteSigned -Scope CurrentUser
|
||||
```
|
||||
|
||||
## openSUSE
|
||||
> **Note**: openSUSE community-supported.
|
||||
### Install a Specific Version
|
||||
|
||||
```bash
|
||||
sudo zypper refresh
|
||||
sudo zypper install kubescape
|
||||
curl -s https://raw.githubusercontent.com/kubescape/kubescape/master/install.sh | /bin/bash -s -- -v v3.0.0
|
||||
```
|
||||
|
||||
## Arch
|
||||
---
|
||||
|
||||
## Package Managers
|
||||
|
||||
### Homebrew (macOS/Linux)
|
||||
|
||||
```bash
|
||||
yay -S kubescape
|
||||
```
|
||||
If you would like to save some time and do not want to compile, install `kubescape-bin` instead:
|
||||
> **Note**: kubescape-bin is AUR community-supported.
|
||||
```bash
|
||||
yay -S kubescape-bin
|
||||
brew install kubescape
|
||||
```
|
||||
|
||||
## Ubuntu
|
||||
> **Note**: The [official Homebrew formula](https://formulae.brew.sh/formula/kubescape#default) has git scanning disabled. For full functionality:
|
||||
> ```bash
|
||||
> brew tap kubescape/tap
|
||||
> brew install kubescape-cli
|
||||
> ```
|
||||
|
||||
### Krew (kubectl plugin)
|
||||
|
||||
```bash
|
||||
kubectl krew update
|
||||
kubectl krew install kubescape
|
||||
|
||||
# Use as kubectl plugin
|
||||
kubectl kubescape scan
|
||||
```
|
||||
|
||||
### Ubuntu / Debian
|
||||
|
||||
```bash
|
||||
sudo add-apt-repository ppa:kubescape/kubescape
|
||||
sudo apt update
|
||||
sudo apt install kubescape
|
||||
```
|
||||
|
||||
## Other Debian-based or RPM-based Linux Distros
|
||||
Please follow the [guidelines here](https://software.opensuse.org/download.html?project=home%3Akubescape&package=kubescape).
|
||||
For other Debian-based or RPM-based distributions, see the [OpenSUSE Build Service](https://software.opensuse.org/download.html?project=home%3Akubescape&package=kubescape).
|
||||
|
||||
## Homebrew
|
||||
> **Note**: The kubescape delivered by [official Homebrew](https://formulae.brew.sh/formula/kubescape#default) comes with git disabled.
|
||||
### Arch Linux
|
||||
|
||||
```bash
|
||||
brew install kubescape
|
||||
# Build from source
|
||||
yay -S kubescape
|
||||
|
||||
# Or install pre-built binary (faster)
|
||||
yay -S kubescape-bin
|
||||
```
|
||||
|
||||
If you want to have the git enabled one, you can install via the [homebrew-tap](https://github.com/kubescape/homebrew-tap):
|
||||
> **Note**: AUR packages are community-supported.
|
||||
|
||||
### openSUSE
|
||||
|
||||
```bash
|
||||
brew tap kubescape/tap
|
||||
brew install kubescape-cli
|
||||
sudo zypper refresh
|
||||
sudo zypper install kubescape
|
||||
```
|
||||
|
||||
## Chocolatey
|
||||
> **Note**: Chocolatey [community-supported](https://community.chocolatey.org/packages/kubescape).
|
||||
> **Note**: Community-supported.
|
||||
|
||||
### NixOS / Nix
|
||||
|
||||
```bash
|
||||
# Try in ephemeral shell
|
||||
nix-shell -p kubescape
|
||||
|
||||
# Or add to configuration.nix
|
||||
environment.systemPackages = with pkgs; [ kubescape ];
|
||||
|
||||
# Or with home-manager
|
||||
home.packages = with pkgs; [ kubescape ];
|
||||
```
|
||||
|
||||
> **Note**: Community-supported. See [NixOS support](https://nixos.wiki/wiki/Support) for issues.
|
||||
|
||||
### Snap
|
||||
|
||||
[](https://snapcraft.io/kubescape)
|
||||
|
||||
```bash
|
||||
sudo snap install kubescape
|
||||
```
|
||||
|
||||
### Chocolatey (Windows)
|
||||
|
||||
```powershell
|
||||
choco install kubescape
|
||||
```
|
||||
|
||||
## Scoop
|
||||
> **Note**: Scoop [community-supported](https://scoop.sh/#/apps?q=kubescape&s=0&d=1&o=true&id=1f5ae05eaafe3e7a26505f0889101e0da91ffe91).
|
||||
> **Note**: [Community-supported](https://community.chocolatey.org/packages/kubescape).
|
||||
|
||||
### Scoop (Windows)
|
||||
|
||||
```powershell
|
||||
scoop install kubescape
|
||||
```
|
||||
|
||||
## Krew
|
||||
> **Note**: [Community-supported](https://scoop.sh/#/apps?q=kubescape).
|
||||
|
||||
---
|
||||
|
||||
## Manual Installation
|
||||
|
||||
### Download from GitHub Releases
|
||||
|
||||
1. Go to the [Releases page](https://github.com/kubescape/kubescape/releases)
|
||||
2. Download the appropriate binary for your OS/architecture
|
||||
3. Make it executable and move to your PATH:
|
||||
|
||||
```bash
|
||||
kubectl krew update
|
||||
kubectl krew install kubescape
|
||||
kubectl kubescape
|
||||
# Linux/macOS example
|
||||
chmod +x kubescape
|
||||
sudo mv kubescape /usr/local/bin/
|
||||
```
|
||||
|
||||
## Snap
|
||||
[](https://snapcraft.io/kubescape)
|
||||
### Build from Source
|
||||
|
||||
## NixOS or with nix
|
||||
> **Note**: This method is community-supported. If you are having trouble, please reach out to [NixOS support](https://nixos.wiki/wiki/Support).
|
||||
|
||||
You can use `nix` on Linux or macOS.
|
||||
|
||||
Try it out in an ephemeral shell: `nix-shell -p kubescape`.
|
||||
|
||||
NixOS:
|
||||
|
||||
```
|
||||
# your other config ...
|
||||
environment.systemPackages = with pkgs; [
|
||||
# your other packages ...
|
||||
kubescape
|
||||
];
|
||||
```bash
|
||||
git clone https://github.com/kubescape/kubescape.git
|
||||
cd kubescape
|
||||
make build
|
||||
```
|
||||
|
||||
home-manager:
|
||||
---
|
||||
|
||||
```
|
||||
# your other config ...
|
||||
home.packages = with pkgs; [
|
||||
# your other packages ...
|
||||
kubescape
|
||||
];
|
||||
## Verification
|
||||
|
||||
After installation, verify Kubescape is working:
|
||||
|
||||
```bash
|
||||
# Check version
|
||||
kubescape version
|
||||
|
||||
# Run a simple scan (requires cluster access)
|
||||
kubescape scan
|
||||
|
||||
# Or scan a sample file
|
||||
kubescape scan https://raw.githubusercontent.com/kubernetes/examples/master/guestbook/all-in-one/guestbook-all-in-one.yaml
|
||||
```
|
||||
|
||||
Or, to your profile (not preferred): `nix-env --install -A nixpkgs.kubescape`.
|
||||
### Expected Output
|
||||
|
||||
```
|
||||
Kubescape version: vX.X.X
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Updating
|
||||
|
||||
### Script Installation
|
||||
|
||||
Re-run the install script to get the latest version:
|
||||
|
||||
```bash
|
||||
curl -s https://raw.githubusercontent.com/kubescape/kubescape/master/install.sh | /bin/bash
|
||||
```
|
||||
|
||||
### Package Managers
|
||||
|
||||
Use your package manager's update command:
|
||||
|
||||
```bash
|
||||
# Homebrew
|
||||
brew upgrade kubescape
|
||||
|
||||
# apt
|
||||
sudo apt update && sudo apt upgrade kubescape
|
||||
|
||||
# Krew
|
||||
kubectl krew upgrade kubescape
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Uninstalling
|
||||
|
||||
### Script Installation
|
||||
|
||||
```bash
|
||||
rm -rf ~/.kubescape
|
||||
# Remove from PATH in your shell config (.bashrc, .zshrc, etc.)
|
||||
```
|
||||
|
||||
### Package Managers
|
||||
|
||||
Use your package manager's uninstall command:
|
||||
|
||||
```bash
|
||||
# Homebrew
|
||||
brew uninstall kubescape
|
||||
|
||||
# apt
|
||||
sudo apt remove kubescape
|
||||
|
||||
# Krew
|
||||
kubectl krew uninstall kubescape
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Next Steps
|
||||
|
||||
- [Getting Started Guide](getting-started.md) - Run your first scan
|
||||
- [CLI Reference](cli-reference.md) - Full command reference
|
||||
- [Troubleshooting](troubleshooting.md) - Common issues and solutions
|
||||
|
||||
259
docs/mcp-server.md
Normal file
259
docs/mcp-server.md
Normal file
@@ -0,0 +1,259 @@
|
||||
# Kubescape MCP Server
|
||||
|
||||
The Kubescape MCP (Model Context Protocol) Server enables AI assistants to query your Kubernetes cluster's security posture using natural language. It exposes Kubescape's vulnerability and configuration scan data through the [MCP protocol](https://modelcontextprotocol.io/).
|
||||
|
||||
## Overview
|
||||
|
||||
The MCP server allows AI assistants (like Claude, ChatGPT, or custom AI tools) to:
|
||||
|
||||
- List and query vulnerability manifests for images and workloads
|
||||
- Retrieve CVE details and vulnerability matches
|
||||
- Access configuration security scan results
|
||||
- Provide security recommendations based on real cluster data
|
||||
|
||||
## Prerequisites
|
||||
|
||||
Before using the MCP server, you need:
|
||||
|
||||
1. **Kubescape Operator installed in your cluster** - The MCP server reads data from Custom Resources created by the operator
|
||||
2. **kubectl configured** - With access to the cluster running the Kubescape operator
|
||||
3. **Kubescape CLI** - Version 3.x or later
|
||||
|
||||
### Installing the Kubescape Operator
|
||||
|
||||
```bash
|
||||
helm repo add kubescape https://kubescape.github.io/helm-charts/
|
||||
helm repo update
|
||||
|
||||
helm upgrade --install kubescape kubescape/kubescape-operator \
|
||||
--namespace kubescape \
|
||||
--create-namespace \
|
||||
--set capabilities.vulnerabilityScan=enable \
|
||||
--set capabilities.configurationScan=enable
|
||||
```
|
||||
|
||||
Wait for the operator to complete initial scans:
|
||||
|
||||
```bash
|
||||
kubectl -n kubescape get vulnerabilitymanifests
|
||||
kubectl -n kubescape get workloadconfigurationscans
|
||||
```
|
||||
|
||||
## Starting the MCP Server
|
||||
|
||||
```bash
|
||||
kubescape mcpserver
|
||||
```
|
||||
|
||||
The server starts and communicates via stdio, making it compatible with MCP-enabled AI tools.
|
||||
|
||||
## Available Tools
|
||||
|
||||
The MCP server exposes the following tools to AI assistants:
|
||||
|
||||
### Vulnerability Tools
|
||||
|
||||
#### `list_vulnerability_manifests`
|
||||
|
||||
Discover available vulnerability manifests at image and workload levels.
|
||||
|
||||
**Parameters:**
|
||||
| Parameter | Type | Required | Description |
|
||||
|-----------|------|----------|-------------|
|
||||
| `namespace` | string | No | Filter by namespace |
|
||||
| `level` | string | No | Type of manifests: `"image"`, `"workload"`, or `"both"` (default) |
|
||||
|
||||
**Example Response:**
|
||||
```json
|
||||
{
|
||||
"vulnerability_manifests": {
|
||||
"manifests": [
|
||||
{
|
||||
"type": "workload",
|
||||
"namespace": "default",
|
||||
"manifest_name": "deployment-nginx-nginx",
|
||||
"image-level": false,
|
||||
"workload-level": true,
|
||||
"image-id": "sha256:abc123...",
|
||||
"image-tag": "nginx:1.21",
|
||||
"resource_uri": "kubescape://vulnerability-manifests/default/deployment-nginx-nginx"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
#### `list_vulnerabilities_in_manifest`
|
||||
|
||||
List all vulnerabilities (CVEs) found in a specific manifest.
|
||||
|
||||
**Parameters:**
|
||||
| Parameter | Type | Required | Description |
|
||||
|-----------|------|----------|-------------|
|
||||
| `namespace` | string | No | Namespace of the manifest (default: `"kubescape"`) |
|
||||
| `manifest_name` | string | Yes | Name of the manifest |
|
||||
|
||||
**Example Response:**
|
||||
```json
|
||||
[
|
||||
{
|
||||
"id": "CVE-2023-12345",
|
||||
"severity": "High",
|
||||
"description": "Buffer overflow in libfoo",
|
||||
"fix": {
|
||||
"versions": ["1.2.4"],
|
||||
"state": "fixed"
|
||||
}
|
||||
}
|
||||
]
|
||||
```
|
||||
|
||||
#### `list_vulnerability_matches_for_cve`
|
||||
|
||||
Get detailed information about a specific CVE in a manifest, including affected packages and fix information.
|
||||
|
||||
**Parameters:**
|
||||
| Parameter | Type | Required | Description |
|
||||
|-----------|------|----------|-------------|
|
||||
| `namespace` | string | No | Namespace of the manifest (default: `"kubescape"`) |
|
||||
| `manifest_name` | string | Yes | Name of the manifest |
|
||||
| `cve_id` | string | Yes | CVE identifier (e.g., `"CVE-2023-12345"`) |
|
||||
|
||||
### Configuration Tools
|
||||
|
||||
#### `list_configuration_security_scan_manifests`
|
||||
|
||||
Discover available security configuration scan results at the workload level.
|
||||
|
||||
**Parameters:**
|
||||
| Parameter | Type | Required | Description |
|
||||
|-----------|------|----------|-------------|
|
||||
| `namespace` | string | No | Filter by namespace (default: `"kubescape"`) |
|
||||
|
||||
**Example Response:**
|
||||
```json
|
||||
{
|
||||
"configuration_manifests": {
|
||||
"manifests": [
|
||||
{
|
||||
"namespace": "default",
|
||||
"manifest_name": "deployment-nginx",
|
||||
"resource_uri": "kubescape://configuration-manifests/default/deployment-nginx"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
#### `get_configuration_security_scan_manifest`
|
||||
|
||||
Get detailed configuration scan results for a specific workload, including failed controls and remediation guidance.
|
||||
|
||||
**Parameters:**
|
||||
| Parameter | Type | Required | Description |
|
||||
|-----------|------|----------|-------------|
|
||||
| `namespace` | string | No | Namespace of the manifest (default: `"kubescape"`) |
|
||||
| `manifest_name` | string | Yes | Name of the configuration manifest |
|
||||
|
||||
## Resource Templates
|
||||
|
||||
The MCP server also exposes resource templates for direct access to data:
|
||||
|
||||
### Vulnerability Manifest
|
||||
```
|
||||
kubescape://vulnerability-manifests/{namespace}/{manifest_name}
|
||||
```
|
||||
|
||||
### Configuration Manifest
|
||||
```
|
||||
kubescape://configuration-manifests/{namespace}/{manifest_name}
|
||||
```
|
||||
|
||||
## Integration with AI Assistants
|
||||
|
||||
### Claude Desktop
|
||||
|
||||
Add to your Claude Desktop configuration (`~/.config/claude/config.json` on Linux or `~/Library/Application Support/Claude/claude_desktop_config.json` on macOS):
|
||||
|
||||
```json
|
||||
{
|
||||
"mcpServers": {
|
||||
"kubescape": {
|
||||
"command": "kubescape",
|
||||
"args": ["mcpserver"]
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Custom Integration
|
||||
|
||||
For custom AI applications using the MCP SDK:
|
||||
|
||||
```python
|
||||
from mcp import Client
|
||||
|
||||
async with Client("kubescape", ["kubescape", "mcpserver"]) as client:
|
||||
# List vulnerability manifests
|
||||
result = await client.call_tool(
|
||||
"list_vulnerability_manifests",
|
||||
{"level": "workload"}
|
||||
)
|
||||
print(result)
|
||||
```
|
||||
|
||||
## Example AI Queries
|
||||
|
||||
Once connected, you can ask your AI assistant questions like:
|
||||
|
||||
- "What vulnerabilities exist in my production namespace?"
|
||||
- "Show me all critical CVEs affecting my nginx deployments"
|
||||
- "What configuration issues does my cluster have?"
|
||||
- "Which workloads have the most security issues?"
|
||||
- "Give me details about CVE-2023-12345 in my cluster"
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
### No vulnerability manifests found
|
||||
|
||||
Ensure the Kubescape operator has completed vulnerability scanning:
|
||||
|
||||
```bash
|
||||
kubectl -n kubescape get vulnerabilitymanifests
|
||||
```
|
||||
|
||||
If empty, check operator logs:
|
||||
|
||||
```bash
|
||||
kubectl -n kubescape logs -l app=kubescape
|
||||
```
|
||||
|
||||
### Connection issues
|
||||
|
||||
Verify your kubeconfig is correctly configured:
|
||||
|
||||
```bash
|
||||
kubectl get nodes
|
||||
```
|
||||
|
||||
### MCP server not responding
|
||||
|
||||
Check that you're running Kubescape v3.x or later:
|
||||
|
||||
```bash
|
||||
kubescape version
|
||||
```
|
||||
|
||||
## Security Considerations
|
||||
|
||||
- The MCP server runs with the same Kubernetes permissions as your kubeconfig
|
||||
- It provides read-only access to vulnerability and configuration data
|
||||
- No cluster modifications are made through the MCP server
|
||||
- Consider running with a service account that has limited permissions in production
|
||||
|
||||
## Related Documentation
|
||||
|
||||
- [Kubescape Operator Installation](https://kubescape.io/docs/operator/)
|
||||
- [Vulnerability Scanning](https://kubescape.io/docs/vulnerabilities/)
|
||||
- [Configuration Scanning](https://kubescape.io/docs/configuration-scanning/)
|
||||
- [MCP Protocol Specification](https://modelcontextprotocol.io/)
|
||||
528
docs/troubleshooting.md
Normal file
528
docs/troubleshooting.md
Normal file
@@ -0,0 +1,528 @@
|
||||
# Troubleshooting Guide
|
||||
|
||||
This guide covers common issues you may encounter when using Kubescape and how to resolve them.
|
||||
|
||||
## Table of Contents
|
||||
|
||||
- [Installation Issues](#installation-issues)
|
||||
- [Scanning Issues](#scanning-issues)
|
||||
- [Image Scanning Issues](#image-scanning-issues)
|
||||
- [Image Patching Issues](#image-patching-issues)
|
||||
- [Operator Issues](#operator-issues)
|
||||
- [MCP Server Issues](#mcp-server-issues)
|
||||
- [Output and Reporting Issues](#output-and-reporting-issues)
|
||||
- [Performance Issues](#performance-issues)
|
||||
- [Getting Help](#getting-help)
|
||||
|
||||
---
|
||||
|
||||
## Installation Issues
|
||||
|
||||
### Command not found after installation
|
||||
|
||||
**Symptom:** After running the install script, `kubescape` command is not found.
|
||||
|
||||
**Solution:**
|
||||
|
||||
1. Check if the binary was installed:
|
||||
```bash
|
||||
ls -la ~/.kubescape/kubescape
|
||||
```
|
||||
|
||||
2. Add to your PATH:
|
||||
```bash
|
||||
# For bash
|
||||
echo 'export PATH=$PATH:~/.kubescape' >> ~/.bashrc
|
||||
source ~/.bashrc
|
||||
|
||||
# For zsh
|
||||
echo 'export PATH=$PATH:~/.kubescape' >> ~/.zshrc
|
||||
source ~/.zshrc
|
||||
```
|
||||
|
||||
3. Alternatively, move the binary to a directory already in your PATH:
|
||||
```bash
|
||||
sudo mv ~/.kubescape/kubescape /usr/local/bin/
|
||||
```
|
||||
|
||||
### Permission denied during installation
|
||||
|
||||
**Symptom:** Installation fails with permission errors.
|
||||
|
||||
**Solution:**
|
||||
|
||||
```bash
|
||||
# Create the directory with proper permissions
|
||||
mkdir -p ~/.kubescape
|
||||
chmod 755 ~/.kubescape
|
||||
|
||||
# Re-run the installation
|
||||
curl -s https://raw.githubusercontent.com/kubescape/kubescape/master/install.sh | /bin/bash
|
||||
```
|
||||
|
||||
### Installation fails on Windows
|
||||
|
||||
**Symptom:** PowerShell script fails to execute.
|
||||
|
||||
**Solution:**
|
||||
|
||||
1. Check PowerShell version (must be v5.0+):
|
||||
```powershell
|
||||
$PSVersionTable.PSVersion
|
||||
```
|
||||
|
||||
2. Set execution policy:
|
||||
```powershell
|
||||
Set-ExecutionPolicy RemoteSigned -Scope CurrentUser
|
||||
```
|
||||
|
||||
3. Retry installation:
|
||||
```powershell
|
||||
iwr -useb https://raw.githubusercontent.com/kubescape/kubescape/master/install.ps1 | iex
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Scanning Issues
|
||||
|
||||
### Cannot connect to cluster
|
||||
|
||||
**Symptom:** `kubescape scan` fails with connection errors.
|
||||
|
||||
**Solutions:**
|
||||
|
||||
1. Verify kubectl works:
|
||||
```bash
|
||||
kubectl get nodes
|
||||
```
|
||||
|
||||
2. Check your kubeconfig:
|
||||
```bash
|
||||
kubectl config current-context
|
||||
kubectl config view
|
||||
```
|
||||
|
||||
3. Use an explicit kubeconfig:
|
||||
```bash
|
||||
kubescape scan --kubeconfig /path/to/kubeconfig
|
||||
```
|
||||
|
||||
4. Use a specific context:
|
||||
```bash
|
||||
kubescape scan --kube-context my-context
|
||||
```
|
||||
|
||||
### Scan times out
|
||||
|
||||
**Symptom:** Scanning large clusters takes too long or times out.
|
||||
|
||||
**Solutions:**
|
||||
|
||||
1. Scan specific namespaces:
|
||||
```bash
|
||||
kubescape scan --include-namespaces production,staging
|
||||
```
|
||||
|
||||
2. Exclude non-essential namespaces:
|
||||
```bash
|
||||
kubescape scan --exclude-namespaces kube-system,kube-public,monitoring
|
||||
```
|
||||
|
||||
3. Scan a specific framework instead of all:
|
||||
```bash
|
||||
kubescape scan framework nsa
|
||||
```
|
||||
|
||||
### No results returned
|
||||
|
||||
**Symptom:** Scan completes but shows no results.
|
||||
|
||||
**Solutions:**
|
||||
|
||||
1. Check if the cluster has workloads:
|
||||
```bash
|
||||
kubectl get pods --all-namespaces
|
||||
```
|
||||
|
||||
2. Run with verbose output:
|
||||
```bash
|
||||
kubescape scan -v
|
||||
```
|
||||
|
||||
3. Check for namespace filtering issues:
|
||||
```bash
|
||||
# Make sure you're not excluding all namespaces
|
||||
kubescape scan --include-namespaces default
|
||||
```
|
||||
|
||||
### Framework or control not found
|
||||
|
||||
**Symptom:** Error about unknown framework or control.
|
||||
|
||||
**Solutions:**
|
||||
|
||||
1. List available frameworks:
|
||||
```bash
|
||||
kubescape list frameworks
|
||||
```
|
||||
|
||||
2. List available controls:
|
||||
```bash
|
||||
kubescape list controls
|
||||
```
|
||||
|
||||
3. Update Kubescape to get latest controls:
|
||||
```bash
|
||||
# Re-run installation to get latest version
|
||||
curl -s https://raw.githubusercontent.com/kubescape/kubescape/master/install.sh | /bin/bash
|
||||
```
|
||||
|
||||
4. Download latest artifacts:
|
||||
```bash
|
||||
kubescape download artifacts
|
||||
```
|
||||
|
||||
### RBAC errors during scan
|
||||
|
||||
**Symptom:** Scan fails with permission denied errors.
|
||||
|
||||
**Solution:**
|
||||
|
||||
Ensure your kubeconfig user has sufficient permissions. At minimum, you need read access to:
|
||||
- Deployments, DaemonSets, StatefulSets, Jobs, CronJobs
|
||||
- Pods, Services, ConfigMaps, Secrets
|
||||
- Roles, RoleBindings, ClusterRoles, ClusterRoleBindings
|
||||
- NetworkPolicies
|
||||
- ServiceAccounts
|
||||
|
||||
---
|
||||
|
||||
## Image Scanning Issues
|
||||
|
||||
### Image not found
|
||||
|
||||
**Symptom:** `kubescape scan image` fails to find the image.
|
||||
|
||||
**Solutions:**
|
||||
|
||||
1. Use the full image reference:
|
||||
```bash
|
||||
kubescape scan image docker.io/library/nginx:1.21
|
||||
```
|
||||
|
||||
2. For private registries, provide credentials:
|
||||
```bash
|
||||
kubescape scan image myregistry.io/myimage:tag \
|
||||
--username myuser \
|
||||
--password mypassword
|
||||
```
|
||||
|
||||
3. Check if the image exists locally:
|
||||
```bash
|
||||
docker images | grep myimage
|
||||
```
|
||||
|
||||
### Authentication failed for private registry
|
||||
|
||||
**Symptom:** Scan fails with authentication errors.
|
||||
|
||||
**Solutions:**
|
||||
|
||||
1. Verify credentials work with docker:
|
||||
```bash
|
||||
docker login myregistry.io
|
||||
docker pull myregistry.io/myimage:tag
|
||||
```
|
||||
|
||||
2. Use environment variables for credentials:
|
||||
```bash
|
||||
export KUBESCAPE_REGISTRY_USERNAME=myuser
|
||||
export KUBESCAPE_REGISTRY_PASSWORD=mypassword
|
||||
kubescape scan image myregistry.io/myimage:tag
|
||||
```
|
||||
|
||||
### Vulnerability database outdated
|
||||
|
||||
**Symptom:** Known CVEs are not being detected.
|
||||
|
||||
**Solution:**
|
||||
|
||||
The vulnerability database is updated automatically. To force an update:
|
||||
|
||||
```bash
|
||||
# Clear the cache
|
||||
rm -rf ~/.kubescape/grype-db
|
||||
|
||||
# Run a new scan
|
||||
kubescape scan image nginx:latest
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Image Patching Issues
|
||||
|
||||
### BuildKit not running
|
||||
|
||||
**Symptom:** `kubescape patch` fails with BuildKit connection errors.
|
||||
|
||||
**Solutions:**
|
||||
|
||||
1. Start BuildKit:
|
||||
```bash
|
||||
sudo buildkitd &
|
||||
```
|
||||
|
||||
2. Or run BuildKit in Docker:
|
||||
```bash
|
||||
docker run --detach --rm --privileged \
|
||||
-p 127.0.0.1:8888:8888/tcp \
|
||||
--name buildkitd \
|
||||
--entrypoint buildkitd \
|
||||
moby/buildkit:latest \
|
||||
--addr tcp://0.0.0.0:8888
|
||||
|
||||
kubescape patch -i nginx:1.22 -a tcp://0.0.0.0:8888
|
||||
```
|
||||
|
||||
3. Check BuildKit socket:
|
||||
```bash
|
||||
ls -la /run/buildkit/buildkitd.sock
|
||||
```
|
||||
|
||||
### Patching fails with no fixes available
|
||||
|
||||
**Symptom:** Patch command reports no patches available.
|
||||
|
||||
**Explanation:** Image patching only fixes OS-level vulnerabilities that have available patches. Application-level vulnerabilities or vulnerabilities without fixes cannot be patched.
|
||||
|
||||
**Solution:**
|
||||
|
||||
1. Check the vulnerability report:
|
||||
```bash
|
||||
kubescape scan image myimage:tag -v
|
||||
```
|
||||
|
||||
2. Look for vulnerabilities marked as "wont-fix" or without fix versions.
|
||||
|
||||
3. Consider updating the base image to a newer version.
|
||||
|
||||
### Permission denied during patching
|
||||
|
||||
**Symptom:** Patch fails with permission errors.
|
||||
|
||||
**Solution:**
|
||||
|
||||
Run with sudo when using the default Unix socket:
|
||||
```bash
|
||||
sudo kubescape patch --image nginx:1.22
|
||||
```
|
||||
|
||||
Or use the Docker-based BuildKit approach which doesn't require sudo.
|
||||
|
||||
---
|
||||
|
||||
## Operator Issues
|
||||
|
||||
### Operator not responding to CLI commands
|
||||
|
||||
**Symptom:** `kubescape operator scan` hangs or fails.
|
||||
|
||||
**Solutions:**
|
||||
|
||||
1. Verify the operator is installed:
|
||||
```bash
|
||||
kubectl -n kubescape get pods
|
||||
```
|
||||
|
||||
2. Check operator logs:
|
||||
```bash
|
||||
kubectl -n kubescape logs -l app=kubescape-operator
|
||||
```
|
||||
|
||||
3. Verify the operator service:
|
||||
```bash
|
||||
kubectl -n kubescape get svc
|
||||
```
|
||||
|
||||
### No vulnerability manifests in cluster
|
||||
|
||||
**Symptom:** No VulnerabilityManifest CRs found.
|
||||
|
||||
**Solutions:**
|
||||
|
||||
1. Check if vulnerability scanning is enabled:
|
||||
```bash
|
||||
kubectl -n kubescape get configmap kubescape-config -o yaml
|
||||
```
|
||||
|
||||
2. Verify kubevuln is running:
|
||||
```bash
|
||||
kubectl -n kubescape get pods -l app=kubevuln
|
||||
```
|
||||
|
||||
3. Check kubevuln logs:
|
||||
```bash
|
||||
kubectl -n kubescape logs -l app=kubevuln
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## MCP Server Issues
|
||||
|
||||
### MCP server fails to start
|
||||
|
||||
**Symptom:** `kubescape mcpserver` exits with errors.
|
||||
|
||||
**Solutions:**
|
||||
|
||||
1. Verify kubectl connectivity:
|
||||
```bash
|
||||
kubectl get nodes
|
||||
```
|
||||
|
||||
2. Check if the operator CRDs are installed:
|
||||
```bash
|
||||
kubectl get crd vulnerabilitymanifests.spdx.softwarecomposition.kubescape.io
|
||||
kubectl get crd workloadconfigurationscans.spdx.softwarecomposition.kubescape.io
|
||||
```
|
||||
|
||||
3. Install the Kubescape operator if not present:
|
||||
```bash
|
||||
helm repo add kubescape https://kubescape.github.io/helm-charts/
|
||||
helm upgrade --install kubescape kubescape/kubescape-operator \
|
||||
--namespace kubescape --create-namespace
|
||||
```
|
||||
|
||||
### AI assistant cannot connect to MCP server
|
||||
|
||||
**Symptom:** AI tool reports connection failures.
|
||||
|
||||
**Solutions:**
|
||||
|
||||
1. Verify the MCP server is running:
|
||||
```bash
|
||||
kubescape mcpserver
|
||||
```
|
||||
|
||||
2. Check your AI tool's MCP configuration:
|
||||
```json
|
||||
{
|
||||
"mcpServers": {
|
||||
"kubescape": {
|
||||
"command": "kubescape",
|
||||
"args": ["mcpserver"]
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
3. Ensure kubescape is in your PATH.
|
||||
|
||||
---
|
||||
|
||||
## Output and Reporting Issues
|
||||
|
||||
### JSON output is malformed
|
||||
|
||||
**Symptom:** JSON output cannot be parsed.
|
||||
|
||||
**Solution:**
|
||||
|
||||
Ensure you're redirecting to a file, not mixing with console output:
|
||||
```bash
|
||||
kubescape scan --format json --output results.json
|
||||
```
|
||||
|
||||
### SARIF format fails
|
||||
|
||||
**Symptom:** SARIF output not working.
|
||||
|
||||
**Note:** SARIF format is only supported for file/repository scans, not live cluster scans.
|
||||
|
||||
**Solution:**
|
||||
```bash
|
||||
# This works
|
||||
kubescape scan /path/to/manifests --format sarif --output results.sarif
|
||||
|
||||
# This does NOT work
|
||||
kubescape scan --format sarif --output results.sarif # cluster scan
|
||||
```
|
||||
|
||||
### HTML/PDF report generation fails
|
||||
|
||||
**Symptom:** Report generation fails or produces empty files.
|
||||
|
||||
**Solutions:**
|
||||
|
||||
1. Ensure you have write permissions to the output directory.
|
||||
|
||||
2. Check available disk space.
|
||||
|
||||
3. Try JSON first to verify scan works:
|
||||
```bash
|
||||
kubescape scan --format json --output test.json
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Performance Issues
|
||||
|
||||
### High memory usage during scan
|
||||
|
||||
**Solutions:**
|
||||
|
||||
1. Scan fewer namespaces:
|
||||
```bash
|
||||
kubescape scan --include-namespaces production
|
||||
```
|
||||
|
||||
2. Scan one framework at a time:
|
||||
```bash
|
||||
kubescape scan framework nsa
|
||||
```
|
||||
|
||||
3. Use the operator for large clusters instead of CLI scanning.
|
||||
|
||||
### Slow vulnerability database downloads
|
||||
|
||||
**Solutions:**
|
||||
|
||||
1. Use offline mode with pre-downloaded artifacts:
|
||||
```bash
|
||||
# On a machine with good connectivity
|
||||
kubescape download artifacts --output /path/to/artifacts
|
||||
|
||||
# On the target machine
|
||||
kubescape scan --use-artifacts-from /path/to/artifacts
|
||||
```
|
||||
|
||||
2. Configure a proxy if needed:
|
||||
```bash
|
||||
export HTTPS_PROXY=http://proxy:8080
|
||||
kubescape scan
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Getting Help
|
||||
|
||||
If you're still experiencing issues:
|
||||
|
||||
1. **Check the logs** with debug logging:
|
||||
```bash
|
||||
kubescape scan -l debug
|
||||
```
|
||||
|
||||
2. **Search existing issues:**
|
||||
https://github.com/kubescape/kubescape/issues
|
||||
|
||||
3. **Join the community Slack:**
|
||||
- [Users Channel](https://cloud-native.slack.com/archives/C04EY3ZF9GE)
|
||||
- [Developers Channel](https://cloud-native.slack.com/archives/C04GY6H082K)
|
||||
|
||||
4. **Open a new issue** with:
|
||||
- Kubescape version (`kubescape version`)
|
||||
- Kubernetes version (`kubectl version`)
|
||||
- Full error message
|
||||
- Steps to reproduce
|
||||
- Debug logs (`kubescape scan -l debug 2>&1 | tee debug.log`)
|
||||
@@ -1,111 +1,129 @@
|
||||
# Kubescape Exceptions
|
||||
|
||||
Kubescape Exceptions is the proper way of excluding failed resources from affecting the risk score.
|
||||
Kubescape Exceptions allow you to exclude specific resources from affecting your security risk score. This is useful when certain resources intentionally deviate from security best practices and you want to acknowledge this without impacting your overall compliance metrics.
|
||||
|
||||
e.g. When a `kube-system` resource fails and it is ok, simply add the resource to the exceptions configurations.
|
||||
## Table of Contents
|
||||
|
||||
## Definitions
|
||||
- [Use Cases](#use-cases)
|
||||
- [Exception Structure](#exception-structure)
|
||||
- [Usage](#usage)
|
||||
- [Examples](#examples)
|
||||
- [Related Documentation](#related-documentation)
|
||||
|
||||
---
|
||||
|
||||
* `name`- Exception name - unique name representing the exception
|
||||
* `policyType`- Do not change
|
||||
* `actions`- List of available actions. Currently, alertOnly is supported
|
||||
* `resources`- List of resources to apply this exception on
|
||||
* `designatorType: Attributes`- An attribute-based declaration {key: value}
|
||||
Supported keys:
|
||||
* `name`: k8s resource name (case-sensitive, regex supported)
|
||||
* `kind`: k8s resource kind (case-sensitive, regex supported)
|
||||
* `namespace`: k8s resource namespace (case-sensitive, regex supported)
|
||||
* `cluster`: k8s cluster name (usually it is the `current-context`) (case-sensitive, regex supported)
|
||||
* resource labels as key value (case-sensitive, regex NOT supported)
|
||||
* `posturePolicies`- An attribute-based declaration {key: value}
|
||||
* `frameworkName` - Framework names can be found [here](https://github.com/armosec/regolibrary/tree/master/frameworks) (regex supported)
|
||||
* `controlName` - Control names can be found [here](https://github.com/armosec/regolibrary/tree/master/controls) (regex supported)
|
||||
* `controlID` - Control ID can be found [here](https://github.com/armosec/regolibrary/tree/master/controls) (regex supported)
|
||||
|
||||
You can find [here](https://github.com/kubescape/kubescape/tree/master/examples/exceptions) some examples of exceptions files
|
||||
## Use Cases
|
||||
|
||||
- Exclude `kube-system` resources that are expected to have elevated privileges
|
||||
- Ignore development/test namespaces from production compliance reports
|
||||
- Accept known risks for specific workloads after security review
|
||||
- Temporarily exclude resources while fixes are being implemented
|
||||
|
||||
---
|
||||
|
||||
## Exception Structure
|
||||
|
||||
An exception file is a JSON array containing one or more exception objects:
|
||||
|
||||
```json
|
||||
[
|
||||
{
|
||||
"name": "exception-name",
|
||||
"policyType": "postureExceptionPolicy",
|
||||
"actions": ["alertOnly"],
|
||||
"resources": [...],
|
||||
"posturePolicies": [...]
|
||||
}
|
||||
]
|
||||
```
|
||||
|
||||
### Fields
|
||||
|
||||
| Field | Description |
|
||||
|-------|-------------|
|
||||
| `name` | Unique name for this exception |
|
||||
| `policyType` | Must be `"postureExceptionPolicy"` |
|
||||
| `actions` | List of actions. Currently only `"alertOnly"` is supported |
|
||||
| `resources` | List of resources to apply this exception to |
|
||||
| `posturePolicies` | List of policies/controls to exclude |
|
||||
|
||||
### Resource Attributes
|
||||
|
||||
Resources are defined using attribute-based selectors. Supported attributes:
|
||||
|
||||
| Attribute | Description | Regex Support |
|
||||
|-----------|-------------|---------------|
|
||||
| `name` | Kubernetes resource name | ✅ Yes |
|
||||
| `kind` | Kubernetes resource kind (e.g., `Deployment`, `Pod`) | ✅ Yes |
|
||||
| `namespace` | Kubernetes namespace | ✅ Yes |
|
||||
| `cluster` | Cluster name (usually the `current-context`) | ✅ Yes |
|
||||
| `<label-key>` | Any resource label (e.g., `app`, `environment`) | ❌ No |
|
||||
|
||||
### Policy Attributes
|
||||
|
||||
Policies can be specified by:
|
||||
|
||||
| Attribute | Description | Regex Support |
|
||||
|-----------|-------------|---------------|
|
||||
| `frameworkName` | Framework name (e.g., `NSA`, `MITRE`) | ✅ Yes |
|
||||
| `controlName` | Control name (e.g., `HostPath mount`) | ✅ Yes |
|
||||
| `controlID` | Control ID (e.g., `C-0048`) | ✅ Yes |
|
||||
|
||||
Find framework names in the [frameworks directory](https://github.com/kubescape/regolibrary/tree/master/frameworks) and control information in the [controls directory](https://github.com/kubescape/regolibrary/tree/master/controls).
|
||||
|
||||
---
|
||||
|
||||
## Usage
|
||||
|
||||
The `resources` list and `posturePolicies` list are designed to be a combination of the resources and policies to exclude.
|
||||
### Running a Scan with Exceptions
|
||||
|
||||
> **Warning**
|
||||
> You must declare at least one resource and one policy.
|
||||
|
||||
e.g. If you wish to exclude all namespaces with the label `"environment": "dev"`, the resource list should look as follows:
|
||||
```bash
|
||||
kubescape scan --exceptions /path/to/exceptions.json
|
||||
```
|
||||
|
||||
Resources matching exceptions will be marked as `excluded` rather than `failed` in the results.
|
||||
|
||||
### Logic Rules
|
||||
|
||||
> ⚠️ **Important**: You must declare at least one resource AND one policy in each exception.
|
||||
|
||||
#### Within a list: OR logic
|
||||
|
||||
Multiple items in the `resources` list are evaluated with **OR** logic:
|
||||
|
||||
```json
|
||||
"resources": [
|
||||
{
|
||||
"designatorType": "Attributes",
|
||||
"attributes": {
|
||||
"namespace": ".*",
|
||||
"environment": "dev"
|
||||
}
|
||||
}
|
||||
{ "attributes": { "namespace": "dev" } },
|
||||
{ "attributes": { "namespace": "test" } }
|
||||
]
|
||||
```
|
||||
This matches resources in the `dev` namespace **OR** the `test` namespace.
|
||||
|
||||
But if you wish to exclude all namespaces **OR** any resource with the label `"environment": "dev"`, the resource list should look as follows:
|
||||
```
|
||||
#### Within an object: AND logic
|
||||
|
||||
Multiple attributes in a single object are evaluated with **AND** logic:
|
||||
|
||||
```json
|
||||
"resources": [
|
||||
{
|
||||
"designatorType": "Attributes",
|
||||
"attributes": {
|
||||
"namespace": ".*"
|
||||
}
|
||||
},
|
||||
{
|
||||
"designatorType": "Attributes",
|
||||
"attributes": {
|
||||
"environment": "dev"
|
||||
}
|
||||
}
|
||||
{ "attributes": { "namespace": "production", "kind": "Deployment" } }
|
||||
]
|
||||
```
|
||||
This matches only `Deployment` resources **AND** in the `production` namespace.
|
||||
|
||||
Same works with the `posturePolicies` list ->
|
||||
|
||||
e.g. If you wish to exclude the resources declared in the `resources` list that failed when scanning the `NSA` framework **AND** failed the `HostPath mount` control, the `posturePolicies` list should look as follows:
|
||||
```
|
||||
"posturePolicies": [
|
||||
{
|
||||
"frameworkName": "NSA",
|
||||
"controlName": "HostPath mount"
|
||||
}
|
||||
]
|
||||
```
|
||||
|
||||
But if you wish to exclude the resources declared in the `resources` list that failed when scanning the `NSA` framework **OR** failed the `HostPath mount` control, the `posturePolicies` list should look as follows:
|
||||
```
|
||||
"posturePolicies": [
|
||||
{
|
||||
"frameworkName": "NSA"
|
||||
},
|
||||
{
|
||||
"controlName": "HostPath mount"
|
||||
}
|
||||
]
|
||||
```
|
||||
---
|
||||
|
||||
## Examples
|
||||
|
||||
Here are some examples demonstrating the different ways the exceptions file can be configured
|
||||
### Exclude a Specific Control Everywhere
|
||||
|
||||
Exclude control [C-0048 (HostPath mount)](https://kubescape.io/docs/controls/c-0048/) for all resources:
|
||||
|
||||
### Exclude control
|
||||
|
||||
Exclude the [C-0060 control](https://github.com/armosec/regolibrary/blob/master/controls/allowedhostpath.json#L2) by declaring the control ID in the `"posturePolicies"` section.
|
||||
|
||||
The resources
|
||||
|
||||
```
|
||||
```json
|
||||
[
|
||||
{
|
||||
"name": "exclude-allowed-hostPath-control",
|
||||
"name": "exclude-hostpath-control",
|
||||
"policyType": "postureExceptionPolicy",
|
||||
"actions": [
|
||||
"alertOnly"
|
||||
],
|
||||
"actions": ["alertOnly"],
|
||||
"resources": [
|
||||
{
|
||||
"designatorType": "Attributes",
|
||||
@@ -116,22 +134,48 @@ The resources
|
||||
],
|
||||
"posturePolicies": [
|
||||
{
|
||||
"controlID": "C-0060"
|
||||
"controlID": "C-0048"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
```
|
||||
|
||||
### Exclude deployments in the default namespace that failed the "HostPath mount" control
|
||||
```
|
||||
### Exclude All kube-system Resources
|
||||
|
||||
Exclude all resources in the `kube-system` namespace from all frameworks:
|
||||
|
||||
```json
|
||||
[
|
||||
{
|
||||
"name": "exclude-deployments-in-ns-default",
|
||||
"name": "exclude-kube-system",
|
||||
"policyType": "postureExceptionPolicy",
|
||||
"actions": [
|
||||
"alertOnly"
|
||||
"actions": ["alertOnly"],
|
||||
"resources": [
|
||||
{
|
||||
"designatorType": "Attributes",
|
||||
"attributes": {
|
||||
"namespace": "kube-system"
|
||||
}
|
||||
}
|
||||
],
|
||||
"posturePolicies": [
|
||||
{
|
||||
"frameworkName": ".*"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
```
|
||||
|
||||
### Exclude Deployments in Default Namespace for a Specific Control
|
||||
|
||||
```json
|
||||
[
|
||||
{
|
||||
"name": "exclude-deployments-in-default",
|
||||
"policyType": "postureExceptionPolicy",
|
||||
"actions": ["alertOnly"],
|
||||
"resources": [
|
||||
{
|
||||
"designatorType": "Attributes",
|
||||
@@ -143,22 +187,53 @@ The resources
|
||||
],
|
||||
"posturePolicies": [
|
||||
{
|
||||
"controlName": "HostPath mount"
|
||||
"controlName": "HostPath mount"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
```
|
||||
|
||||
### Exclude resources with label "app=nginx" running in a minikube cluster that failed the "NSA" or "MITRE" framework
|
||||
### Exclude Resources by Label
|
||||
|
||||
Exclude resources with label `environment=dev` from NSA and MITRE frameworks:
|
||||
|
||||
```json
|
||||
[
|
||||
{
|
||||
"name": "exclude-dev-environment",
|
||||
"policyType": "postureExceptionPolicy",
|
||||
"actions": ["alertOnly"],
|
||||
"resources": [
|
||||
{
|
||||
"designatorType": "Attributes",
|
||||
"attributes": {
|
||||
"environment": "dev"
|
||||
}
|
||||
}
|
||||
],
|
||||
"posturePolicies": [
|
||||
{
|
||||
"frameworkName": "NSA"
|
||||
},
|
||||
{
|
||||
"frameworkName": "MITRE"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
```
|
||||
|
||||
### Exclude Specific Workload in Specific Cluster
|
||||
|
||||
Exclude nginx resources in a minikube cluster:
|
||||
|
||||
```json
|
||||
[
|
||||
{
|
||||
"name": "exclude-nginx-minikube",
|
||||
"policyType": "postureExceptionPolicy",
|
||||
"actions": [
|
||||
"alertOnly"
|
||||
],
|
||||
"actions": ["alertOnly"],
|
||||
"resources": [
|
||||
{
|
||||
"designatorType": "Attributes",
|
||||
@@ -170,12 +245,71 @@ The resources
|
||||
],
|
||||
"posturePolicies": [
|
||||
{
|
||||
"frameworkName": "NSA"
|
||||
},
|
||||
{
|
||||
"frameworkName": "MITRE"
|
||||
"frameworkName": ".*"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
```
|
||||
|
||||
### Multiple Exceptions in One File
|
||||
|
||||
You can combine multiple exceptions in a single file:
|
||||
|
||||
```json
|
||||
[
|
||||
{
|
||||
"name": "exclude-kube-namespaces",
|
||||
"policyType": "postureExceptionPolicy",
|
||||
"actions": ["alertOnly"],
|
||||
"resources": [
|
||||
{
|
||||
"designatorType": "Attributes",
|
||||
"attributes": {
|
||||
"namespace": "kube-system"
|
||||
}
|
||||
},
|
||||
{
|
||||
"designatorType": "Attributes",
|
||||
"attributes": {
|
||||
"namespace": "kube-public"
|
||||
}
|
||||
}
|
||||
],
|
||||
"posturePolicies": [
|
||||
{
|
||||
"frameworkName": ".*"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "exclude-privileged-control-for-monitoring",
|
||||
"policyType": "postureExceptionPolicy",
|
||||
"actions": ["alertOnly"],
|
||||
"resources": [
|
||||
{
|
||||
"designatorType": "Attributes",
|
||||
"attributes": {
|
||||
"namespace": "monitoring"
|
||||
}
|
||||
}
|
||||
],
|
||||
"posturePolicies": [
|
||||
{
|
||||
"controlID": "C-0057"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Related Documentation
|
||||
|
||||
- [Getting Started Guide](../../docs/getting-started.md)
|
||||
- [CLI Reference](../../docs/cli-reference.md)
|
||||
- [Controls Reference](https://kubescape.io/docs/controls/)
|
||||
- [Regolibrary - Frameworks](https://github.com/kubescape/regolibrary/tree/master/frameworks)
|
||||
- [Regolibrary - Controls](https://github.com/kubescape/regolibrary/tree/master/controls)
|
||||
- [Accepting Risk Documentation](https://kubescape.io/docs/accepting-risk/)
|
||||
@@ -1,26 +1,47 @@
|
||||
# Helm chart - DEPRECATED
|
||||
# Helm Chart Examples
|
||||
|
||||
[helm chart repo](https://github.com/armosec/armo-helm)
|
||||
> ⚠️ **DEPRECATED**: This directory contains legacy Helm chart examples that are no longer maintained.
|
||||
|
||||
## Current Helm Charts
|
||||
|
||||
## Values
|
||||
For the latest Kubescape Helm charts, please visit:
|
||||
|
||||
| Key | Type | Default | Description |
|
||||
|-----|------|---------|-------------|
|
||||
| affinity | object | `{}` | |
|
||||
| configMap | object | `{"create":true,"params":{"clusterName":"<MyK8sClusterName>","customerGUID":"<MyGUID>,"}}` | ARMO customer information |
|
||||
| fullnameOverride | string | `""` | |
|
||||
| image | object | `{"imageName":"kubescape","pullPolicy":"IfNotPresent","repository":"quay.io/armosec","tag":"latest"}` | Image and version to deploy |
|
||||
| imagePullSecrets | list | `[]` | |
|
||||
| nameOverride | string | `""` | |
|
||||
| nodeSelector | object | `{}` | |
|
||||
| podAnnotations | object | `{}` | |
|
||||
| podSecurityContext | object | `{}` | |
|
||||
| resources | object | `{"limits":{"cpu":"500m","memory":"512Mi"},"requests":{"cpu":"200m","memory":"256Mi"}}` | Default resources for running the service in cluster |
|
||||
| schedule | string | `"0 0 * * *"` | Frequency of running the scan |
|
||||
| securityContext | object | `{}` | |
|
||||
| serviceAccount | object | `{"annotations":{},"create":true,"name":"kubescape-discovery"}` | Service account that runs the scan and has permissions to view the cluster |
|
||||
| tolerations | list | `[]` | |
|
||||
**[Kubescape Helm Charts Repository](https://github.com/kubescape/helm-charts)**
|
||||
|
||||
----------------------------------------------
|
||||
Autogenerated from chart metadata using [helm-docs v1.5.0](https://github.com/norwoodj/helm-docs/releases/v1.5.0)
|
||||
## Quick Install
|
||||
|
||||
```bash
|
||||
# Add the Kubescape Helm repository
|
||||
helm repo add kubescape https://kubescape.github.io/helm-charts/
|
||||
helm repo update
|
||||
|
||||
# Install the Kubescape operator
|
||||
helm upgrade --install kubescape kubescape/kubescape-operator \
|
||||
--namespace kubescape \
|
||||
--create-namespace
|
||||
```
|
||||
|
||||
## Available Charts
|
||||
|
||||
| Chart | Description |
|
||||
|-------|-------------|
|
||||
| [kubescape-operator](https://github.com/kubescape/helm-charts/tree/main/charts/kubescape-operator) | Full Kubescape in-cluster operator |
|
||||
|
||||
## Documentation
|
||||
|
||||
- [Operator Installation Guide](https://kubescape.io/docs/install-operator/)
|
||||
- [Operator Configuration Options](https://github.com/kubescape/helm-charts/blob/main/charts/kubescape-operator/README.md)
|
||||
- [Prometheus Integration](https://github.com/kubescape/helm-charts/blob/main/charts/kubescape-operator/README.md#kubescape-prometheus-integration)
|
||||
|
||||
## Migration from Legacy Charts
|
||||
|
||||
If you were using the legacy `armo-helm` charts, please migrate to the new `kubescape/helm-charts` repository. The new charts provide:
|
||||
|
||||
- Continuous vulnerability scanning
|
||||
- Configuration scanning
|
||||
- Runtime threat detection (eBPF-based)
|
||||
- Network policy generation
|
||||
- Prometheus metrics
|
||||
- And more...
|
||||
|
||||
See the [migration guide](https://kubescape.io/docs/install-operator/) for detailed instructions.
|
||||
420
go.mod
420
go.mod
@@ -1,8 +1,6 @@
|
||||
module github.com/kubescape/kubescape/v3
|
||||
|
||||
go 1.24.1
|
||||
|
||||
toolchain go1.24.6
|
||||
go 1.25.5
|
||||
|
||||
require (
|
||||
github.com/adrg/xdg v0.5.3
|
||||
@@ -16,14 +14,14 @@ require (
|
||||
github.com/armosec/utils-k8s-go v0.0.30
|
||||
github.com/briandowns/spinner v1.23.2
|
||||
github.com/chainguard-dev/git-urls v1.0.2
|
||||
github.com/containerd/platforms v1.0.0-rc.1
|
||||
github.com/containerd/platforms v1.0.0-rc.2
|
||||
github.com/distribution/reference v0.6.0
|
||||
github.com/docker/buildx v0.21.3
|
||||
github.com/docker/cli v28.3.3+incompatible
|
||||
github.com/docker/buildx v0.30.1
|
||||
github.com/docker/cli v29.0.3+incompatible
|
||||
github.com/enescakir/emoji v1.0.0
|
||||
github.com/francoispqt/gojay v1.2.13
|
||||
github.com/go-git/go-git/v5 v5.16.2
|
||||
github.com/google/go-containerregistry v0.20.6
|
||||
github.com/google/go-containerregistry v0.20.7
|
||||
github.com/google/uuid v1.6.0
|
||||
github.com/jedib0t/go-pretty/v6 v6.6.8
|
||||
github.com/johnfercher/go-tree v1.1.0
|
||||
@@ -31,7 +29,7 @@ require (
|
||||
github.com/json-iterator/go v1.1.12
|
||||
github.com/jwalton/gchalk v1.3.0
|
||||
github.com/kubescape/backend v0.0.20
|
||||
github.com/kubescape/go-git-url v0.0.30
|
||||
github.com/kubescape/go-git-url v0.0.31
|
||||
github.com/kubescape/go-logger v0.0.25
|
||||
github.com/kubescape/k8s-interface v0.0.195
|
||||
github.com/kubescape/opa-utils v0.0.288
|
||||
@@ -44,53 +42,53 @@ require (
|
||||
github.com/matthyx/go-gitlog v0.0.0-20231005131906-9ffabe3c5bcd
|
||||
github.com/mattn/go-isatty v0.0.20
|
||||
github.com/mikefarah/yq/v4 v4.29.1
|
||||
github.com/moby/buildkit v0.21.0
|
||||
github.com/open-policy-agent/opa v1.4.0
|
||||
github.com/moby/buildkit v0.26.1
|
||||
github.com/open-policy-agent/opa v1.12.1
|
||||
github.com/owenrumney/go-sarif/v2 v2.2.0
|
||||
github.com/project-copacetic/copacetic v0.10.0
|
||||
github.com/quay/claircore v1.5.35
|
||||
github.com/schollz/progressbar/v3 v3.13.0
|
||||
github.com/sergi/go-diff v1.4.0
|
||||
github.com/sigstore/cosign/v2 v2.2.4
|
||||
github.com/sirupsen/logrus v1.9.4-0.20230606125235-dd1b4c2e81af
|
||||
github.com/spf13/cobra v1.9.1
|
||||
github.com/sigstore/cosign/v3 v3.0.4
|
||||
github.com/sirupsen/logrus v1.9.4
|
||||
github.com/spf13/cobra v1.10.2
|
||||
github.com/stretchr/testify v1.11.1
|
||||
go.opentelemetry.io/otel v1.37.0
|
||||
go.opentelemetry.io/otel/metric v1.37.0
|
||||
golang.org/x/mod v0.27.0
|
||||
golang.org/x/term v0.34.0
|
||||
go.opentelemetry.io/otel v1.39.0
|
||||
go.opentelemetry.io/otel/metric v1.39.0
|
||||
golang.org/x/mod v0.31.0
|
||||
golang.org/x/sync v0.19.0
|
||||
golang.org/x/term v0.38.0
|
||||
gopkg.in/op/go-logging.v1 v1.0.0-20160211212156-b2cb9fa56473
|
||||
gopkg.in/yaml.v3 v3.0.1
|
||||
helm.sh/helm/v3 v3.18.5
|
||||
k8s.io/api v0.33.3
|
||||
k8s.io/apimachinery v0.33.3
|
||||
k8s.io/client-go v0.33.3
|
||||
k8s.io/utils v0.0.0-20241210054802-24370beab758
|
||||
modernc.org/sqlite v1.38.2
|
||||
k8s.io/api v0.35.0
|
||||
k8s.io/apimachinery v0.35.0
|
||||
k8s.io/client-go v0.35.0
|
||||
k8s.io/utils v0.0.0-20251002143259-bc988d571ff4
|
||||
sigs.k8s.io/kustomize/api v0.19.0
|
||||
sigs.k8s.io/kustomize/kyaml v0.19.0
|
||||
sigs.k8s.io/yaml v1.5.0
|
||||
sigs.k8s.io/yaml v1.6.0
|
||||
)
|
||||
|
||||
require (
|
||||
cel.dev/expr v0.24.0 // indirect
|
||||
cloud.google.com/go v0.121.3 // indirect
|
||||
cloud.google.com/go/auth v0.16.2 // indirect
|
||||
cel.dev/expr v0.25.1 // indirect
|
||||
cloud.google.com/go v0.121.6 // indirect
|
||||
cloud.google.com/go/auth v0.18.0 // indirect
|
||||
cloud.google.com/go/auth/oauth2adapt v0.2.8 // indirect
|
||||
cloud.google.com/go/compute/metadata v0.7.0 // indirect
|
||||
cloud.google.com/go/container v1.43.0 // indirect
|
||||
cloud.google.com/go/iam v1.5.2 // indirect
|
||||
cloud.google.com/go/monitoring v1.24.2 // indirect
|
||||
cloud.google.com/go/storage v1.55.0 // indirect
|
||||
cloud.google.com/go/compute/metadata v0.9.0 // indirect
|
||||
cloud.google.com/go/container v1.45.0 // indirect
|
||||
cloud.google.com/go/iam v1.5.3 // indirect
|
||||
cloud.google.com/go/monitoring v1.24.3 // indirect
|
||||
cloud.google.com/go/storage v1.57.1 // indirect
|
||||
cyphar.com/go-pathrs v0.2.1 // indirect
|
||||
dario.cat/mergo v1.0.2 // indirect
|
||||
filippo.io/edwards25519 v1.1.0 // indirect
|
||||
github.com/AdaLogics/go-fuzz-headers v0.0.0-20240806141605-e8a1dd7889d6 // indirect
|
||||
github.com/AdamKorcz/go-118-fuzz-build v0.0.0-20250520111509-a70c2aa677fa // indirect
|
||||
github.com/AliyunContainerService/ack-ram-tool/pkg/credentials/alibabacloudsdkgo/helper v0.2.0 // indirect
|
||||
github.com/AliyunContainerService/ack-ram-tool/pkg/credentials/provider v0.14.0 // indirect
|
||||
github.com/Azure/azure-sdk-for-go v68.0.0+incompatible // indirect
|
||||
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.17.1 // indirect
|
||||
github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.8.2 // indirect
|
||||
github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0 // indirect
|
||||
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.20.0 // indirect
|
||||
github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.13.1 // indirect
|
||||
github.com/Azure/azure-sdk-for-go/sdk/internal v1.11.2 // indirect
|
||||
github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization v1.0.0 // indirect
|
||||
github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v2 v2.1.1 // indirect
|
||||
github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v2 v2.4.0 // indirect
|
||||
@@ -103,13 +101,13 @@ require (
|
||||
github.com/Azure/go-autorest/autorest/date v0.3.0 // indirect
|
||||
github.com/Azure/go-autorest/logger v0.2.1 // indirect
|
||||
github.com/Azure/go-autorest/tracing v0.6.0 // indirect
|
||||
github.com/AzureAD/microsoft-authentication-library-for-go v1.3.3 // indirect
|
||||
github.com/AzureAD/microsoft-authentication-library-for-go v1.6.0 // indirect
|
||||
github.com/BurntSushi/toml v1.5.0 // indirect
|
||||
github.com/CycloneDX/cyclonedx-go v0.9.2 // indirect
|
||||
github.com/DataDog/zstd v1.5.7 // indirect
|
||||
github.com/GoogleCloudPlatform/opentelemetry-operations-go/detectors/gcp v1.29.0 // indirect
|
||||
github.com/GoogleCloudPlatform/opentelemetry-operations-go/exporter/metric v0.53.0 // indirect
|
||||
github.com/GoogleCloudPlatform/opentelemetry-operations-go/internal/resourcemapping v0.53.0 // indirect
|
||||
github.com/GoogleCloudPlatform/opentelemetry-operations-go/detectors/gcp v1.30.0 // indirect
|
||||
github.com/GoogleCloudPlatform/opentelemetry-operations-go/exporter/metric v0.54.0 // indirect
|
||||
github.com/GoogleCloudPlatform/opentelemetry-operations-go/internal/resourcemapping v0.54.0 // indirect
|
||||
github.com/Intevation/gval v1.3.0 // indirect
|
||||
github.com/Intevation/jsonpath v0.2.1 // indirect
|
||||
github.com/MakeNowJust/heredoc v1.0.0 // indirect
|
||||
@@ -118,7 +116,7 @@ require (
|
||||
github.com/Masterminds/semver/v3 v3.4.0 // indirect
|
||||
github.com/Masterminds/sprig/v3 v3.3.0 // indirect
|
||||
github.com/Microsoft/go-winio v0.6.2 // indirect
|
||||
github.com/Microsoft/hcsshim v0.13.0 // indirect
|
||||
github.com/Microsoft/hcsshim v0.14.0-rc.1 // indirect
|
||||
github.com/OneOfOne/xxhash v1.2.8 // indirect
|
||||
github.com/ProtonMail/go-crypto v1.3.0 // indirect
|
||||
github.com/STARRY-S/zip v0.2.3 // indirect
|
||||
@@ -138,7 +136,7 @@ require (
|
||||
github.com/alibabacloud-go/tea v1.2.1 // indirect
|
||||
github.com/alibabacloud-go/tea-utils v1.4.5 // indirect
|
||||
github.com/alibabacloud-go/tea-xml v1.1.3 // indirect
|
||||
github.com/aliyun/credentials-go v1.3.1 // indirect
|
||||
github.com/aliyun/credentials-go v1.3.2 // indirect
|
||||
github.com/anchore/archiver/v3 v3.5.3-0.20241210171143-5b1d8d1c7c51 // indirect
|
||||
github.com/anchore/fangs v0.0.0-20250716230140-94c22408c232 // indirect
|
||||
github.com/anchore/go-collections v0.0.0-20241211140901-567f400e9a46 // indirect
|
||||
@@ -157,25 +155,26 @@ require (
|
||||
github.com/aquasecurity/go-version v0.0.1 // indirect
|
||||
github.com/armosec/gojay v1.2.17 // indirect
|
||||
github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 // indirect
|
||||
github.com/aws/aws-sdk-go v1.55.7 // indirect
|
||||
github.com/aws/aws-sdk-go-v2 v1.36.5 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/config v1.29.17 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/credentials v1.17.70 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.32 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.36 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.36 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/internal/ini v1.8.3 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/service/ecr v1.45.1 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/service/ecrpublic v1.33.2 // indirect
|
||||
github.com/aws/aws-sdk-go v1.55.8 // indirect
|
||||
github.com/aws/aws-sdk-go-v2 v1.41.0 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/config v1.32.5 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/credentials v1.19.5 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.18.16 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.16 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.16 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/internal/ini v1.8.4 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/service/ecr v1.51.2 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/service/ecrpublic v1.38.2 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/service/eks v1.48.5 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/service/iam v1.35.3 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.12.4 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.12.17 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/service/sso v1.25.5 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.30.3 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/service/sts v1.34.0 // indirect
|
||||
github.com/aws/smithy-go v1.22.4 // indirect
|
||||
github.com/awslabs/amazon-ecr-credential-helper/ecr-login v0.10.1 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.4 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.13.16 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/service/signin v1.0.4 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/service/sso v1.30.7 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.35.12 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/service/sts v1.41.5 // indirect
|
||||
github.com/aws/smithy-go v1.24.0 // indirect
|
||||
github.com/awslabs/amazon-ecr-credential-helper/ecr-login v0.11.0 // indirect
|
||||
github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect
|
||||
github.com/becheran/wildmatch-go v1.0.0 // indirect
|
||||
github.com/beorn7/perks v1.0.1 // indirect
|
||||
@@ -190,52 +189,58 @@ require (
|
||||
github.com/bodgit/sevenzip v1.6.1 // indirect
|
||||
github.com/bodgit/windows v1.0.1 // indirect
|
||||
github.com/boombuler/barcode v1.0.2 // indirect
|
||||
github.com/buildkite/agent/v3 v3.62.0 // indirect
|
||||
github.com/buildkite/go-pipeline v0.3.2 // indirect
|
||||
github.com/buildkite/interpolate v0.0.0-20200526001904-07f35b4ae251 // indirect
|
||||
github.com/buildkite/agent/v3 v3.115.2 // indirect
|
||||
github.com/buildkite/go-pipeline v0.16.0 // indirect
|
||||
github.com/buildkite/interpolate v0.1.5 // indirect
|
||||
github.com/buildkite/roko v1.4.0 // indirect
|
||||
github.com/cenkalti/backoff/v4 v4.3.0 // indirect
|
||||
github.com/cenkalti/backoff/v5 v5.0.2 // indirect
|
||||
github.com/cenkalti/backoff/v5 v5.0.3 // indirect
|
||||
github.com/cespare/xxhash/v2 v2.3.0 // indirect
|
||||
github.com/chai2010/gettext-go v1.0.2 // indirect
|
||||
github.com/charmbracelet/bubbletea v1.3.10 // indirect
|
||||
github.com/charmbracelet/colorprofile v0.3.1 // indirect
|
||||
github.com/charmbracelet/lipgloss v1.1.0 // indirect
|
||||
github.com/charmbracelet/x/ansi v0.9.3 // indirect
|
||||
github.com/charmbracelet/x/ansi v0.10.2 // indirect
|
||||
github.com/charmbracelet/x/cellbuf v0.0.13 // indirect
|
||||
github.com/charmbracelet/x/term v0.2.1 // indirect
|
||||
github.com/chrismellard/docker-credential-acr-env v0.0.0-20230304212654-82a0ddb27589 // indirect
|
||||
github.com/cilium/cilium v1.16.9 // indirect
|
||||
github.com/cilium/cilium v1.16.17 // indirect
|
||||
github.com/clbanning/mxj/v2 v2.7.0 // indirect
|
||||
github.com/clipperhouse/displaywidth v0.6.0 // indirect
|
||||
github.com/clipperhouse/stringish v0.1.1 // indirect
|
||||
github.com/clipperhouse/uax29/v2 v2.3.0 // indirect
|
||||
github.com/cloudflare/circl v1.6.1 // indirect
|
||||
github.com/cncf/xds/go v0.0.0-20250501225837-2ac532fd4443 // indirect
|
||||
github.com/cncf/xds/go v0.0.0-20251022180443-0feb69152e9f // indirect
|
||||
github.com/common-nighthawk/go-figure v0.0.0-20210622060536-734e95fb86be // indirect
|
||||
github.com/containerd/cgroups/v3 v3.0.5 // indirect
|
||||
github.com/containerd/console v1.0.4 // indirect
|
||||
github.com/containerd/containerd v1.7.28 // indirect
|
||||
github.com/containerd/containerd/api v1.9.0 // indirect
|
||||
github.com/containerd/containerd/v2 v2.0.5 // indirect
|
||||
github.com/containerd/cgroups/v3 v3.1.0 // indirect
|
||||
github.com/containerd/console v1.0.5 // indirect
|
||||
github.com/containerd/containerd v1.7.29 // indirect
|
||||
github.com/containerd/containerd/api v1.10.0 // indirect
|
||||
github.com/containerd/containerd/v2 v2.2.1-0.20251115011841-efd86f2b0bc2 // indirect
|
||||
github.com/containerd/continuity v0.4.5 // indirect
|
||||
github.com/containerd/errdefs v1.0.0 // indirect
|
||||
github.com/containerd/errdefs/pkg v0.3.0 // indirect
|
||||
github.com/containerd/fifo v1.1.0 // indirect
|
||||
github.com/containerd/log v0.1.0 // indirect
|
||||
github.com/containerd/stargz-snapshotter/estargz v0.16.3 // indirect
|
||||
github.com/containerd/stargz-snapshotter/estargz v0.18.1 // indirect
|
||||
github.com/containerd/ttrpc v1.2.7 // indirect
|
||||
github.com/containerd/typeurl/v2 v2.2.3 // indirect
|
||||
github.com/containers/common v0.63.0 // indirect
|
||||
github.com/coreos/go-oidc/v3 v3.14.1 // indirect
|
||||
github.com/coreos/go-oidc/v3 v3.17.0 // indirect
|
||||
github.com/cpuguy83/dockercfg v0.3.2 // indirect
|
||||
github.com/cpuguy83/go-docker v0.3.0 // indirect
|
||||
github.com/cyberphone/json-canonicalization v0.0.0-20241213102144-19d51d7fe467 // indirect
|
||||
github.com/cyphar/filepath-securejoin v0.4.1 // indirect
|
||||
github.com/cyphar/filepath-securejoin v0.6.0 // indirect
|
||||
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
|
||||
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.4.0 // indirect
|
||||
github.com/deitch/magic v0.0.0-20240306090643-c67ab88f10cb // indirect
|
||||
github.com/digitorus/pkcs7 v0.0.0-20230818184609-3a137a874352 // indirect
|
||||
github.com/digitorus/timestamp v0.0.0-20231217203849-220c5c2851b7 // indirect
|
||||
github.com/dimchansky/utfbom v1.1.1 // indirect
|
||||
github.com/diskfs/go-diskfs v1.7.0 // indirect
|
||||
github.com/docker/distribution v2.8.3+incompatible // indirect
|
||||
github.com/docker/docker v28.3.3+incompatible // indirect
|
||||
github.com/docker/docker-credential-helpers v0.9.3 // indirect
|
||||
github.com/docker/docker v28.5.1+incompatible // indirect
|
||||
github.com/docker/docker-credential-helpers v0.9.4 // indirect
|
||||
github.com/docker/go-connections v0.6.0 // indirect
|
||||
github.com/docker/go-events v0.0.0-20250114142523-c867878c5e32 // indirect
|
||||
github.com/docker/go-units v0.5.0 // indirect
|
||||
@@ -243,9 +248,9 @@ require (
|
||||
github.com/dustin/go-humanize v1.0.1 // indirect
|
||||
github.com/elliotchance/orderedmap v1.5.0 // indirect
|
||||
github.com/elliotchance/phpserialize v1.4.0 // indirect
|
||||
github.com/emicklei/go-restful/v3 v3.12.0 // indirect
|
||||
github.com/emicklei/go-restful/v3 v3.13.0 // indirect
|
||||
github.com/emirpasic/gods v1.18.1 // indirect
|
||||
github.com/envoyproxy/go-control-plane/envoy v1.32.4 // indirect
|
||||
github.com/envoyproxy/go-control-plane/envoy v1.35.0 // indirect
|
||||
github.com/envoyproxy/protoc-gen-validate v1.2.1 // indirect
|
||||
github.com/evanphx/json-patch v5.9.11+incompatible // indirect
|
||||
github.com/exponent-io/jsonpath v0.0.0-20210407135951-1de76d718b3f // indirect
|
||||
@@ -256,69 +261,78 @@ require (
|
||||
github.com/felixge/httpsnoop v1.0.4 // indirect
|
||||
github.com/fsnotify/fsnotify v1.9.0 // indirect
|
||||
github.com/fvbommel/sortorder v1.1.0 // indirect
|
||||
github.com/fxamacker/cbor/v2 v2.7.0 // indirect
|
||||
github.com/gabriel-vasile/mimetype v1.4.10 // indirect
|
||||
github.com/fxamacker/cbor/v2 v2.9.0 // indirect
|
||||
github.com/gabriel-vasile/mimetype v1.4.11 // indirect
|
||||
github.com/github/go-spdx/v2 v2.3.3 // indirect
|
||||
github.com/glebarez/go-sqlite v1.22.0 // indirect
|
||||
github.com/glebarez/sqlite v1.11.0 // indirect
|
||||
github.com/go-chi/chi v4.1.2+incompatible // indirect
|
||||
github.com/go-chi/chi/v5 v5.2.4 // indirect
|
||||
github.com/go-errors/errors v1.4.2 // indirect
|
||||
github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 // indirect
|
||||
github.com/go-git/go-billy/v5 v5.6.2 // indirect
|
||||
github.com/go-gota/gota v0.12.0 // indirect
|
||||
github.com/go-ini/ini v1.67.0 // indirect
|
||||
github.com/go-jose/go-jose/v3 v3.0.4 // indirect
|
||||
github.com/go-jose/go-jose/v4 v4.0.5 // indirect
|
||||
github.com/go-jose/go-jose/v4 v4.1.3 // indirect
|
||||
github.com/go-logr/logr v1.4.3 // indirect
|
||||
github.com/go-logr/stdr v1.2.2 // indirect
|
||||
github.com/go-openapi/analysis v0.23.0 // indirect
|
||||
github.com/go-openapi/errors v0.22.1 // indirect
|
||||
github.com/go-openapi/jsonpointer v0.21.0 // indirect
|
||||
github.com/go-openapi/jsonreference v0.21.0 // indirect
|
||||
github.com/go-openapi/loads v0.22.0 // indirect
|
||||
github.com/go-openapi/runtime v0.28.0 // indirect
|
||||
github.com/go-openapi/spec v0.21.0 // indirect
|
||||
github.com/go-openapi/strfmt v0.23.0 // indirect
|
||||
github.com/go-openapi/swag v0.23.1 // indirect
|
||||
github.com/go-openapi/validate v0.24.0 // indirect
|
||||
github.com/go-piv/piv-go v1.11.0 // indirect
|
||||
github.com/go-openapi/analysis v0.24.1 // indirect
|
||||
github.com/go-openapi/errors v0.22.6 // indirect
|
||||
github.com/go-openapi/jsonpointer v0.22.4 // indirect
|
||||
github.com/go-openapi/jsonreference v0.21.4 // indirect
|
||||
github.com/go-openapi/loads v0.23.2 // indirect
|
||||
github.com/go-openapi/runtime v0.29.2 // indirect
|
||||
github.com/go-openapi/spec v0.22.3 // indirect
|
||||
github.com/go-openapi/strfmt v0.25.0 // indirect
|
||||
github.com/go-openapi/swag v0.25.4 // indirect
|
||||
github.com/go-openapi/swag/cmdutils v0.25.4 // indirect
|
||||
github.com/go-openapi/swag/conv v0.25.4 // indirect
|
||||
github.com/go-openapi/swag/fileutils v0.25.4 // indirect
|
||||
github.com/go-openapi/swag/jsonname v0.25.4 // indirect
|
||||
github.com/go-openapi/swag/jsonutils v0.25.4 // indirect
|
||||
github.com/go-openapi/swag/loading v0.25.4 // indirect
|
||||
github.com/go-openapi/swag/mangling v0.25.4 // indirect
|
||||
github.com/go-openapi/swag/netutils v0.25.4 // indirect
|
||||
github.com/go-openapi/swag/stringutils v0.25.4 // indirect
|
||||
github.com/go-openapi/swag/typeutils v0.25.4 // indirect
|
||||
github.com/go-openapi/swag/yamlutils v0.25.4 // indirect
|
||||
github.com/go-openapi/validate v0.25.1 // indirect
|
||||
github.com/go-piv/piv-go/v2 v2.4.0 // indirect
|
||||
github.com/go-restruct/restruct v1.2.0-alpha // indirect
|
||||
github.com/go-viper/mapstructure/v2 v2.4.0 // indirect
|
||||
github.com/gobwas/glob v0.2.3 // indirect
|
||||
github.com/goccy/go-json v0.10.2 // indirect
|
||||
github.com/goccy/go-json v0.10.5 // indirect
|
||||
github.com/goccy/go-yaml v1.18.0 // indirect
|
||||
github.com/gocsaf/csaf/v3 v3.3.0 // indirect
|
||||
github.com/gofrs/flock v0.12.1 // indirect
|
||||
github.com/gofrs/flock v0.13.0 // indirect
|
||||
github.com/gogo/protobuf v1.3.2 // indirect
|
||||
github.com/gohugoio/hashstructure v0.5.0 // indirect
|
||||
github.com/gohugoio/hashstructure v0.6.0 // indirect
|
||||
github.com/golang-jwt/jwt/v4 v4.5.2 // indirect
|
||||
github.com/golang-jwt/jwt/v5 v5.2.2 // indirect
|
||||
github.com/golang-jwt/jwt/v5 v5.3.0 // indirect
|
||||
github.com/golang/groupcache v0.0.0-20241129210726-2c02b8208cf8 // indirect
|
||||
github.com/golang/protobuf v1.5.4 // indirect
|
||||
github.com/golang/snappy v1.0.0 // indirect
|
||||
github.com/google/btree v1.1.3 // indirect
|
||||
github.com/google/certificate-transparency-go v1.3.1 // indirect
|
||||
github.com/google/gnostic-models v0.6.9 // indirect
|
||||
github.com/google/certificate-transparency-go v1.3.2 // indirect
|
||||
github.com/google/gnostic-models v0.7.0 // indirect
|
||||
github.com/google/go-cmp v0.7.0 // indirect
|
||||
github.com/google/go-github/v55 v55.0.0 // indirect
|
||||
github.com/google/go-querystring v1.1.0 // indirect
|
||||
github.com/google/go-github/v73 v73.0.0 // indirect
|
||||
github.com/google/go-querystring v1.2.0 // indirect
|
||||
github.com/google/licensecheck v0.3.1 // indirect
|
||||
github.com/google/pprof v0.0.0-20250630185457-6e76a2b096b5 // indirect
|
||||
github.com/google/pprof v0.0.0-20250820193118-f64d9cf942d6 // indirect
|
||||
github.com/google/s2a-go v0.1.9 // indirect
|
||||
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect
|
||||
github.com/googleapis/enterprise-certificate-proxy v0.3.6 // indirect
|
||||
github.com/googleapis/gax-go/v2 v2.15.0 // indirect
|
||||
github.com/googleapis/enterprise-certificate-proxy v0.3.9 // indirect
|
||||
github.com/googleapis/gax-go/v2 v2.16.0 // indirect
|
||||
github.com/gookit/color v1.6.0 // indirect
|
||||
github.com/gorilla/mux v1.8.1 // indirect
|
||||
github.com/gorilla/websocket v1.5.4-0.20250319132907-e064f32e3674 // indirect
|
||||
github.com/gregjones/httpcache v0.0.0-20190611155906-901d90724c79 // indirect
|
||||
github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.1 // indirect
|
||||
github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.4 // indirect
|
||||
github.com/hako/durafmt v0.0.0-20210608085754-5c1018a4e16b // indirect
|
||||
github.com/hashicorp/errwrap v1.1.0 // indirect
|
||||
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
|
||||
github.com/hashicorp/go-getter v1.7.9 // indirect
|
||||
github.com/hashicorp/go-multierror v1.1.1 // indirect
|
||||
github.com/hashicorp/go-retryablehttp v0.7.7 // indirect
|
||||
github.com/hashicorp/go-retryablehttp v0.7.8 // indirect
|
||||
github.com/hashicorp/go-safetemp v1.0.0 // indirect
|
||||
github.com/hashicorp/go-version v1.7.0 // indirect
|
||||
github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect
|
||||
@@ -327,6 +341,7 @@ require (
|
||||
github.com/hhrutter/tiff v1.0.1 // indirect
|
||||
github.com/huandu/xstrings v1.5.0 // indirect
|
||||
github.com/iancoleman/strcase v0.3.0 // indirect
|
||||
github.com/in-toto/attestation v1.1.2 // indirect
|
||||
github.com/in-toto/in-toto-golang v0.9.0 // indirect
|
||||
github.com/inconshreveable/mousetrap v1.1.0 // indirect
|
||||
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect
|
||||
@@ -335,28 +350,34 @@ require (
|
||||
github.com/jinzhu/inflection v1.0.0 // indirect
|
||||
github.com/jinzhu/now v1.1.5 // indirect
|
||||
github.com/jmespath/go-jmespath v0.4.1-0.20220621161143-b0104c826a24 // indirect
|
||||
github.com/josharian/intern v1.0.0 // indirect
|
||||
github.com/jung-kurt/gofpdf v1.16.2 // indirect
|
||||
github.com/jwalton/go-supportscolor v1.1.0 // indirect
|
||||
github.com/kastenhq/goversion v0.0.0-20230811215019-93b2f8823953 // indirect
|
||||
github.com/kevinburke/ssh_config v1.2.0 // indirect
|
||||
github.com/klauspost/compress v1.18.0 // indirect
|
||||
github.com/klauspost/compress v1.18.2 // indirect
|
||||
github.com/klauspost/pgzip v1.2.6 // indirect
|
||||
github.com/knqyf263/go-apk-version v0.0.0-20200609155635-041fdbb8563f // indirect
|
||||
github.com/knqyf263/go-deb-version v0.0.0-20241115132648-6f4aee6ccd23 // indirect
|
||||
github.com/knqyf263/go-rpm-version v0.0.0-20220614171824-631e686d1075 // indirect
|
||||
github.com/kylelemons/godebug v1.1.0 // indirect
|
||||
github.com/letsencrypt/boulder v0.0.0-20240620165639-de9c06129bec // indirect
|
||||
github.com/lestrrat-go/blackmagic v1.0.4 // indirect
|
||||
github.com/lestrrat-go/dsig v1.0.0 // indirect
|
||||
github.com/lestrrat-go/dsig-secp256k1 v1.0.0 // indirect
|
||||
github.com/lestrrat-go/httpcc v1.0.1 // indirect
|
||||
github.com/lestrrat-go/httprc/v3 v3.0.1 // indirect
|
||||
github.com/lestrrat-go/jwx/v3 v3.0.12 // indirect
|
||||
github.com/lestrrat-go/option v1.0.1 // indirect
|
||||
github.com/lestrrat-go/option/v2 v2.0.0 // indirect
|
||||
github.com/letsencrypt/boulder v0.20251110.0 // indirect
|
||||
github.com/liggitt/tabwriter v0.0.0-20181228230101-89fcab3d43de // indirect
|
||||
github.com/lucasb-eyer/go-colorful v1.2.0 // indirect
|
||||
github.com/lucasb-eyer/go-colorful v1.3.0 // indirect
|
||||
github.com/mackerelio/go-osstat v0.2.5 // indirect
|
||||
github.com/magiconair/properties v1.8.10 // indirect
|
||||
github.com/mailru/easyjson v0.9.0 // indirect
|
||||
github.com/masahiro331/go-mvn-version v0.0.0-20250131095131-f4974fa13b8a // indirect
|
||||
github.com/mattn/go-colorable v0.1.14 // indirect
|
||||
github.com/mattn/go-runewidth v0.0.16 // indirect
|
||||
github.com/mattn/go-runewidth v0.0.19 // indirect
|
||||
github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d // indirect
|
||||
github.com/mholt/archives v0.1.3 // indirect
|
||||
github.com/mholt/archives v0.1.5 // indirect
|
||||
github.com/miekg/pkcs11 v1.1.1 // indirect
|
||||
github.com/mikelolasagasti/xz v1.0.1 // indirect
|
||||
github.com/minio/minlz v1.0.1 // indirect
|
||||
@@ -365,7 +386,7 @@ require (
|
||||
github.com/mitchellh/go-homedir v1.1.0 // indirect
|
||||
github.com/mitchellh/go-wordwrap v1.0.1 // indirect
|
||||
github.com/mitchellh/hashstructure/v2 v2.0.2 // indirect
|
||||
github.com/mitchellh/mapstructure v1.5.0 // indirect
|
||||
github.com/mitchellh/mapstructure v1.5.1-0.20231216201459-8508981c8b6c // indirect
|
||||
github.com/mitchellh/reflectwalk v1.0.2 // indirect
|
||||
github.com/moby/docker-image-spec v1.3.1 // indirect
|
||||
github.com/moby/locker v1.0.1 // indirect
|
||||
@@ -379,10 +400,10 @@ require (
|
||||
github.com/moby/sys/userns v0.1.0 // indirect
|
||||
github.com/moby/term v0.5.2 // indirect
|
||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
|
||||
github.com/modern-go/reflect2 v1.0.2 // indirect
|
||||
github.com/modern-go/reflect2 v1.0.3-0.20250322232337-35a7c28c31ee // indirect
|
||||
github.com/monochromegane/go-gitignore v0.0.0-20200626010858-205db1a8cc00 // indirect
|
||||
github.com/morikuni/aec v1.0.0 // indirect
|
||||
github.com/mozillazg/docker-credential-acr-helper v0.3.0 // indirect
|
||||
github.com/mozillazg/docker-credential-acr-helper v0.4.0 // indirect
|
||||
github.com/muesli/termenv v0.16.0 // indirect
|
||||
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
|
||||
github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f // indirect
|
||||
@@ -390,18 +411,18 @@ require (
|
||||
github.com/nix-community/go-nix v0.0.0-20250101154619-4bdde671e0a1 // indirect
|
||||
github.com/nozzle/throttler v0.0.0-20180817012639-2ea982251481 // indirect
|
||||
github.com/nwaples/rardecode v1.1.3 // indirect
|
||||
github.com/nwaples/rardecode/v2 v2.1.1 // indirect
|
||||
github.com/nwaples/rardecode/v2 v2.2.0 // indirect
|
||||
github.com/oklog/ulid v1.3.1 // indirect
|
||||
github.com/oleiade/reflections v1.0.1 // indirect
|
||||
github.com/oleiade/reflections v1.1.0 // indirect
|
||||
github.com/olekukonko/cat v0.0.0-20250911104152-50322a0618f6 // indirect
|
||||
github.com/olekukonko/errors v1.1.0 // indirect
|
||||
github.com/olekukonko/ll v0.0.9 // indirect
|
||||
github.com/olekukonko/tablewriter v1.0.9 // indirect
|
||||
github.com/olekukonko/ll v0.1.3 // indirect
|
||||
github.com/olekukonko/tablewriter v1.1.2 // indirect
|
||||
github.com/olvrng/ujson v1.1.0 // indirect
|
||||
github.com/opencontainers/go-digest v1.0.0 // indirect
|
||||
github.com/opencontainers/image-spec v1.1.1 // indirect
|
||||
github.com/opencontainers/runtime-spec v1.2.1 // indirect
|
||||
github.com/opencontainers/selinux v1.12.0 // indirect
|
||||
github.com/opentracing/opentracing-go v1.2.1-0.20220228012449-10b1cf09e00b // indirect
|
||||
github.com/opencontainers/selinux v1.13.0 // indirect
|
||||
github.com/openvex/go-vex v0.2.5 // indirect
|
||||
github.com/owenrumney/go-sarif v1.1.2-0.20231003122901-1000f5e05554 // indirect
|
||||
github.com/package-url/packageurl-go v0.1.3 // indirect
|
||||
@@ -421,19 +442,19 @@ require (
|
||||
github.com/pkg/xattr v0.4.12 // indirect
|
||||
github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10 // indirect
|
||||
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
|
||||
github.com/prometheus/client_golang v1.22.0 // indirect
|
||||
github.com/prometheus/client_model v0.6.1 // indirect
|
||||
github.com/prometheus/common v0.62.0 // indirect
|
||||
github.com/prometheus/procfs v0.15.1 // indirect
|
||||
github.com/prometheus/client_golang v1.23.2 // indirect
|
||||
github.com/prometheus/client_model v0.6.2 // indirect
|
||||
github.com/prometheus/common v0.67.5 // indirect
|
||||
github.com/prometheus/procfs v0.17.0 // indirect
|
||||
github.com/quay/claircore/toolkit v1.2.4 // indirect
|
||||
github.com/quay/zlog v1.1.8 // indirect
|
||||
github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect
|
||||
github.com/rcrowley/go-metrics v0.0.0-20250401214520-65e299d6c5c9 // indirect
|
||||
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect
|
||||
github.com/rivo/uniseg v0.4.7 // indirect
|
||||
github.com/rs/zerolog v1.30.0 // indirect
|
||||
github.com/russross/blackfriday/v2 v2.1.0 // indirect
|
||||
github.com/rust-secure-code/go-rustaudit v0.0.0-20250226111315-e20ec32e963c // indirect
|
||||
github.com/sagikazarmark/locafero v0.9.0 // indirect
|
||||
github.com/sagikazarmark/locafero v0.11.0 // indirect
|
||||
github.com/saintfish/chardet v0.0.0-20230101081208-5e3ef4b5456d // indirect
|
||||
github.com/santhosh-tekuri/jsonschema/v6 v6.0.2 // indirect
|
||||
github.com/sasha-s/go-deadlock v0.3.5 // indirect
|
||||
@@ -441,56 +462,60 @@ require (
|
||||
github.com/sassoftware/relic v7.2.1+incompatible // indirect
|
||||
github.com/scylladb/go-set v1.0.3-0.20200225121959-cc7b2070d91e // indirect
|
||||
github.com/seccomp/libseccomp-golang v0.10.0 // indirect
|
||||
github.com/secure-systems-lab/go-securesystemslib v0.9.0 // indirect
|
||||
github.com/segmentio/ksuid v1.0.4 // indirect
|
||||
github.com/secure-systems-lab/go-securesystemslib v0.10.0 // indirect
|
||||
github.com/segmentio/asm v1.2.1 // indirect
|
||||
github.com/shibumi/go-pathspec v1.3.0 // indirect
|
||||
github.com/shopspring/decimal v1.4.0 // indirect
|
||||
github.com/sigstore/fulcio v1.6.6 // indirect
|
||||
github.com/sigstore/protobuf-specs v0.4.1 // indirect
|
||||
github.com/sigstore/rekor v1.3.10 // indirect
|
||||
github.com/sigstore/sigstore v1.9.5 // indirect
|
||||
github.com/sigstore/timestamp-authority v1.2.2 // indirect
|
||||
github.com/sigstore/fulcio v1.8.5 // indirect
|
||||
github.com/sigstore/protobuf-specs v0.5.0 // indirect
|
||||
github.com/sigstore/rekor v1.5.0 // indirect
|
||||
github.com/sigstore/rekor-tiles/v2 v2.0.1 // indirect
|
||||
github.com/sigstore/sigstore v1.10.3 // indirect
|
||||
github.com/sigstore/sigstore-go v1.1.4 // indirect
|
||||
github.com/sigstore/timestamp-authority/v2 v2.0.4 // indirect
|
||||
github.com/skeema/knownhosts v1.3.1 // indirect
|
||||
github.com/skratchdot/open-golang v0.0.0-20200116055534-eef842397966 // indirect
|
||||
github.com/sorairolake/lzip-go v0.3.7 // indirect
|
||||
github.com/sourcegraph/conc v0.3.0 // indirect
|
||||
github.com/sorairolake/lzip-go v0.3.8 // indirect
|
||||
github.com/sourcegraph/conc v0.3.1-0.20240121214520-5f936abd7ae8 // indirect
|
||||
github.com/spdx/gordf v0.0.0-20250128162952-000978ccd6fb // indirect
|
||||
github.com/spdx/tools-golang v0.5.5 // indirect
|
||||
github.com/spf13/afero v1.14.0 // indirect
|
||||
github.com/spf13/cast v1.9.2 // indirect
|
||||
github.com/spf13/pflag v1.0.7 // indirect
|
||||
github.com/spf13/viper v1.20.1 // indirect
|
||||
github.com/spiffe/go-spiffe/v2 v2.5.0 // indirect
|
||||
github.com/spf13/afero v1.15.0 // indirect
|
||||
github.com/spf13/cast v1.10.0 // indirect
|
||||
github.com/spf13/pflag v1.0.10 // indirect
|
||||
github.com/spf13/viper v1.21.0 // indirect
|
||||
github.com/spiffe/go-spiffe/v2 v2.6.0 // indirect
|
||||
github.com/stripe/stripe-go/v74 v74.30.0 // indirect
|
||||
github.com/subosito/gotenv v1.6.0 // indirect
|
||||
github.com/sylabs/sif/v2 v2.22.0 // indirect
|
||||
github.com/sylabs/squashfs v1.0.6 // indirect
|
||||
github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d // indirect
|
||||
github.com/tchap/go-patricia/v2 v2.3.2 // indirect
|
||||
github.com/tchap/go-patricia/v2 v2.3.3 // indirect
|
||||
github.com/thales-e-security/pool v0.0.2 // indirect
|
||||
github.com/therootcompany/xz v1.0.1 // indirect
|
||||
github.com/theupdateframework/go-tuf v0.7.0 // indirect
|
||||
github.com/theupdateframework/go-tuf/v2 v2.3.1 // indirect
|
||||
github.com/titanous/rocacheck v0.0.0-20171023193734-afe73141d399 // indirect
|
||||
github.com/tjfoc/gmsm v1.4.1 // indirect
|
||||
github.com/tonistiigi/dchapes-mode v0.0.0-20250318174251-73d941a28323 // indirect
|
||||
github.com/tonistiigi/fsutil v0.0.0-20250410151801-5b74a7ad7583 // indirect
|
||||
github.com/tonistiigi/go-csvvalue v0.0.0-20240710180619-ddb21b71c0b4 // indirect
|
||||
github.com/tonistiigi/fsutil v0.0.0-20250605211040-586307ad452f // indirect
|
||||
github.com/tonistiigi/go-csvvalue v0.0.0-20240814133006-030d3b2625d0 // indirect
|
||||
github.com/tonistiigi/units v0.0.0-20180711220420-6950e57a87ea // indirect
|
||||
github.com/tonistiigi/vt100 v0.0.0-20240514184818-90bafcd6abab // indirect
|
||||
github.com/transparency-dev/formats v0.0.0-20251017110053-404c0d5b696c // indirect
|
||||
github.com/transparency-dev/merkle v0.0.2 // indirect
|
||||
github.com/ulikunitz/xz v0.5.15 // indirect
|
||||
github.com/uptrace/opentelemetry-go-extra/otelutil v0.3.2 // indirect
|
||||
github.com/uptrace/opentelemetry-go-extra/otelzap v0.3.2 // indirect
|
||||
github.com/uptrace/uptrace-go v1.37.0 // indirect
|
||||
github.com/valyala/fastjson v1.6.4 // indirect
|
||||
github.com/vbatts/go-mtree v0.5.4 // indirect
|
||||
github.com/vbatts/tar-split v0.12.1 // indirect
|
||||
github.com/vbatts/tar-split v0.12.2 // indirect
|
||||
github.com/vektah/gqlparser/v2 v2.5.31 // indirect
|
||||
github.com/vifraa/gopom v1.0.0 // indirect
|
||||
github.com/vishvananda/netlink v1.3.1-0.20241022031324-976bd8de7d81 // indirect
|
||||
github.com/vishvananda/netlink v1.3.1 // indirect
|
||||
github.com/vishvananda/netns v0.0.5 // indirect
|
||||
github.com/wagoodman/go-partybus v0.0.0-20230516145632-8ccac152c651 // indirect
|
||||
github.com/wagoodman/go-progress v0.0.0-20230925121702-07e42b3cdba0 // indirect
|
||||
github.com/x448/float16 v0.8.4 // indirect
|
||||
github.com/xanzy/go-gitlab v0.102.0 // indirect
|
||||
github.com/xanzy/ssh-agent v0.3.3 // indirect
|
||||
github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb // indirect
|
||||
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect
|
||||
@@ -500,59 +525,57 @@ require (
|
||||
github.com/yashtewari/glob-intersection v0.2.0 // indirect
|
||||
github.com/yl2chen/cidranger v1.0.2 // indirect
|
||||
github.com/yosida95/uritemplate/v3 v3.0.2 // indirect
|
||||
github.com/zclconf/go-cty v1.16.3 // indirect
|
||||
github.com/zeebo/errs v1.4.0 // indirect
|
||||
go.etcd.io/bbolt v1.4.2 // indirect
|
||||
go.mongodb.org/mongo-driver v1.17.1 // indirect
|
||||
github.com/zclconf/go-cty v1.17.0 // indirect
|
||||
gitlab.com/gitlab-org/api/client-go v1.11.0 // indirect
|
||||
go.etcd.io/bbolt v1.4.3 // indirect
|
||||
go.mongodb.org/mongo-driver v1.17.6 // indirect
|
||||
go.opencensus.io v0.24.0 // indirect
|
||||
go.opentelemetry.io/auto/sdk v1.1.0 // indirect
|
||||
go.opentelemetry.io/contrib/detectors/gcp v1.37.0 // indirect
|
||||
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.62.0 // indirect
|
||||
go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace v0.56.0 // indirect
|
||||
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.62.0 // indirect
|
||||
go.opentelemetry.io/auto/sdk v1.2.1 // indirect
|
||||
go.opentelemetry.io/contrib/detectors/gcp v1.38.0 // indirect
|
||||
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.63.0 // indirect
|
||||
go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace v0.61.0 // indirect
|
||||
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.63.0 // indirect
|
||||
go.opentelemetry.io/contrib/instrumentation/runtime v0.62.0 // indirect
|
||||
go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp v0.13.0 // indirect
|
||||
go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.32.0 // indirect
|
||||
go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp v1.37.0 // indirect
|
||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.37.0 // indirect
|
||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.35.0 // indirect
|
||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.37.0 // indirect
|
||||
go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.38.0 // indirect
|
||||
go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp v1.38.0 // indirect
|
||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.39.0 // indirect
|
||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.39.0 // indirect
|
||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.39.0 // indirect
|
||||
go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.37.0 // indirect
|
||||
go.opentelemetry.io/otel/log v0.13.0 // indirect
|
||||
go.opentelemetry.io/otel/sdk v1.37.0 // indirect
|
||||
go.opentelemetry.io/otel/sdk v1.39.0 // indirect
|
||||
go.opentelemetry.io/otel/sdk/log v0.13.0 // indirect
|
||||
go.opentelemetry.io/otel/sdk/metric v1.37.0 // indirect
|
||||
go.opentelemetry.io/otel/trace v1.37.0 // indirect
|
||||
go.opentelemetry.io/proto/otlp v1.7.0 // indirect
|
||||
go.step.sm/crypto v0.60.0 // indirect
|
||||
go.uber.org/mock v0.5.0 // indirect
|
||||
go.opentelemetry.io/otel/sdk/metric v1.39.0 // indirect
|
||||
go.opentelemetry.io/otel/trace v1.39.0 // indirect
|
||||
go.opentelemetry.io/proto/otlp v1.9.0 // indirect
|
||||
go.uber.org/mock v0.6.0 // indirect
|
||||
go.uber.org/multierr v1.11.0 // indirect
|
||||
go.uber.org/zap v1.27.0 // indirect
|
||||
go.yaml.in/yaml/v2 v2.4.2 // indirect
|
||||
go.uber.org/zap v1.27.1 // indirect
|
||||
go.yaml.in/yaml/v2 v2.4.3 // indirect
|
||||
go.yaml.in/yaml/v3 v3.0.4 // indirect
|
||||
go4.org v0.0.0-20230225012048-214862532bf5 // indirect
|
||||
go4.org/netipx v0.0.0-20231129151722-fdeea329fbba // indirect
|
||||
golang.org/x/crypto v0.41.0 // indirect
|
||||
golang.org/x/exp v0.0.0-20250711185948-6ae5c78190dc // indirect
|
||||
golang.org/x/image v0.24.0 // indirect
|
||||
golang.org/x/net v0.43.0 // indirect
|
||||
golang.org/x/oauth2 v0.30.0 // indirect
|
||||
golang.org/x/sync v0.16.0 // indirect
|
||||
golang.org/x/sys v0.35.0 // indirect
|
||||
golang.org/x/text v0.28.0 // indirect
|
||||
golang.org/x/time v0.12.0 // indirect
|
||||
golang.org/x/tools v0.36.0 // indirect
|
||||
golang.org/x/crypto v0.46.0 // indirect
|
||||
golang.org/x/exp v0.0.0-20250911091902-df9299821621 // indirect
|
||||
golang.org/x/image v0.25.0 // indirect
|
||||
golang.org/x/net v0.48.0 // indirect
|
||||
golang.org/x/oauth2 v0.34.0 // indirect
|
||||
golang.org/x/sys v0.39.0 // indirect
|
||||
golang.org/x/text v0.32.0 // indirect
|
||||
golang.org/x/time v0.14.0 // indirect
|
||||
golang.org/x/tools v0.40.0 // indirect
|
||||
golang.org/x/xerrors v0.0.0-20240903120638-7835f813f4da // indirect
|
||||
gonum.org/v1/gonum v0.12.0 // indirect
|
||||
google.golang.org/api v0.242.0 // indirect
|
||||
google.golang.org/genproto v0.0.0-20250715232539-7130f93afb79 // indirect
|
||||
google.golang.org/genproto/googleapis/api v0.0.0-20250715232539-7130f93afb79 // indirect
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20250715232539-7130f93afb79 // indirect
|
||||
google.golang.org/grpc v1.74.0 // indirect
|
||||
google.golang.org/protobuf v1.36.6 // indirect
|
||||
gopkg.in/evanphx/json-patch.v4 v4.12.0 // indirect
|
||||
gonum.org/v1/gonum v0.16.0 // indirect
|
||||
google.golang.org/api v0.260.0 // indirect
|
||||
google.golang.org/genproto v0.0.0-20251202230838-ff82c1b0f217 // indirect
|
||||
google.golang.org/genproto/googleapis/api v0.0.0-20251222181119-0a764e51fe1b // indirect
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20251222181119-0a764e51fe1b // indirect
|
||||
google.golang.org/grpc v1.78.0 // indirect
|
||||
google.golang.org/protobuf v1.36.11 // indirect
|
||||
gopkg.in/evanphx/json-patch.v4 v4.13.0 // indirect
|
||||
gopkg.in/inf.v0 v0.9.1 // indirect
|
||||
gopkg.in/ini.v1 v1.67.0 // indirect
|
||||
gopkg.in/ini.v1 v1.67.1 // indirect
|
||||
gopkg.in/warnings.v0 v0.1.2 // indirect
|
||||
gopkg.in/yaml.v2 v2.4.0 // indirect
|
||||
gorm.io/gorm v1.30.2 // indirect
|
||||
@@ -561,19 +584,22 @@ require (
|
||||
k8s.io/cli-runtime v0.33.3 // indirect
|
||||
k8s.io/component-base v0.33.3 // indirect
|
||||
k8s.io/klog/v2 v2.130.1 // indirect
|
||||
k8s.io/kube-openapi v0.0.0-20250318190949-c8a335a9a2ff // indirect
|
||||
k8s.io/kube-openapi v0.0.0-20250910181357-589584f1c912 // indirect
|
||||
k8s.io/kubectl v0.33.3 // indirect
|
||||
modernc.org/libc v1.66.3 // indirect
|
||||
modernc.org/libc v1.66.10 // indirect
|
||||
modernc.org/mathutil v1.7.1 // indirect
|
||||
modernc.org/memory v1.11.0 // indirect
|
||||
modernc.org/sqlite v1.40.1 // indirect
|
||||
oras.land/oras-go/v2 v2.6.0 // indirect
|
||||
sigs.k8s.io/controller-runtime v0.18.4 // indirect
|
||||
sigs.k8s.io/json v0.0.0-20241014173422-cfa47c3a1cc8 // indirect
|
||||
sigs.k8s.io/json v0.0.0-20250730193827-2d320260d730 // indirect
|
||||
sigs.k8s.io/randfill v1.0.0 // indirect
|
||||
sigs.k8s.io/release-utils v0.9.0 // indirect
|
||||
sigs.k8s.io/structured-merge-diff/v4 v4.6.0 // indirect
|
||||
sigs.k8s.io/release-utils v0.12.3 // indirect
|
||||
sigs.k8s.io/structured-merge-diff/v6 v6.3.0 // indirect
|
||||
)
|
||||
|
||||
replace github.com/anchore/stereoscope => github.com/matthyx/stereoscope v0.0.0-20250916161743-dd57158479de
|
||||
|
||||
replace github.com/google/go-containerregistry => github.com/matthyx/go-containerregistry v0.0.0-20250916162850-293c5b36a9f8
|
||||
|
||||
replace github.com/docker/cli => github.com/docker/cli v28.5.1+incompatible
|
||||
|
||||
@@ -1,174 +1,340 @@
|
||||
# Kubescape HTTP Handler Package
|
||||
# Kubescape HTTP Handler
|
||||
|
||||
Running `kubescape` will start up a web-server on port `8080` which will serve the following API's:
|
||||
The HTTP Handler provides a REST API for running Kubescape scans programmatically. This enables integration with CI/CD pipelines, custom dashboards, and automation workflows.
|
||||
|
||||
### Trigger scan
|
||||
## Table of Contents
|
||||
|
||||
* POST `/v1/scan` - triggers a Kubescape scan. The server will return an ID and will execute the scanning asynchronously. The request body should look [as follows](#trigger-scan-object).
|
||||
* * `wait=true`: scan synchronously (return results and not ID). Use only in small clusters or with an increased timeout. Default is `wait=false`
|
||||
* * `keep=true`: do not delete results from local storage after returning. Default is `keep=false`
|
||||
- [Overview](#overview)
|
||||
- [API Reference](#api-reference)
|
||||
- [Trigger Scan](#trigger-scan)
|
||||
- [Get Results](#get-results)
|
||||
- [Check Status](#check-status)
|
||||
- [Delete Results](#delete-results)
|
||||
- [Request/Response Objects](#requestresponse-objects)
|
||||
- [API Examples](#api-examples)
|
||||
- [Environment Variables](#environment-variables)
|
||||
- [Deployment Examples](#deployment-examples)
|
||||
- [Debugging](#debugging)
|
||||
|
||||
[Response](#response-object):
|
||||
---
|
||||
|
||||
```
|
||||
## Overview
|
||||
|
||||
When running Kubescape as a service, it starts a web server on port `8080` that exposes REST APIs for:
|
||||
|
||||
- Triggering security scans (async or sync)
|
||||
- Retrieving scan results
|
||||
- Checking scan status
|
||||
- Managing cached results
|
||||
|
||||
---
|
||||
|
||||
## API Reference
|
||||
|
||||
### Trigger Scan
|
||||
|
||||
**Endpoint:** `POST /v1/scan`
|
||||
|
||||
Triggers a Kubescape scan. By default, scans run asynchronously and return a scan ID immediately.
|
||||
|
||||
**Query Parameters:**
|
||||
|
||||
| Parameter | Type | Default | Description |
|
||||
|-----------|------|---------|-------------|
|
||||
| `wait` | bool | `false` | Wait for scan to complete (synchronous mode) |
|
||||
| `keep` | bool | `false` | Keep results in cache after returning |
|
||||
|
||||
**Request Body:** See [Trigger Scan Object](#trigger-scan-object)
|
||||
|
||||
**Response (async):**
|
||||
|
||||
```json
|
||||
{
|
||||
"id": <str>, // scan ID
|
||||
"type": "busy", // response object type
|
||||
"response": <message:string> // message indicating scanning is still in progress
|
||||
"id": "scan-12345",
|
||||
"type": "busy",
|
||||
"response": "scanning in progress"
|
||||
}
|
||||
```
|
||||
|
||||
> When scanning was triggered with the `wait=true` query param, the response is like the [`/v1/results` API](#get-results) response
|
||||
**Response (sync with `wait=true`):** Same as [Get Results](#get-results) response.
|
||||
|
||||
### Get results
|
||||
* GET `/v1/results` - request kubescape scan results
|
||||
* * query `id=<string>` -> request results of a specific scan ID. If empty will return the latest results
|
||||
* * query `keep=true` -> keep the results in the local storage after returning. default is `keep=false` - the results will be deleted from local storage after they are returned
|
||||
---
|
||||
|
||||
[Response](#response-object):
|
||||
### Get Results
|
||||
|
||||
When scanning was done successfully
|
||||
```
|
||||
**Endpoint:** `GET /v1/results`
|
||||
|
||||
Retrieve scan results.
|
||||
|
||||
**Query Parameters:**
|
||||
|
||||
| Parameter | Type | Default | Description |
|
||||
|-----------|------|---------|-------------|
|
||||
| `id` | string | - | Scan ID. If empty, returns latest results |
|
||||
| `keep` | bool | `false` | Keep results in cache after returning |
|
||||
|
||||
**Response (success):**
|
||||
|
||||
```json
|
||||
{
|
||||
"id": <str>, // scan ID
|
||||
"type": "v1results", // response object type
|
||||
"response": <object:v1results> // v1 results payload
|
||||
"id": "scan-12345",
|
||||
"type": "v1results",
|
||||
"response": { /* scan results object */ }
|
||||
}
|
||||
```
|
||||
|
||||
When scanning failed
|
||||
```
|
||||
**Response (error):**
|
||||
|
||||
```json
|
||||
{
|
||||
"id": <str>, // scan ID
|
||||
"type": "error", // response object type
|
||||
"response": <error:string> // error string
|
||||
"id": "scan-12345",
|
||||
"type": "error",
|
||||
"response": "error message"
|
||||
}
|
||||
```
|
||||
|
||||
When scanning is in progress
|
||||
```
|
||||
**Response (in progress):**
|
||||
|
||||
```json
|
||||
{
|
||||
"id": <str>, // scan ID
|
||||
"type": "busy", // response object type
|
||||
"response": <message:string> // message indicating scanning is still in progress
|
||||
}
|
||||
```
|
||||
### Check scanning progress status
|
||||
Check the scanning status - is the scanning in progress or done. This is meant for a waiting mechanize since the API does not return the entire results object when the scanning is done
|
||||
|
||||
* GET `/v1/status` - Request kubescape scan status
|
||||
* * query `id=<string>` -> Check status of a specific scan. If empty, it will check if any scan is still in progress
|
||||
|
||||
[Response](#response-object):
|
||||
|
||||
When scanning is in progress
|
||||
```
|
||||
{
|
||||
"id": <str>, // scan ID
|
||||
"type": "busy", // response object type
|
||||
"response": <message:string> // message indicating scanning is still in process
|
||||
"id": "scan-12345",
|
||||
"type": "busy",
|
||||
"response": "scanning in progress"
|
||||
}
|
||||
```
|
||||
|
||||
When scanning is not in progress
|
||||
```
|
||||
---
|
||||
|
||||
### Check Status
|
||||
|
||||
**Endpoint:** `GET /v1/status`
|
||||
|
||||
Check if a scan is still in progress. Useful for polling without retrieving full results.
|
||||
|
||||
**Query Parameters:**
|
||||
|
||||
| Parameter | Type | Default | Description |
|
||||
|-----------|------|---------|-------------|
|
||||
| `id` | string | - | Scan ID. If empty, checks if any scan is in progress |
|
||||
|
||||
**Response (in progress):**
|
||||
|
||||
```json
|
||||
{
|
||||
"id": <str>, // scan ID
|
||||
"type": "notBusy", // response object type
|
||||
"response": <message:string> // message indicating scanning is successfully done
|
||||
"id": "scan-12345",
|
||||
"type": "busy",
|
||||
"response": "scanning in progress"
|
||||
}
|
||||
```
|
||||
|
||||
### Delete cached results
|
||||
* DELETE `/v1/results` - Delete kubescape scan results from storage. If empty will delete the latest results
|
||||
* * query `id=<string>`: Delete ID of specific results
|
||||
* * query `all`: Delete all cached results
|
||||
**Response (complete):**
|
||||
|
||||
## Objects
|
||||
|
||||
### Trigger scan object
|
||||
|
||||
```
|
||||
```json
|
||||
{
|
||||
"format": <str>, // results format [default: json] (same as 'kubescape scan --format')
|
||||
"excludedNamespaces": [<str>], // list of namespaces to exclude (same as 'kubescape scan --excluded-namespaces')
|
||||
"includeNamespaces": [<str>], // list of namespaces to include (same as 'kubescape scan --include-namespaces')
|
||||
"useCachedArtifacts"`: <bool>, // use the cached artifacts instead of downloading (offline support)
|
||||
"hostScanner": <bool>, // deploy Kubescape host-sensor daemonset in the scanned cluster. Deleting it right after we collecting the data. Required to collect valuable data from cluster nodes for certain controls
|
||||
"keepLocal": <bool>, // do not submit results to Kubescape cloud (same as 'kubescape scan --keep-local')
|
||||
"account": <str>, // account ID (same as 'kubescape scan --account')
|
||||
"access-key": <str>, // account ID (same as 'kubescape scan --accessKey')
|
||||
"targetType": <str>, // framework/control
|
||||
"targetNames": [<str>] // names. e.g. when targetType==framework, targetNames=["nsa", "mitre"]
|
||||
"id": "scan-12345",
|
||||
"type": "notBusy",
|
||||
"response": "scanning completed"
|
||||
}
|
||||
```
|
||||
|
||||
### Response object
|
||||
---
|
||||
|
||||
```
|
||||
### Delete Results
|
||||
|
||||
**Endpoint:** `DELETE /v1/results`
|
||||
|
||||
Delete cached scan results.
|
||||
|
||||
**Query Parameters:**
|
||||
|
||||
| Parameter | Type | Default | Description |
|
||||
|-----------|------|---------|-------------|
|
||||
| `id` | string | - | Scan ID to delete. If empty, deletes latest |
|
||||
| `all` | bool | `false` | Delete all cached results |
|
||||
|
||||
---
|
||||
|
||||
## Request/Response Objects
|
||||
|
||||
### Trigger Scan Object
|
||||
|
||||
```json
|
||||
{
|
||||
"id": <str>, // scan ID
|
||||
"type": <responseType:str>, // response object type
|
||||
"response": <object:interface> // response payload as list of bytes
|
||||
"format": "json",
|
||||
"excludedNamespaces": ["kube-system", "kube-public"],
|
||||
"includeNamespaces": ["production", "staging"],
|
||||
"useCachedArtifacts": false,
|
||||
"keepLocal": true,
|
||||
"account": "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",
|
||||
"accessKey": "your-access-key",
|
||||
"targetType": "framework",
|
||||
"targetNames": ["nsa", "mitre"]
|
||||
}
|
||||
```
|
||||
#### Response object types
|
||||
|
||||
* "v1results" - v1 results object
|
||||
* "busy" - server is busy processing previous requests
|
||||
* "notBusy" - server is not busy processing previous requests
|
||||
* "ready" - server is done processing request and results are ready
|
||||
* "error" - error object
|
||||
| Field | Type | Description |
|
||||
|-------|------|-------------|
|
||||
| `format` | string | Output format (default: `json`) |
|
||||
| `excludedNamespaces` | []string | Namespaces to exclude from scan |
|
||||
| `includeNamespaces` | []string | Namespaces to include in scan |
|
||||
| `useCachedArtifacts` | bool | Use cached artifacts (offline mode) |
|
||||
| `keepLocal` | bool | Don't submit results to backend |
|
||||
| `account` | string | Kubescape SaaS account ID |
|
||||
| `accessKey` | string | Kubescape SaaS access key |
|
||||
| `targetType` | string | `"framework"` or `"control"` |
|
||||
| `targetNames` | []string | Frameworks/controls to scan |
|
||||
|
||||
### Response Object
|
||||
|
||||
```json
|
||||
{
|
||||
"id": "scan-12345",
|
||||
"type": "v1results",
|
||||
"response": { /* payload */ }
|
||||
}
|
||||
```
|
||||
|
||||
| Field | Type | Description |
|
||||
|-------|------|-------------|
|
||||
| `id` | string | Scan identifier |
|
||||
| `type` | string | Response type (see below) |
|
||||
| `response` | any | Response payload |
|
||||
|
||||
**Response Types:**
|
||||
|
||||
| Type | Description |
|
||||
|------|-------------|
|
||||
| `v1results` | Scan results object |
|
||||
| `busy` | Scan in progress |
|
||||
| `notBusy` | No scan in progress |
|
||||
| `ready` | Scan complete, results ready |
|
||||
| `error` | Error occurred |
|
||||
|
||||
---
|
||||
|
||||
## API Examples
|
||||
#### Default scan
|
||||
|
||||
1. Trigger kubescape scan
|
||||
```bash
|
||||
curl --header "Content-Type: application/json" --request POST --data '{"hostScanner":true}' http://127.0.0.1:8080/v1/scan
|
||||
```
|
||||
|
||||
2. Get kubescape scan results
|
||||
```bash
|
||||
curl --request GET http://127.0.0.1:8080/v1/results -o response.json
|
||||
```
|
||||
|
||||
#### Trigger scan and wait for the scan to end
|
||||
### Basic Scan (Async)
|
||||
|
||||
```bash
|
||||
curl --header "Content-Type: application/json" --request POST --data '{"hostScanner":true}' http://127.0.0.1:8080/v1/scan?wait -o scan_results.json
|
||||
```
|
||||
#### Scan single namespace with a specific framework
|
||||
```bash
|
||||
curl --header "Content-Type: application/json" \
|
||||
--request POST \
|
||||
--data '{"hostScanner":true, "includeNamespaces": ["kubescape"], "targetType": "framework", "targetNames": ["nsa"] }' \
|
||||
http://127.0.0.1:8080/v1/scan
|
||||
# 1. Trigger scan
|
||||
curl -X POST http://127.0.0.1:8080/v1/scan \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{"targetType": "framework", "targetNames": ["nsa"]}'
|
||||
|
||||
# 2. Check status
|
||||
curl http://127.0.0.1:8080/v1/status
|
||||
|
||||
# 3. Get results
|
||||
curl http://127.0.0.1:8080/v1/results -o results.json
|
||||
```
|
||||
|
||||
#### Data profiling
|
||||
Analyze profiled data using [pprof](https://github.com/google/pprof/blob/main/doc/README.md).
|
||||
[How to use](https://pkg.go.dev/net/http/pprof)
|
||||
### Synchronous Scan
|
||||
|
||||
example:
|
||||
```bash
|
||||
curl -X POST "http://127.0.0.1:8080/v1/scan?wait=true" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{"targetType": "framework", "targetNames": ["nsa"]}' \
|
||||
-o results.json
|
||||
```
|
||||
|
||||
### Scan Specific Namespaces
|
||||
|
||||
```bash
|
||||
curl -X POST http://127.0.0.1:8080/v1/scan \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{
|
||||
"includeNamespaces": ["production"],
|
||||
"targetType": "framework",
|
||||
"targetNames": ["nsa", "mitre"]
|
||||
}'
|
||||
```
|
||||
|
||||
### Scan with Account Integration
|
||||
|
||||
```bash
|
||||
curl -X POST http://127.0.0.1:8080/v1/scan \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{
|
||||
"account": "YOUR-ACCOUNT-ID",
|
||||
"accessKey": "YOUR-ACCESS-KEY",
|
||||
"targetType": "framework",
|
||||
"targetNames": ["nsa"]
|
||||
}'
|
||||
```
|
||||
|
||||
### Delete All Cached Results
|
||||
|
||||
```bash
|
||||
curl -X DELETE "http://127.0.0.1:8080/v1/results?all=true"
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Environment Variables
|
||||
|
||||
Configure the HTTP handler using environment variables:
|
||||
|
||||
| Variable | Description | Example |
|
||||
|----------|-------------|---------|
|
||||
| `KS_ACCOUNT` | Default account ID | `xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx` |
|
||||
| `KS_EXCLUDE_NAMESPACES` | Default namespaces to exclude | `kube-system,kube-public` |
|
||||
| `KS_INCLUDE_NAMESPACES` | Default namespaces to include | `production,staging` |
|
||||
| `KS_FORMAT` | Default output format | `json` |
|
||||
| `KS_LOGGER_NAME` | Logger name | `kubescape` |
|
||||
| `KS_LOGGER_LEVEL` | Log level | `info`, `debug`, `warning`, `error` |
|
||||
| `KS_DOWNLOAD_ARTIFACTS` | Download artifacts on each scan | `true`, `false` |
|
||||
|
||||
---
|
||||
|
||||
## Deployment Examples
|
||||
|
||||
### Microservice Deployment
|
||||
|
||||
Deploy Kubescape as a microservice in your cluster for API-driven scanning.
|
||||
|
||||
📖 **[Microservice Deployment Guide →](examples/microservice/README.md)**
|
||||
|
||||
### Prometheus Integration
|
||||
|
||||
Expose Kubescape metrics for Prometheus scraping.
|
||||
|
||||
📖 **[Prometheus Integration Guide →](examples/prometheus/README.md)**
|
||||
|
||||
---
|
||||
|
||||
## Debugging
|
||||
|
||||
### Enable Debug Logging
|
||||
|
||||
Set the log level to debug for more verbose output:
|
||||
|
||||
```bash
|
||||
export KS_LOGGER_LEVEL=debug
|
||||
```
|
||||
|
||||
### Performance Profiling
|
||||
|
||||
The HTTP handler exposes pprof endpoints for performance analysis:
|
||||
|
||||
```bash
|
||||
# Heap profile
|
||||
go tool pprof http://localhost:6060/debug/pprof/heap
|
||||
|
||||
# CPU profile
|
||||
go tool pprof http://localhost:6060/debug/pprof/profile?seconds=30
|
||||
|
||||
# Goroutine profile
|
||||
go tool pprof http://localhost:6060/debug/pprof/goroutine
|
||||
```
|
||||
|
||||
## Examples
|
||||
For more information on pprof, see the [pprof documentation](https://pkg.go.dev/net/http/pprof).
|
||||
|
||||
* [Prometheus](examples/prometheus/README.md)
|
||||
* [Microservice](examples/microservice/README.md)
|
||||
---
|
||||
|
||||
## Related Documentation
|
||||
|
||||
## Supported environment variables
|
||||
|
||||
* `KS_ACCOUNT`: Account ID
|
||||
* `KS_EXCLUDE_NAMESPACES`: List of namespaces to exclude, e.g. `KS_EXCLUDE_NAMESPACES=kube-system,kube-public`
|
||||
* `KS_INCLUDE_NAMESPACES`: List of namespaces to include, rest of the namespaces will be ignored. e.g. `KS_INCLUDE_NAMESPACES=dev,prod`
|
||||
* `KS_HOST_SCAN_YAML`: Full path to the host scanner YAML
|
||||
* `KS_FORMAT`: Output file format. default is json
|
||||
* `KS_ENABLE_HOST_SCANNER`: Enable the host scanner feature
|
||||
* `KS_DOWNLOAD_ARTIFACTS`: Download the artifacts every scan
|
||||
* `KS_LOGGER_NAME`: Set logger name
|
||||
* `KS_LOGGER_LEVEL`: Set logger level
|
||||
- [CLI Reference](../docs/cli-reference.md)
|
||||
- [Architecture](../docs/architecture.md)
|
||||
- [Getting Started Guide](../docs/getting-started.md)
|
||||
- [Troubleshooting](../docs/troubleshooting.md)
|
||||
@@ -1,21 +1,274 @@
|
||||
# Kubescape as a microservice
|
||||
# Kubescape as a Microservice
|
||||
|
||||
1. Deploy kubescape microservice
|
||||
```bash
|
||||
kubectl apply -f ks-deployment.yaml
|
||||
```
|
||||
> **Note**
|
||||
> Make sure the configurations suit your cluster (e.g. `serviceType`, namespace, etc.)
|
||||
This guide explains how to deploy Kubescape as a microservice in your Kubernetes cluster, enabling API-driven security scanning.
|
||||
|
||||
2. Trigger scan
|
||||
```bash
|
||||
curl --header "Content-Type: application/json" \
|
||||
--request POST \
|
||||
--data '{"account":"XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX","hostScanner":true}' \
|
||||
http://127.0.0.1:8080/v1/scan
|
||||
```
|
||||
## Table of Contents
|
||||
|
||||
3. Get results
|
||||
```bash
|
||||
curl --request GET http://127.0.0.1:8080/v1/results -o results.json
|
||||
```
|
||||
- [Overview](#overview)
|
||||
- [Prerequisites](#prerequisites)
|
||||
- [Deployment](#deployment)
|
||||
- [API Usage](#api-usage)
|
||||
- [Configuration](#configuration)
|
||||
- [Troubleshooting](#troubleshooting)
|
||||
|
||||
---
|
||||
|
||||
## Overview
|
||||
|
||||
Running Kubescape as a microservice allows you to:
|
||||
|
||||
- Trigger security scans via REST API
|
||||
- Integrate with CI/CD pipelines
|
||||
- Build custom dashboards and automation
|
||||
- Schedule and manage scans programmatically
|
||||
|
||||
---
|
||||
|
||||
## Prerequisites
|
||||
|
||||
- Kubernetes cluster with `kubectl` access
|
||||
- Cluster admin permissions (for RBAC setup)
|
||||
- Network access to the Kubescape service endpoint
|
||||
|
||||
---
|
||||
|
||||
## Deployment
|
||||
|
||||
### 1. Deploy Kubescape Microservice
|
||||
|
||||
```bash
|
||||
kubectl apply -f ks-deployment.yaml
|
||||
```
|
||||
|
||||
> **Note**: Review and modify `ks-deployment.yaml` to match your cluster configuration:
|
||||
> - `serviceType` (ClusterIP, NodePort, LoadBalancer)
|
||||
> - Namespace
|
||||
> - Resource limits
|
||||
> - Service account permissions
|
||||
|
||||
### 2. Verify Deployment
|
||||
|
||||
```bash
|
||||
# Check pod status
|
||||
kubectl get pods -l app=kubescape
|
||||
|
||||
# Check service
|
||||
kubectl get svc kubescape
|
||||
```
|
||||
|
||||
### 3. Access the Service
|
||||
|
||||
```bash
|
||||
# Port-forward for local access
|
||||
kubectl port-forward svc/kubescape 8080:8080
|
||||
|
||||
# Or get the external IP (if using LoadBalancer)
|
||||
kubectl get svc kubescape -o jsonpath='{.status.loadBalancer.ingress[0].ip}'
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## API Usage
|
||||
|
||||
### Trigger a Scan
|
||||
|
||||
```bash
|
||||
curl --header "Content-Type: application/json" \
|
||||
--request POST \
|
||||
--data '{
|
||||
"account": "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",
|
||||
"targetType": "framework",
|
||||
"targetNames": ["nsa", "mitre"]
|
||||
}' \
|
||||
http://127.0.0.1:8080/v1/scan
|
||||
```
|
||||
|
||||
**Response:**
|
||||
```json
|
||||
{
|
||||
"id": "scan-12345",
|
||||
"type": "busy",
|
||||
"response": "scanning in progress"
|
||||
}
|
||||
```
|
||||
|
||||
### Trigger Scan and Wait for Results
|
||||
|
||||
```bash
|
||||
curl --header "Content-Type: application/json" \
|
||||
--request POST \
|
||||
--data '{"targetType": "framework", "targetNames": ["nsa"]}' \
|
||||
"http://127.0.0.1:8080/v1/scan?wait=true" \
|
||||
-o results.json
|
||||
```
|
||||
|
||||
### Check Scan Status
|
||||
|
||||
```bash
|
||||
curl --request GET "http://127.0.0.1:8080/v1/status?id=scan-12345"
|
||||
```
|
||||
|
||||
### Get Scan Results
|
||||
|
||||
```bash
|
||||
curl --request GET "http://127.0.0.1:8080/v1/results?id=scan-12345" -o results.json
|
||||
```
|
||||
|
||||
### Get Latest Results
|
||||
|
||||
```bash
|
||||
curl --request GET http://127.0.0.1:8080/v1/results -o results.json
|
||||
```
|
||||
|
||||
### Delete Cached Results
|
||||
|
||||
```bash
|
||||
# Delete specific results
|
||||
curl --request DELETE "http://127.0.0.1:8080/v1/results?id=scan-12345"
|
||||
|
||||
# Delete all cached results
|
||||
curl --request DELETE "http://127.0.0.1:8080/v1/results?all=true"
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Configuration
|
||||
|
||||
### Scan Request Options
|
||||
|
||||
| Field | Type | Description |
|
||||
|-------|------|-------------|
|
||||
| `account` | string | Kubescape SaaS account ID (optional) |
|
||||
| `accessKey` | string | Kubescape SaaS access key (optional) |
|
||||
| `targetType` | string | `"framework"` or `"control"` |
|
||||
| `targetNames` | array | List of frameworks/controls to scan |
|
||||
| `excludedNamespaces` | array | Namespaces to exclude |
|
||||
| `includeNamespaces` | array | Namespaces to include |
|
||||
| `format` | string | Output format (default: `"json"`) |
|
||||
| `keepLocal` | boolean | Don't submit results to backend |
|
||||
| `useCachedArtifacts` | boolean | Use cached artifacts (offline mode) |
|
||||
|
||||
### Query Parameters
|
||||
|
||||
| Parameter | Description |
|
||||
|-----------|-------------|
|
||||
| `wait=true` | Wait for scan to complete (synchronous) |
|
||||
| `keep=true` | Keep results in cache after returning |
|
||||
| `id=<scan-id>` | Specify a particular scan ID |
|
||||
|
||||
### Environment Variables
|
||||
|
||||
Configure the microservice using environment variables in your deployment:
|
||||
|
||||
| Variable | Description |
|
||||
|----------|-------------|
|
||||
| `KS_ACCOUNT` | Default account ID |
|
||||
| `KS_EXCLUDE_NAMESPACES` | Default namespaces to exclude |
|
||||
| `KS_INCLUDE_NAMESPACES` | Default namespaces to include |
|
||||
| `KS_FORMAT` | Default output format |
|
||||
| `KS_LOGGER_LEVEL` | Log level (`debug`, `info`, `warning`, `error`) |
|
||||
|
||||
---
|
||||
|
||||
## Example Workflows
|
||||
|
||||
### CI/CD Integration
|
||||
|
||||
```bash
|
||||
#!/bin/bash
|
||||
# Trigger scan and wait for results
|
||||
RESULT=$(curl -s --header "Content-Type: application/json" \
|
||||
--request POST \
|
||||
--data '{"targetType": "framework", "targetNames": ["nsa"]}' \
|
||||
"http://kubescape:8080/v1/scan?wait=true")
|
||||
|
||||
# Extract compliance score
|
||||
SCORE=$(echo $RESULT | jq '.response.summaryDetails.complianceScore')
|
||||
|
||||
# Fail pipeline if score is below threshold
|
||||
if (( $(echo "$SCORE < 80" | bc -l) )); then
|
||||
echo "Compliance score $SCORE is below threshold (80)"
|
||||
exit 1
|
||||
fi
|
||||
```
|
||||
|
||||
### Scheduled Scanning
|
||||
|
||||
Use a Kubernetes CronJob to trigger regular scans:
|
||||
|
||||
```yaml
|
||||
apiVersion: batch/v1
|
||||
kind: CronJob
|
||||
metadata:
|
||||
name: kubescape-scheduled-scan
|
||||
spec:
|
||||
schedule: "0 */6 * * *" # Every 6 hours
|
||||
jobTemplate:
|
||||
spec:
|
||||
template:
|
||||
spec:
|
||||
containers:
|
||||
- name: scanner
|
||||
image: curlimages/curl
|
||||
command:
|
||||
- /bin/sh
|
||||
- -c
|
||||
- |
|
||||
curl -X POST http://kubescape:8080/v1/scan \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{"targetType": "framework", "targetNames": ["nsa", "mitre"]}'
|
||||
restartPolicy: OnFailure
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
### Service Not Accessible
|
||||
|
||||
```bash
|
||||
# Check pod logs
|
||||
kubectl logs -l app=kubescape
|
||||
|
||||
# Check service endpoints
|
||||
kubectl get endpoints kubescape
|
||||
|
||||
# Verify network policies
|
||||
kubectl get networkpolicies
|
||||
```
|
||||
|
||||
### Scan Times Out
|
||||
|
||||
For large clusters, use asynchronous scanning:
|
||||
|
||||
```bash
|
||||
# Trigger scan (returns immediately)
|
||||
curl -X POST http://127.0.0.1:8080/v1/scan \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{"targetType": "framework", "targetNames": ["nsa"]}'
|
||||
|
||||
# Poll for status
|
||||
while true; do
|
||||
STATUS=$(curl -s http://127.0.0.1:8080/v1/status | jq -r '.type')
|
||||
if [ "$STATUS" != "busy" ]; then
|
||||
break
|
||||
fi
|
||||
sleep 10
|
||||
done
|
||||
|
||||
# Get results
|
||||
curl http://127.0.0.1:8080/v1/results -o results.json
|
||||
```
|
||||
|
||||
### Permission Errors
|
||||
|
||||
Ensure the service account has sufficient RBAC permissions to read cluster resources.
|
||||
|
||||
---
|
||||
|
||||
## Related Documentation
|
||||
|
||||
- [HTTP Handler API Reference](../../README.md)
|
||||
- [Kubescape CLI Reference](../../../docs/cli-reference.md)
|
||||
- [Prometheus Integration](../prometheus/README.md)
|
||||
- [Getting Started Guide](../../../docs/getting-started.md)
|
||||
@@ -1,3 +1,69 @@
|
||||
# Prometheus Kubescape Integration
|
||||
# Prometheus Integration
|
||||
|
||||
Please find the new documentation at the following link: [Kubescape Prometheus Integration](https://github.com/kubescape/helm-charts/blob/main/charts/kubescape-operator/README.md#kubescape-prometheus-integration)
|
||||
> **Note**: The Prometheus integration documentation has moved to the Kubescape Helm Charts repository.
|
||||
|
||||
## Current Documentation
|
||||
|
||||
For the latest Prometheus integration guide, please visit:
|
||||
|
||||
**[Kubescape Prometheus Integration →](https://github.com/kubescape/helm-charts/blob/main/charts/kubescape-operator/README.md#kubescape-prometheus-integration)**
|
||||
|
||||
## Quick Overview
|
||||
|
||||
The Kubescape Operator exposes Prometheus metrics for monitoring your cluster's security posture.
|
||||
|
||||
### Features
|
||||
|
||||
- Compliance score metrics per framework
|
||||
- Control pass/fail counts
|
||||
- Vulnerability counts by severity
|
||||
- Resource scan statistics
|
||||
|
||||
### Installation with Prometheus Support
|
||||
|
||||
```bash
|
||||
helm repo add kubescape https://kubescape.github.io/helm-charts/
|
||||
helm repo update
|
||||
|
||||
helm upgrade --install kubescape kubescape/kubescape-operator \
|
||||
--namespace kubescape \
|
||||
--create-namespace \
|
||||
--set capabilities.prometheusExporter=enable
|
||||
```
|
||||
|
||||
### Available Metrics
|
||||
|
||||
| Metric | Description |
|
||||
|--------|-------------|
|
||||
| `kubescape_compliance_score` | Compliance score per framework (0-100) |
|
||||
| `kubescape_controls_passed` | Number of passed controls |
|
||||
| `kubescape_controls_failed` | Number of failed controls |
|
||||
| `kubescape_resources_scanned` | Total resources scanned |
|
||||
| `kubescape_vulnerabilities_total` | Vulnerabilities by severity |
|
||||
|
||||
### ServiceMonitor (for Prometheus Operator)
|
||||
|
||||
If you're using the Prometheus Operator, the Helm chart can create a ServiceMonitor:
|
||||
|
||||
```bash
|
||||
helm upgrade --install kubescape kubescape/kubescape-operator \
|
||||
--namespace kubescape \
|
||||
--create-namespace \
|
||||
--set capabilities.prometheusExporter=enable \
|
||||
--set serviceMonitor.enabled=true
|
||||
```
|
||||
|
||||
### Grafana Dashboard
|
||||
|
||||
A pre-built Grafana dashboard is available for visualizing Kubescape metrics:
|
||||
|
||||
- [Kubescape Grafana Dashboard](https://grafana.com/grafana/dashboards/18183-kubescape/)
|
||||
|
||||
---
|
||||
|
||||
## Related Documentation
|
||||
|
||||
- [Kubescape Operator Installation](https://kubescape.io/docs/install-operator/)
|
||||
- [Helm Charts Repository](https://github.com/kubescape/helm-charts)
|
||||
- [HTTP Handler API](../../README.md)
|
||||
- [Microservice Deployment](../microservice/README.md)
|
||||
@@ -1,8 +1,6 @@
|
||||
module github.com/kubescape/kubescape/v3/httphandler
|
||||
|
||||
go 1.24.1
|
||||
|
||||
toolchain go1.24.6
|
||||
go 1.25.5
|
||||
|
||||
replace github.com/kubescape/kubescape/v3 => ../
|
||||
|
||||
@@ -10,7 +8,7 @@ require (
|
||||
github.com/armosec/armoapi-go v0.0.562
|
||||
github.com/armosec/utils-go v0.0.58
|
||||
github.com/armosec/utils-k8s-go v0.0.30
|
||||
github.com/go-openapi/runtime v0.28.0
|
||||
github.com/go-openapi/runtime v0.29.2
|
||||
github.com/google/uuid v1.6.0
|
||||
github.com/gorilla/mux v1.8.1
|
||||
github.com/gorilla/schema v1.4.1
|
||||
@@ -20,47 +18,47 @@ require (
|
||||
github.com/kubescape/kubescape/v3 v3.0.4
|
||||
github.com/kubescape/opa-utils v0.0.288
|
||||
github.com/kubescape/storage v0.0.184
|
||||
github.com/spf13/viper v1.20.1
|
||||
github.com/spf13/viper v1.21.0
|
||||
github.com/stretchr/testify v1.11.1
|
||||
go.opentelemetry.io/contrib/instrumentation/github.com/gorilla/mux/otelmux v0.45.0
|
||||
go.opentelemetry.io/otel v1.37.0
|
||||
k8s.io/apimachinery v0.33.3
|
||||
k8s.io/client-go v0.33.3
|
||||
k8s.io/utils v0.0.0-20241210054802-24370beab758
|
||||
go.opentelemetry.io/otel v1.39.0
|
||||
k8s.io/apimachinery v0.35.0
|
||||
k8s.io/client-go v0.35.0
|
||||
k8s.io/utils v0.0.0-20251002143259-bc988d571ff4
|
||||
)
|
||||
|
||||
require (
|
||||
go.opentelemetry.io/otel/trace v1.37.0
|
||||
go.opentelemetry.io/otel/trace v1.39.0
|
||||
go.uber.org/multierr v1.11.0 // indirect
|
||||
go.uber.org/zap v1.27.0 // indirect
|
||||
golang.org/x/crypto v0.41.0 // indirect
|
||||
golang.org/x/exp v0.0.0-20250711185948-6ae5c78190dc // indirect
|
||||
golang.org/x/mod v0.27.0 // indirect
|
||||
golang.org/x/net v0.43.0 // indirect
|
||||
golang.org/x/oauth2 v0.30.0 // indirect
|
||||
google.golang.org/genproto v0.0.0-20250715232539-7130f93afb79 // indirect
|
||||
google.golang.org/grpc v1.74.0 // indirect
|
||||
go.uber.org/zap v1.27.1 // indirect
|
||||
golang.org/x/crypto v0.46.0 // indirect
|
||||
golang.org/x/exp v0.0.0-20250911091902-df9299821621 // indirect
|
||||
golang.org/x/mod v0.31.0 // indirect
|
||||
golang.org/x/net v0.48.0 // indirect
|
||||
golang.org/x/oauth2 v0.34.0 // indirect
|
||||
google.golang.org/genproto v0.0.0-20251202230838-ff82c1b0f217 // indirect
|
||||
google.golang.org/grpc v1.78.0 // indirect
|
||||
)
|
||||
|
||||
require (
|
||||
cel.dev/expr v0.24.0 // indirect
|
||||
cloud.google.com/go v0.121.3 // indirect
|
||||
cloud.google.com/go/auth v0.16.2 // indirect
|
||||
cel.dev/expr v0.25.1 // indirect
|
||||
cloud.google.com/go v0.121.6 // indirect
|
||||
cloud.google.com/go/auth v0.18.0 // indirect
|
||||
cloud.google.com/go/auth/oauth2adapt v0.2.8 // indirect
|
||||
cloud.google.com/go/compute/metadata v0.7.0 // indirect
|
||||
cloud.google.com/go/container v1.43.0 // indirect
|
||||
cloud.google.com/go/iam v1.5.2 // indirect
|
||||
cloud.google.com/go/monitoring v1.24.2 // indirect
|
||||
cloud.google.com/go/storage v1.55.0 // indirect
|
||||
cloud.google.com/go/compute/metadata v0.9.0 // indirect
|
||||
cloud.google.com/go/container v1.45.0 // indirect
|
||||
cloud.google.com/go/iam v1.5.3 // indirect
|
||||
cloud.google.com/go/monitoring v1.24.3 // indirect
|
||||
cloud.google.com/go/storage v1.57.1 // indirect
|
||||
cyphar.com/go-pathrs v0.2.1 // indirect
|
||||
dario.cat/mergo v1.0.2 // indirect
|
||||
filippo.io/edwards25519 v1.1.0 // indirect
|
||||
github.com/AdaLogics/go-fuzz-headers v0.0.0-20240806141605-e8a1dd7889d6 // indirect
|
||||
github.com/AdamKorcz/go-118-fuzz-build v0.0.0-20250520111509-a70c2aa677fa // indirect
|
||||
github.com/AliyunContainerService/ack-ram-tool/pkg/credentials/alibabacloudsdkgo/helper v0.2.0 // indirect
|
||||
github.com/AliyunContainerService/ack-ram-tool/pkg/credentials/provider v0.14.0 // indirect
|
||||
github.com/Azure/azure-sdk-for-go v68.0.0+incompatible // indirect
|
||||
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.17.1 // indirect
|
||||
github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.8.2 // indirect
|
||||
github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0 // indirect
|
||||
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.20.0 // indirect
|
||||
github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.13.1 // indirect
|
||||
github.com/Azure/azure-sdk-for-go/sdk/internal v1.11.2 // indirect
|
||||
github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization v1.0.0 // indirect
|
||||
github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v2 v2.1.1 // indirect
|
||||
github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v2 v2.4.0 // indirect
|
||||
@@ -73,13 +71,13 @@ require (
|
||||
github.com/Azure/go-autorest/autorest/date v0.3.0 // indirect
|
||||
github.com/Azure/go-autorest/logger v0.2.1 // indirect
|
||||
github.com/Azure/go-autorest/tracing v0.6.0 // indirect
|
||||
github.com/AzureAD/microsoft-authentication-library-for-go v1.3.3 // indirect
|
||||
github.com/AzureAD/microsoft-authentication-library-for-go v1.6.0 // indirect
|
||||
github.com/BurntSushi/toml v1.5.0 // indirect
|
||||
github.com/CycloneDX/cyclonedx-go v0.9.2 // indirect
|
||||
github.com/DataDog/zstd v1.5.7 // indirect
|
||||
github.com/GoogleCloudPlatform/opentelemetry-operations-go/detectors/gcp v1.29.0 // indirect
|
||||
github.com/GoogleCloudPlatform/opentelemetry-operations-go/exporter/metric v0.53.0 // indirect
|
||||
github.com/GoogleCloudPlatform/opentelemetry-operations-go/internal/resourcemapping v0.53.0 // indirect
|
||||
github.com/GoogleCloudPlatform/opentelemetry-operations-go/detectors/gcp v1.30.0 // indirect
|
||||
github.com/GoogleCloudPlatform/opentelemetry-operations-go/exporter/metric v0.54.0 // indirect
|
||||
github.com/GoogleCloudPlatform/opentelemetry-operations-go/internal/resourcemapping v0.54.0 // indirect
|
||||
github.com/Intevation/gval v1.3.0 // indirect
|
||||
github.com/Intevation/jsonpath v0.2.1 // indirect
|
||||
github.com/MakeNowJust/heredoc v1.0.0 // indirect
|
||||
@@ -88,7 +86,7 @@ require (
|
||||
github.com/Masterminds/semver/v3 v3.4.0 // indirect
|
||||
github.com/Masterminds/sprig/v3 v3.3.0 // indirect
|
||||
github.com/Microsoft/go-winio v0.6.2 // indirect
|
||||
github.com/Microsoft/hcsshim v0.13.0 // indirect
|
||||
github.com/Microsoft/hcsshim v0.14.0-rc.1 // indirect
|
||||
github.com/OneOfOne/xxhash v1.2.8 // indirect
|
||||
github.com/ProtonMail/go-crypto v1.3.0 // indirect
|
||||
github.com/STARRY-S/zip v0.2.3 // indirect
|
||||
@@ -109,7 +107,7 @@ require (
|
||||
github.com/alibabacloud-go/tea v1.2.1 // indirect
|
||||
github.com/alibabacloud-go/tea-utils v1.4.5 // indirect
|
||||
github.com/alibabacloud-go/tea-xml v1.1.3 // indirect
|
||||
github.com/aliyun/credentials-go v1.3.1 // indirect
|
||||
github.com/aliyun/credentials-go v1.3.2 // indirect
|
||||
github.com/anchore/archiver/v3 v3.5.3-0.20241210171143-5b1d8d1c7c51 // indirect
|
||||
github.com/anchore/clio v0.0.0-20250715152405-a0fa658e5084 // indirect
|
||||
github.com/anchore/fangs v0.0.0-20250716230140-94c22408c232 // indirect
|
||||
@@ -133,25 +131,26 @@ require (
|
||||
github.com/aquasecurity/go-version v0.0.1 // indirect
|
||||
github.com/armosec/gojay v1.2.17 // indirect
|
||||
github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 // indirect
|
||||
github.com/aws/aws-sdk-go v1.55.7 // indirect
|
||||
github.com/aws/aws-sdk-go-v2 v1.36.5 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/config v1.29.17 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/credentials v1.17.70 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.32 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.36 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.36 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/internal/ini v1.8.3 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/service/ecr v1.45.1 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/service/ecrpublic v1.33.2 // indirect
|
||||
github.com/aws/aws-sdk-go v1.55.8 // indirect
|
||||
github.com/aws/aws-sdk-go-v2 v1.41.0 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/config v1.32.5 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/credentials v1.19.5 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.18.16 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.16 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.16 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/internal/ini v1.8.4 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/service/ecr v1.51.2 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/service/ecrpublic v1.38.2 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/service/eks v1.48.5 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/service/iam v1.35.3 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.12.4 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.12.17 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/service/sso v1.25.5 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.30.3 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/service/sts v1.34.0 // indirect
|
||||
github.com/aws/smithy-go v1.22.4 // indirect
|
||||
github.com/awslabs/amazon-ecr-credential-helper/ecr-login v0.10.1 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.4 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.13.16 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/service/signin v1.0.4 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/service/sso v1.30.7 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.35.12 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/service/sts v1.41.5 // indirect
|
||||
github.com/aws/smithy-go v1.24.0 // indirect
|
||||
github.com/awslabs/amazon-ecr-credential-helper/ecr-login v0.11.0 // indirect
|
||||
github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect
|
||||
github.com/becheran/wildmatch-go v1.0.0 // indirect
|
||||
github.com/beorn7/perks v1.0.1 // indirect
|
||||
@@ -167,57 +166,62 @@ require (
|
||||
github.com/bodgit/windows v1.0.1 // indirect
|
||||
github.com/boombuler/barcode v1.0.2 // indirect
|
||||
github.com/briandowns/spinner v1.23.2 // indirect
|
||||
github.com/buildkite/agent/v3 v3.62.0 // indirect
|
||||
github.com/buildkite/go-pipeline v0.3.2 // indirect
|
||||
github.com/buildkite/interpolate v0.0.0-20200526001904-07f35b4ae251 // indirect
|
||||
github.com/buildkite/agent/v3 v3.115.2 // indirect
|
||||
github.com/buildkite/go-pipeline v0.16.0 // indirect
|
||||
github.com/buildkite/interpolate v0.1.5 // indirect
|
||||
github.com/buildkite/roko v1.4.0 // indirect
|
||||
github.com/cenkalti/backoff/v4 v4.3.0 // indirect
|
||||
github.com/cenkalti/backoff/v5 v5.0.2 // indirect
|
||||
github.com/cenkalti/backoff/v5 v5.0.3 // indirect
|
||||
github.com/cespare/xxhash/v2 v2.3.0 // indirect
|
||||
github.com/chai2010/gettext-go v1.0.2 // indirect
|
||||
github.com/chainguard-dev/git-urls v1.0.2 // indirect
|
||||
github.com/charmbracelet/colorprofile v0.3.1 // indirect
|
||||
github.com/charmbracelet/lipgloss v1.1.0 // indirect
|
||||
github.com/charmbracelet/x/ansi v0.9.3 // indirect
|
||||
github.com/charmbracelet/x/ansi v0.10.2 // indirect
|
||||
github.com/charmbracelet/x/cellbuf v0.0.13 // indirect
|
||||
github.com/charmbracelet/x/term v0.2.1 // indirect
|
||||
github.com/chrismellard/docker-credential-acr-env v0.0.0-20230304212654-82a0ddb27589 // indirect
|
||||
github.com/cilium/cilium v1.16.9 // indirect
|
||||
github.com/cilium/cilium v1.16.17 // indirect
|
||||
github.com/clbanning/mxj/v2 v2.7.0 // indirect
|
||||
github.com/clipperhouse/displaywidth v0.6.0 // indirect
|
||||
github.com/clipperhouse/stringish v0.1.1 // indirect
|
||||
github.com/clipperhouse/uax29/v2 v2.3.0 // indirect
|
||||
github.com/cloudflare/circl v1.6.1 // indirect
|
||||
github.com/cncf/xds/go v0.0.0-20250501225837-2ac532fd4443 // indirect
|
||||
github.com/cncf/xds/go v0.0.0-20251022180443-0feb69152e9f // indirect
|
||||
github.com/common-nighthawk/go-figure v0.0.0-20210622060536-734e95fb86be // indirect
|
||||
github.com/containerd/cgroups/v3 v3.0.5 // indirect
|
||||
github.com/containerd/console v1.0.4 // indirect
|
||||
github.com/containerd/containerd v1.7.28 // indirect
|
||||
github.com/containerd/containerd/api v1.9.0 // indirect
|
||||
github.com/containerd/containerd/v2 v2.0.5 // indirect
|
||||
github.com/containerd/cgroups/v3 v3.1.0 // indirect
|
||||
github.com/containerd/console v1.0.5 // indirect
|
||||
github.com/containerd/containerd v1.7.29 // indirect
|
||||
github.com/containerd/containerd/api v1.10.0 // indirect
|
||||
github.com/containerd/containerd/v2 v2.2.1-0.20251115011841-efd86f2b0bc2 // indirect
|
||||
github.com/containerd/continuity v0.4.5 // indirect
|
||||
github.com/containerd/errdefs v1.0.0 // indirect
|
||||
github.com/containerd/errdefs/pkg v0.3.0 // indirect
|
||||
github.com/containerd/fifo v1.1.0 // indirect
|
||||
github.com/containerd/log v0.1.0 // indirect
|
||||
github.com/containerd/platforms v1.0.0-rc.1 // indirect
|
||||
github.com/containerd/stargz-snapshotter/estargz v0.16.3 // indirect
|
||||
github.com/containerd/platforms v1.0.0-rc.2 // indirect
|
||||
github.com/containerd/stargz-snapshotter/estargz v0.18.1 // indirect
|
||||
github.com/containerd/ttrpc v1.2.7 // indirect
|
||||
github.com/containerd/typeurl/v2 v2.2.3 // indirect
|
||||
github.com/containers/common v0.63.0 // indirect
|
||||
github.com/coreos/go-oidc/v3 v3.14.1 // indirect
|
||||
github.com/coreos/go-oidc/v3 v3.17.0 // indirect
|
||||
github.com/cpuguy83/dockercfg v0.3.2 // indirect
|
||||
github.com/cpuguy83/go-docker v0.3.0 // indirect
|
||||
github.com/cyberphone/json-canonicalization v0.0.0-20241213102144-19d51d7fe467 // indirect
|
||||
github.com/cyphar/filepath-securejoin v0.4.1 // indirect
|
||||
github.com/cyphar/filepath-securejoin v0.6.0 // indirect
|
||||
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
|
||||
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.4.0 // indirect
|
||||
github.com/deitch/magic v0.0.0-20240306090643-c67ab88f10cb // indirect
|
||||
github.com/digitorus/pkcs7 v0.0.0-20230818184609-3a137a874352 // indirect
|
||||
github.com/digitorus/timestamp v0.0.0-20231217203849-220c5c2851b7 // indirect
|
||||
github.com/dimchansky/utfbom v1.1.1 // indirect
|
||||
github.com/diskfs/go-diskfs v1.7.0 // indirect
|
||||
github.com/distribution/reference v0.6.0 // indirect
|
||||
github.com/docker/buildx v0.21.3 // indirect
|
||||
github.com/docker/cli v28.3.3+incompatible // indirect
|
||||
github.com/docker/buildx v0.30.1 // indirect
|
||||
github.com/docker/cli v29.0.3+incompatible // indirect
|
||||
github.com/docker/distribution v2.8.3+incompatible // indirect
|
||||
github.com/docker/docker v28.3.3+incompatible // indirect
|
||||
github.com/docker/docker-credential-helpers v0.9.3 // indirect
|
||||
github.com/docker/docker v28.5.2+incompatible // indirect
|
||||
github.com/docker/docker-credential-helpers v0.9.4 // indirect
|
||||
github.com/docker/go-connections v0.6.0 // indirect
|
||||
github.com/docker/go-events v0.0.0-20250114142523-c867878c5e32 // indirect
|
||||
github.com/docker/go-units v0.5.0 // indirect
|
||||
@@ -225,10 +229,10 @@ require (
|
||||
github.com/dustin/go-humanize v1.0.1 // indirect
|
||||
github.com/elliotchance/orderedmap v1.5.0 // indirect
|
||||
github.com/elliotchance/phpserialize v1.4.0 // indirect
|
||||
github.com/emicklei/go-restful/v3 v3.12.0 // indirect
|
||||
github.com/emicklei/go-restful/v3 v3.13.0 // indirect
|
||||
github.com/emirpasic/gods v1.18.1 // indirect
|
||||
github.com/enescakir/emoji v1.0.0 // indirect
|
||||
github.com/envoyproxy/go-control-plane/envoy v1.32.4 // indirect
|
||||
github.com/envoyproxy/go-control-plane/envoy v1.35.0 // indirect
|
||||
github.com/envoyproxy/protoc-gen-validate v1.2.1 // indirect
|
||||
github.com/evanphx/json-patch v5.9.11+incompatible // indirect
|
||||
github.com/exponent-io/jsonpath v0.0.0-20210407135951-1de76d718b3f // indirect
|
||||
@@ -240,69 +244,79 @@ require (
|
||||
github.com/francoispqt/gojay v1.2.13 // indirect
|
||||
github.com/fsnotify/fsnotify v1.9.0 // indirect
|
||||
github.com/fvbommel/sortorder v1.1.0 // indirect
|
||||
github.com/fxamacker/cbor/v2 v2.7.0 // indirect
|
||||
github.com/gabriel-vasile/mimetype v1.4.10 // indirect
|
||||
github.com/fxamacker/cbor/v2 v2.9.0 // indirect
|
||||
github.com/gabriel-vasile/mimetype v1.4.11 // indirect
|
||||
github.com/github/go-spdx/v2 v2.3.3 // indirect
|
||||
github.com/glebarez/go-sqlite v1.22.0 // indirect
|
||||
github.com/glebarez/sqlite v1.11.0 // indirect
|
||||
github.com/go-chi/chi v4.1.2+incompatible // indirect
|
||||
github.com/go-chi/chi/v5 v5.2.4 // indirect
|
||||
github.com/go-errors/errors v1.4.2 // indirect
|
||||
github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 // indirect
|
||||
github.com/go-git/go-billy/v5 v5.6.2 // indirect
|
||||
github.com/go-git/go-git/v5 v5.16.2 // indirect
|
||||
github.com/go-gota/gota v0.12.0 // indirect
|
||||
github.com/go-ini/ini v1.67.0 // indirect
|
||||
github.com/go-jose/go-jose/v3 v3.0.4 // indirect
|
||||
github.com/go-jose/go-jose/v4 v4.0.5 // indirect
|
||||
github.com/go-jose/go-jose/v4 v4.1.3 // indirect
|
||||
github.com/go-logr/logr v1.4.3 // indirect
|
||||
github.com/go-logr/stdr v1.2.2 // indirect
|
||||
github.com/go-openapi/analysis v0.23.0 // indirect
|
||||
github.com/go-openapi/errors v0.22.1 // indirect
|
||||
github.com/go-openapi/jsonpointer v0.21.0 // indirect
|
||||
github.com/go-openapi/jsonreference v0.21.0 // indirect
|
||||
github.com/go-openapi/loads v0.22.0 // indirect
|
||||
github.com/go-openapi/spec v0.21.0 // indirect
|
||||
github.com/go-openapi/strfmt v0.23.0 // indirect
|
||||
github.com/go-openapi/swag v0.23.1 // indirect
|
||||
github.com/go-openapi/validate v0.24.0 // indirect
|
||||
github.com/go-piv/piv-go v1.11.0 // indirect
|
||||
github.com/go-openapi/analysis v0.24.1 // indirect
|
||||
github.com/go-openapi/errors v0.22.6 // indirect
|
||||
github.com/go-openapi/jsonpointer v0.22.4 // indirect
|
||||
github.com/go-openapi/jsonreference v0.21.4 // indirect
|
||||
github.com/go-openapi/loads v0.23.2 // indirect
|
||||
github.com/go-openapi/spec v0.22.3 // indirect
|
||||
github.com/go-openapi/strfmt v0.25.0 // indirect
|
||||
github.com/go-openapi/swag v0.25.4 // indirect
|
||||
github.com/go-openapi/swag/cmdutils v0.25.4 // indirect
|
||||
github.com/go-openapi/swag/conv v0.25.4 // indirect
|
||||
github.com/go-openapi/swag/fileutils v0.25.4 // indirect
|
||||
github.com/go-openapi/swag/jsonname v0.25.4 // indirect
|
||||
github.com/go-openapi/swag/jsonutils v0.25.4 // indirect
|
||||
github.com/go-openapi/swag/loading v0.25.4 // indirect
|
||||
github.com/go-openapi/swag/mangling v0.25.4 // indirect
|
||||
github.com/go-openapi/swag/netutils v0.25.4 // indirect
|
||||
github.com/go-openapi/swag/stringutils v0.25.4 // indirect
|
||||
github.com/go-openapi/swag/typeutils v0.25.4 // indirect
|
||||
github.com/go-openapi/swag/yamlutils v0.25.4 // indirect
|
||||
github.com/go-openapi/validate v0.25.1 // indirect
|
||||
github.com/go-piv/piv-go/v2 v2.4.0 // indirect
|
||||
github.com/go-restruct/restruct v1.2.0-alpha // indirect
|
||||
github.com/go-viper/mapstructure/v2 v2.4.0 // indirect
|
||||
github.com/gobwas/glob v0.2.3 // indirect
|
||||
github.com/goccy/go-json v0.10.2 // indirect
|
||||
github.com/goccy/go-json v0.10.5 // indirect
|
||||
github.com/goccy/go-yaml v1.18.0 // indirect
|
||||
github.com/gocsaf/csaf/v3 v3.3.0 // indirect
|
||||
github.com/gofrs/flock v0.12.1 // indirect
|
||||
github.com/gofrs/flock v0.13.0 // indirect
|
||||
github.com/gogo/protobuf v1.3.2 // indirect
|
||||
github.com/gohugoio/hashstructure v0.5.0 // indirect
|
||||
github.com/gohugoio/hashstructure v0.6.0 // indirect
|
||||
github.com/golang-jwt/jwt/v4 v4.5.2 // indirect
|
||||
github.com/golang-jwt/jwt/v5 v5.2.2 // indirect
|
||||
github.com/golang-jwt/jwt/v5 v5.3.0 // indirect
|
||||
github.com/golang/groupcache v0.0.0-20241129210726-2c02b8208cf8 // indirect
|
||||
github.com/golang/protobuf v1.5.4 // indirect
|
||||
github.com/golang/snappy v1.0.0 // indirect
|
||||
github.com/google/btree v1.1.3 // indirect
|
||||
github.com/google/certificate-transparency-go v1.3.1 // indirect
|
||||
github.com/google/gnostic-models v0.6.9 // indirect
|
||||
github.com/google/certificate-transparency-go v1.3.2 // indirect
|
||||
github.com/google/gnostic-models v0.7.0 // indirect
|
||||
github.com/google/go-cmp v0.7.0 // indirect
|
||||
github.com/google/go-containerregistry v0.20.6 // indirect
|
||||
github.com/google/go-github/v55 v55.0.0 // indirect
|
||||
github.com/google/go-querystring v1.1.0 // indirect
|
||||
github.com/google/go-containerregistry v0.20.7 // indirect
|
||||
github.com/google/go-github/v73 v73.0.0 // indirect
|
||||
github.com/google/go-querystring v1.2.0 // indirect
|
||||
github.com/google/licensecheck v0.3.1 // indirect
|
||||
github.com/google/pprof v0.0.0-20250630185457-6e76a2b096b5 // indirect
|
||||
github.com/google/pprof v0.0.0-20250820193118-f64d9cf942d6 // indirect
|
||||
github.com/google/s2a-go v0.1.9 // indirect
|
||||
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect
|
||||
github.com/googleapis/enterprise-certificate-proxy v0.3.6 // indirect
|
||||
github.com/googleapis/gax-go/v2 v2.15.0 // indirect
|
||||
github.com/googleapis/enterprise-certificate-proxy v0.3.9 // indirect
|
||||
github.com/googleapis/gax-go/v2 v2.16.0 // indirect
|
||||
github.com/gookit/color v1.6.0 // indirect
|
||||
github.com/gorilla/websocket v1.5.4-0.20250319132907-e064f32e3674 // indirect
|
||||
github.com/gregjones/httpcache v0.0.0-20190611155906-901d90724c79 // indirect
|
||||
github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.1 // indirect
|
||||
github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.4 // indirect
|
||||
github.com/hako/durafmt v0.0.0-20210608085754-5c1018a4e16b // indirect
|
||||
github.com/hashicorp/errwrap v1.1.0 // indirect
|
||||
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
|
||||
github.com/hashicorp/go-getter v1.7.9 // indirect
|
||||
github.com/hashicorp/go-multierror v1.1.1 // indirect
|
||||
github.com/hashicorp/go-retryablehttp v0.7.7 // indirect
|
||||
github.com/hashicorp/go-retryablehttp v0.7.8 // indirect
|
||||
github.com/hashicorp/go-safetemp v1.0.0 // indirect
|
||||
github.com/hashicorp/go-version v1.7.0 // indirect
|
||||
github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect
|
||||
@@ -311,6 +325,7 @@ require (
|
||||
github.com/hhrutter/tiff v1.0.1 // indirect
|
||||
github.com/huandu/xstrings v1.5.0 // indirect
|
||||
github.com/iancoleman/strcase v0.3.0 // indirect
|
||||
github.com/in-toto/attestation v1.1.2 // indirect
|
||||
github.com/in-toto/in-toto-golang v0.9.0 // indirect
|
||||
github.com/inconshreveable/mousetrap v1.1.0 // indirect
|
||||
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect
|
||||
@@ -322,36 +337,42 @@ require (
|
||||
github.com/jmespath/go-jmespath v0.4.1-0.20220621161143-b0104c826a24 // indirect
|
||||
github.com/johnfercher/go-tree v1.1.0 // indirect
|
||||
github.com/johnfercher/maroto/v2 v2.2.2 // indirect
|
||||
github.com/josharian/intern v1.0.0 // indirect
|
||||
github.com/json-iterator/go v1.1.12 // indirect
|
||||
github.com/jung-kurt/gofpdf v1.16.2 // indirect
|
||||
github.com/jwalton/gchalk v1.3.0 // indirect
|
||||
github.com/jwalton/go-supportscolor v1.1.0 // indirect
|
||||
github.com/kastenhq/goversion v0.0.0-20230811215019-93b2f8823953 // indirect
|
||||
github.com/kevinburke/ssh_config v1.2.0 // indirect
|
||||
github.com/klauspost/compress v1.18.0 // indirect
|
||||
github.com/klauspost/compress v1.18.2 // indirect
|
||||
github.com/klauspost/pgzip v1.2.6 // indirect
|
||||
github.com/knqyf263/go-apk-version v0.0.0-20200609155635-041fdbb8563f // indirect
|
||||
github.com/knqyf263/go-deb-version v0.0.0-20241115132648-6f4aee6ccd23 // indirect
|
||||
github.com/knqyf263/go-rpm-version v0.0.0-20220614171824-631e686d1075 // indirect
|
||||
github.com/kubescape/go-git-url v0.0.30 // indirect
|
||||
github.com/kubescape/go-git-url v0.0.31 // indirect
|
||||
github.com/kubescape/rbac-utils v0.0.21-0.20230806101615-07e36f555520 // indirect
|
||||
github.com/kubescape/regolibrary/v2 v2.0.1 // indirect
|
||||
github.com/kylelemons/godebug v1.1.0 // indirect
|
||||
github.com/letsencrypt/boulder v0.0.0-20240620165639-de9c06129bec // indirect
|
||||
github.com/lestrrat-go/blackmagic v1.0.4 // indirect
|
||||
github.com/lestrrat-go/dsig v1.0.0 // indirect
|
||||
github.com/lestrrat-go/dsig-secp256k1 v1.0.0 // indirect
|
||||
github.com/lestrrat-go/httpcc v1.0.1 // indirect
|
||||
github.com/lestrrat-go/httprc/v3 v3.0.1 // indirect
|
||||
github.com/lestrrat-go/jwx/v3 v3.0.12 // indirect
|
||||
github.com/lestrrat-go/option v1.0.1 // indirect
|
||||
github.com/lestrrat-go/option/v2 v2.0.0 // indirect
|
||||
github.com/letsencrypt/boulder v0.20251110.0 // indirect
|
||||
github.com/liggitt/tabwriter v0.0.0-20181228230101-89fcab3d43de // indirect
|
||||
github.com/lucasb-eyer/go-colorful v1.2.0 // indirect
|
||||
github.com/lucasb-eyer/go-colorful v1.3.0 // indirect
|
||||
github.com/mackerelio/go-osstat v0.2.5 // indirect
|
||||
github.com/magiconair/properties v1.8.10 // indirect
|
||||
github.com/mailru/easyjson v0.9.0 // indirect
|
||||
github.com/maruel/natural v1.1.1 // indirect
|
||||
github.com/masahiro331/go-mvn-version v0.0.0-20250131095131-f4974fa13b8a // indirect
|
||||
github.com/matthyx/go-gitlog v0.0.0-20231005131906-9ffabe3c5bcd // indirect
|
||||
github.com/mattn/go-colorable v0.1.14 // indirect
|
||||
github.com/mattn/go-isatty v0.0.20 // indirect
|
||||
github.com/mattn/go-runewidth v0.0.16 // indirect
|
||||
github.com/mattn/go-runewidth v0.0.19 // indirect
|
||||
github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d // indirect
|
||||
github.com/mholt/archives v0.1.3 // indirect
|
||||
github.com/mholt/archives v0.1.5 // indirect
|
||||
github.com/miekg/pkcs11 v1.1.1 // indirect
|
||||
github.com/mikefarah/yq/v4 v4.29.1 // indirect
|
||||
github.com/mikelolasagasti/xz v1.0.1 // indirect
|
||||
@@ -361,9 +382,9 @@ require (
|
||||
github.com/mitchellh/go-homedir v1.1.0 // indirect
|
||||
github.com/mitchellh/go-wordwrap v1.0.1 // indirect
|
||||
github.com/mitchellh/hashstructure/v2 v2.0.2 // indirect
|
||||
github.com/mitchellh/mapstructure v1.5.0 // indirect
|
||||
github.com/mitchellh/mapstructure v1.5.1-0.20231216201459-8508981c8b6c // indirect
|
||||
github.com/mitchellh/reflectwalk v1.0.2 // indirect
|
||||
github.com/moby/buildkit v0.21.0 // indirect
|
||||
github.com/moby/buildkit v0.26.1 // indirect
|
||||
github.com/moby/docker-image-spec v1.3.1 // indirect
|
||||
github.com/moby/locker v1.0.1 // indirect
|
||||
github.com/moby/patternmatcher v0.6.0 // indirect
|
||||
@@ -376,10 +397,10 @@ require (
|
||||
github.com/moby/sys/userns v0.1.0 // indirect
|
||||
github.com/moby/term v0.5.2 // indirect
|
||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
|
||||
github.com/modern-go/reflect2 v1.0.2 // indirect
|
||||
github.com/modern-go/reflect2 v1.0.3-0.20250322232337-35a7c28c31ee // indirect
|
||||
github.com/monochromegane/go-gitignore v0.0.0-20200626010858-205db1a8cc00 // indirect
|
||||
github.com/morikuni/aec v1.0.0 // indirect
|
||||
github.com/mozillazg/docker-credential-acr-helper v0.3.0 // indirect
|
||||
github.com/mozillazg/docker-credential-acr-helper v0.4.0 // indirect
|
||||
github.com/muesli/termenv v0.16.0 // indirect
|
||||
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
|
||||
github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f // indirect
|
||||
@@ -387,19 +408,19 @@ require (
|
||||
github.com/nix-community/go-nix v0.0.0-20250101154619-4bdde671e0a1 // indirect
|
||||
github.com/nozzle/throttler v0.0.0-20180817012639-2ea982251481 // indirect
|
||||
github.com/nwaples/rardecode v1.1.3 // indirect
|
||||
github.com/nwaples/rardecode/v2 v2.1.1 // indirect
|
||||
github.com/nwaples/rardecode/v2 v2.2.0 // indirect
|
||||
github.com/oklog/ulid v1.3.1 // indirect
|
||||
github.com/oleiade/reflections v1.0.1 // indirect
|
||||
github.com/oleiade/reflections v1.1.0 // indirect
|
||||
github.com/olekukonko/cat v0.0.0-20250911104152-50322a0618f6 // indirect
|
||||
github.com/olekukonko/errors v1.1.0 // indirect
|
||||
github.com/olekukonko/ll v0.0.9 // indirect
|
||||
github.com/olekukonko/tablewriter v1.0.9 // indirect
|
||||
github.com/olekukonko/ll v0.1.3 // indirect
|
||||
github.com/olekukonko/tablewriter v1.1.2 // indirect
|
||||
github.com/olvrng/ujson v1.1.0 // indirect
|
||||
github.com/open-policy-agent/opa v1.4.0 // indirect
|
||||
github.com/open-policy-agent/opa v1.12.1 // indirect
|
||||
github.com/opencontainers/go-digest v1.0.0 // indirect
|
||||
github.com/opencontainers/image-spec v1.1.1 // indirect
|
||||
github.com/opencontainers/runtime-spec v1.2.1 // indirect
|
||||
github.com/opencontainers/selinux v1.12.0 // indirect
|
||||
github.com/opentracing/opentracing-go v1.2.1-0.20220228012449-10b1cf09e00b // indirect
|
||||
github.com/opencontainers/selinux v1.13.0 // indirect
|
||||
github.com/openvex/go-vex v0.2.5 // indirect
|
||||
github.com/owenrumney/go-sarif v1.1.2-0.20231003122901-1000f5e05554 // indirect
|
||||
github.com/owenrumney/go-sarif/v2 v2.3.0 // indirect
|
||||
@@ -421,20 +442,20 @@ require (
|
||||
github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10 // indirect
|
||||
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
|
||||
github.com/project-copacetic/copacetic v0.10.0 // indirect
|
||||
github.com/prometheus/client_golang v1.22.0 // indirect
|
||||
github.com/prometheus/client_model v0.6.1 // indirect
|
||||
github.com/prometheus/common v0.62.0 // indirect
|
||||
github.com/prometheus/procfs v0.15.1 // indirect
|
||||
github.com/prometheus/client_golang v1.23.2 // indirect
|
||||
github.com/prometheus/client_model v0.6.2 // indirect
|
||||
github.com/prometheus/common v0.67.5 // indirect
|
||||
github.com/prometheus/procfs v0.17.0 // indirect
|
||||
github.com/quay/claircore v1.5.35 // indirect
|
||||
github.com/quay/claircore/toolkit v1.2.4 // indirect
|
||||
github.com/quay/zlog v1.1.8 // indirect
|
||||
github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect
|
||||
github.com/rcrowley/go-metrics v0.0.0-20250401214520-65e299d6c5c9 // indirect
|
||||
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect
|
||||
github.com/rivo/uniseg v0.4.7 // indirect
|
||||
github.com/rs/zerolog v1.30.0 // indirect
|
||||
github.com/russross/blackfriday/v2 v2.1.0 // indirect
|
||||
github.com/rust-secure-code/go-rustaudit v0.0.0-20250226111315-e20ec32e963c // indirect
|
||||
github.com/sagikazarmark/locafero v0.9.0 // indirect
|
||||
github.com/sagikazarmark/locafero v0.11.0 // indirect
|
||||
github.com/saintfish/chardet v0.0.0-20230101081208-5e3ef4b5456d // indirect
|
||||
github.com/santhosh-tekuri/jsonschema/v6 v6.0.2 // indirect
|
||||
github.com/sasha-s/go-deadlock v0.3.5 // indirect
|
||||
@@ -443,59 +464,63 @@ require (
|
||||
github.com/schollz/progressbar/v3 v3.13.0 // indirect
|
||||
github.com/scylladb/go-set v1.0.3-0.20200225121959-cc7b2070d91e // indirect
|
||||
github.com/seccomp/libseccomp-golang v0.10.0 // indirect
|
||||
github.com/secure-systems-lab/go-securesystemslib v0.9.0 // indirect
|
||||
github.com/segmentio/ksuid v1.0.4 // indirect
|
||||
github.com/secure-systems-lab/go-securesystemslib v0.10.0 // indirect
|
||||
github.com/segmentio/asm v1.2.1 // indirect
|
||||
github.com/sergi/go-diff v1.4.0 // indirect
|
||||
github.com/shibumi/go-pathspec v1.3.0 // indirect
|
||||
github.com/shopspring/decimal v1.4.0 // indirect
|
||||
github.com/sigstore/cosign/v2 v2.2.4 // indirect
|
||||
github.com/sigstore/fulcio v1.6.6 // indirect
|
||||
github.com/sigstore/protobuf-specs v0.4.1 // indirect
|
||||
github.com/sigstore/rekor v1.3.10 // indirect
|
||||
github.com/sigstore/sigstore v1.9.5 // indirect
|
||||
github.com/sigstore/timestamp-authority v1.2.2 // indirect
|
||||
github.com/sirupsen/logrus v1.9.4-0.20230606125235-dd1b4c2e81af // indirect
|
||||
github.com/sigstore/cosign/v3 v3.0.4 // indirect
|
||||
github.com/sigstore/fulcio v1.8.5 // indirect
|
||||
github.com/sigstore/protobuf-specs v0.5.0 // indirect
|
||||
github.com/sigstore/rekor v1.5.0 // indirect
|
||||
github.com/sigstore/rekor-tiles/v2 v2.0.1 // indirect
|
||||
github.com/sigstore/sigstore v1.10.3 // indirect
|
||||
github.com/sigstore/sigstore-go v1.1.4 // indirect
|
||||
github.com/sigstore/timestamp-authority/v2 v2.0.4 // indirect
|
||||
github.com/sirupsen/logrus v1.9.4 // indirect
|
||||
github.com/skeema/knownhosts v1.3.1 // indirect
|
||||
github.com/skratchdot/open-golang v0.0.0-20200116055534-eef842397966 // indirect
|
||||
github.com/sorairolake/lzip-go v0.3.7 // indirect
|
||||
github.com/sourcegraph/conc v0.3.0 // indirect
|
||||
github.com/sorairolake/lzip-go v0.3.8 // indirect
|
||||
github.com/sourcegraph/conc v0.3.1-0.20240121214520-5f936abd7ae8 // indirect
|
||||
github.com/spdx/gordf v0.0.0-20250128162952-000978ccd6fb // indirect
|
||||
github.com/spdx/tools-golang v0.5.5 // indirect
|
||||
github.com/spf13/afero v1.14.0 // indirect
|
||||
github.com/spf13/cast v1.9.2 // indirect
|
||||
github.com/spf13/cobra v1.9.1 // indirect
|
||||
github.com/spf13/pflag v1.0.7 // indirect
|
||||
github.com/spiffe/go-spiffe/v2 v2.5.0 // indirect
|
||||
github.com/spf13/afero v1.15.0 // indirect
|
||||
github.com/spf13/cast v1.10.0 // indirect
|
||||
github.com/spf13/cobra v1.10.2 // indirect
|
||||
github.com/spf13/pflag v1.0.10 // indirect
|
||||
github.com/spiffe/go-spiffe/v2 v2.6.0 // indirect
|
||||
github.com/stripe/stripe-go/v74 v74.30.0 // indirect
|
||||
github.com/subosito/gotenv v1.6.0 // indirect
|
||||
github.com/sylabs/sif/v2 v2.22.0 // indirect
|
||||
github.com/sylabs/squashfs v1.0.6 // indirect
|
||||
github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d // indirect
|
||||
github.com/tchap/go-patricia/v2 v2.3.2 // indirect
|
||||
github.com/tchap/go-patricia/v2 v2.3.3 // indirect
|
||||
github.com/thales-e-security/pool v0.0.2 // indirect
|
||||
github.com/therootcompany/xz v1.0.1 // indirect
|
||||
github.com/theupdateframework/go-tuf v0.7.0 // indirect
|
||||
github.com/theupdateframework/go-tuf/v2 v2.3.1 // indirect
|
||||
github.com/titanous/rocacheck v0.0.0-20171023193734-afe73141d399 // indirect
|
||||
github.com/tjfoc/gmsm v1.4.1 // indirect
|
||||
github.com/tonistiigi/dchapes-mode v0.0.0-20250318174251-73d941a28323 // indirect
|
||||
github.com/tonistiigi/fsutil v0.0.0-20250410151801-5b74a7ad7583 // indirect
|
||||
github.com/tonistiigi/go-csvvalue v0.0.0-20240710180619-ddb21b71c0b4 // indirect
|
||||
github.com/tonistiigi/fsutil v0.0.0-20250605211040-586307ad452f // indirect
|
||||
github.com/tonistiigi/go-csvvalue v0.0.0-20240814133006-030d3b2625d0 // indirect
|
||||
github.com/tonistiigi/units v0.0.0-20180711220420-6950e57a87ea // indirect
|
||||
github.com/tonistiigi/vt100 v0.0.0-20240514184818-90bafcd6abab // indirect
|
||||
github.com/transparency-dev/formats v0.0.0-20251017110053-404c0d5b696c // indirect
|
||||
github.com/transparency-dev/merkle v0.0.2 // indirect
|
||||
github.com/ulikunitz/xz v0.5.15 // indirect
|
||||
github.com/uptrace/opentelemetry-go-extra/otelutil v0.3.2 // indirect
|
||||
github.com/uptrace/opentelemetry-go-extra/otelzap v0.3.2 // indirect
|
||||
github.com/uptrace/uptrace-go v1.37.0 // indirect
|
||||
github.com/valyala/fastjson v1.6.4 // indirect
|
||||
github.com/vbatts/go-mtree v0.5.4 // indirect
|
||||
github.com/vbatts/tar-split v0.12.1 // indirect
|
||||
github.com/vbatts/tar-split v0.12.2 // indirect
|
||||
github.com/vektah/gqlparser/v2 v2.5.31 // indirect
|
||||
github.com/vifraa/gopom v1.0.0 // indirect
|
||||
github.com/vishvananda/netlink v1.3.1-0.20241022031324-976bd8de7d81 // indirect
|
||||
github.com/vishvananda/netlink v1.3.1 // indirect
|
||||
github.com/vishvananda/netns v0.0.5 // indirect
|
||||
github.com/wagoodman/go-partybus v0.0.0-20230516145632-8ccac152c651 // indirect
|
||||
github.com/wagoodman/go-progress v0.0.0-20230925121702-07e42b3cdba0 // indirect
|
||||
github.com/x448/float16 v0.8.4 // indirect
|
||||
github.com/xanzy/go-gitlab v0.102.0 // indirect
|
||||
github.com/xanzy/ssh-agent v0.3.3 // indirect
|
||||
github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb // indirect
|
||||
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect
|
||||
@@ -504,81 +529,78 @@ require (
|
||||
github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e // indirect
|
||||
github.com/yashtewari/glob-intersection v0.2.0 // indirect
|
||||
github.com/yl2chen/cidranger v1.0.2 // indirect
|
||||
github.com/zclconf/go-cty v1.16.3 // indirect
|
||||
github.com/zeebo/errs v1.4.0 // indirect
|
||||
go.etcd.io/bbolt v1.4.2 // indirect
|
||||
go.mongodb.org/mongo-driver v1.17.1 // indirect
|
||||
github.com/zclconf/go-cty v1.17.0 // indirect
|
||||
gitlab.com/gitlab-org/api/client-go v1.11.0 // indirect
|
||||
go.etcd.io/bbolt v1.4.3 // indirect
|
||||
go.mongodb.org/mongo-driver v1.17.6 // indirect
|
||||
go.opencensus.io v0.24.0 // indirect
|
||||
go.opentelemetry.io/auto/sdk v1.1.0 // indirect
|
||||
go.opentelemetry.io/contrib/detectors/gcp v1.37.0 // indirect
|
||||
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.62.0 // indirect
|
||||
go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace v0.56.0 // indirect
|
||||
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.62.0 // indirect
|
||||
go.opentelemetry.io/auto/sdk v1.2.1 // indirect
|
||||
go.opentelemetry.io/contrib/detectors/gcp v1.38.0 // indirect
|
||||
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.63.0 // indirect
|
||||
go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace v0.61.0 // indirect
|
||||
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.63.0 // indirect
|
||||
go.opentelemetry.io/contrib/instrumentation/runtime v0.62.0 // indirect
|
||||
go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp v0.13.0 // indirect
|
||||
go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.32.0 // indirect
|
||||
go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp v1.37.0 // indirect
|
||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.37.0 // indirect
|
||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.35.0 // indirect
|
||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.37.0 // indirect
|
||||
go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.38.0 // indirect
|
||||
go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp v1.38.0 // indirect
|
||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.39.0 // indirect
|
||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.39.0 // indirect
|
||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.39.0 // indirect
|
||||
go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.37.0 // indirect
|
||||
go.opentelemetry.io/otel/log v0.13.0 // indirect
|
||||
go.opentelemetry.io/otel/metric v1.37.0 // indirect
|
||||
go.opentelemetry.io/otel/sdk v1.37.0 // indirect
|
||||
go.opentelemetry.io/otel/metric v1.39.0 // indirect
|
||||
go.opentelemetry.io/otel/sdk v1.39.0 // indirect
|
||||
go.opentelemetry.io/otel/sdk/log v0.13.0 // indirect
|
||||
go.opentelemetry.io/otel/sdk/metric v1.37.0 // indirect
|
||||
go.opentelemetry.io/proto/otlp v1.7.0 // indirect
|
||||
go.step.sm/crypto v0.60.0 // indirect
|
||||
go.uber.org/mock v0.5.0 // indirect
|
||||
go.yaml.in/yaml/v2 v2.4.2 // indirect
|
||||
go.opentelemetry.io/otel/sdk/metric v1.39.0 // indirect
|
||||
go.opentelemetry.io/proto/otlp v1.9.0 // indirect
|
||||
go.uber.org/mock v0.6.0 // indirect
|
||||
go.yaml.in/yaml/v2 v2.4.3 // indirect
|
||||
go.yaml.in/yaml/v3 v3.0.4 // indirect
|
||||
go4.org v0.0.0-20230225012048-214862532bf5 // indirect
|
||||
go4.org/netipx v0.0.0-20231129151722-fdeea329fbba // indirect
|
||||
golang.org/x/image v0.24.0 // indirect
|
||||
golang.org/x/sync v0.16.0 // indirect
|
||||
golang.org/x/sys v0.35.0 // indirect
|
||||
golang.org/x/term v0.34.0 // indirect
|
||||
golang.org/x/text v0.28.0 // indirect
|
||||
golang.org/x/time v0.12.0 // indirect
|
||||
golang.org/x/tools v0.36.0 // indirect
|
||||
golang.org/x/image v0.25.0 // indirect
|
||||
golang.org/x/sync v0.19.0 // indirect
|
||||
golang.org/x/sys v0.39.0 // indirect
|
||||
golang.org/x/term v0.38.0 // indirect
|
||||
golang.org/x/text v0.32.0 // indirect
|
||||
golang.org/x/time v0.14.0 // indirect
|
||||
golang.org/x/tools v0.40.0 // indirect
|
||||
golang.org/x/xerrors v0.0.0-20240903120638-7835f813f4da // indirect
|
||||
gonum.org/v1/gonum v0.12.0 // indirect
|
||||
google.golang.org/api v0.242.0 // indirect
|
||||
google.golang.org/genproto/googleapis/api v0.0.0-20250715232539-7130f93afb79 // indirect
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20250715232539-7130f93afb79 // indirect
|
||||
google.golang.org/protobuf v1.36.6 // indirect
|
||||
gopkg.in/evanphx/json-patch.v4 v4.12.0 // indirect
|
||||
gonum.org/v1/gonum v0.16.0 // indirect
|
||||
google.golang.org/api v0.260.0 // indirect
|
||||
google.golang.org/genproto/googleapis/api v0.0.0-20251222181119-0a764e51fe1b // indirect
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20251222181119-0a764e51fe1b // indirect
|
||||
google.golang.org/protobuf v1.36.11 // indirect
|
||||
gopkg.in/evanphx/json-patch.v4 v4.13.0 // indirect
|
||||
gopkg.in/inf.v0 v0.9.1 // indirect
|
||||
gopkg.in/ini.v1 v1.67.0 // indirect
|
||||
gopkg.in/ini.v1 v1.67.1 // indirect
|
||||
gopkg.in/op/go-logging.v1 v1.0.0-20160211212156-b2cb9fa56473 // indirect
|
||||
gopkg.in/warnings.v0 v0.1.2 // indirect
|
||||
gopkg.in/yaml.v2 v2.4.0 // indirect
|
||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||
gorm.io/gorm v1.30.2 // indirect
|
||||
helm.sh/helm/v3 v3.18.5 // indirect
|
||||
k8s.io/api v0.33.3 // indirect
|
||||
k8s.io/api v0.35.0 // indirect
|
||||
k8s.io/apiextensions-apiserver v0.33.3 // indirect
|
||||
k8s.io/apiserver v0.33.3 // indirect
|
||||
k8s.io/cli-runtime v0.33.3 // indirect
|
||||
k8s.io/component-base v0.33.3 // indirect
|
||||
k8s.io/klog/v2 v2.130.1 // indirect
|
||||
k8s.io/kube-openapi v0.0.0-20250318190949-c8a335a9a2ff // indirect
|
||||
k8s.io/kube-openapi v0.0.0-20250910181357-589584f1c912 // indirect
|
||||
k8s.io/kubectl v0.33.3 // indirect
|
||||
modernc.org/libc v1.66.3 // indirect
|
||||
modernc.org/libc v1.66.10 // indirect
|
||||
modernc.org/mathutil v1.7.1 // indirect
|
||||
modernc.org/memory v1.11.0 // indirect
|
||||
modernc.org/sqlite v1.38.2 // indirect
|
||||
modernc.org/sqlite v1.40.1 // indirect
|
||||
oras.land/oras-go/v2 v2.6.0 // indirect
|
||||
sigs.k8s.io/controller-runtime v0.18.4 // indirect
|
||||
sigs.k8s.io/json v0.0.0-20241014173422-cfa47c3a1cc8 // indirect
|
||||
sigs.k8s.io/json v0.0.0-20250730193827-2d320260d730 // indirect
|
||||
sigs.k8s.io/kustomize/api v0.19.0 // indirect
|
||||
sigs.k8s.io/kustomize/kyaml v0.19.0 // indirect
|
||||
sigs.k8s.io/randfill v1.0.0 // indirect
|
||||
sigs.k8s.io/release-utils v0.9.0 // indirect
|
||||
sigs.k8s.io/structured-merge-diff/v4 v4.6.0 // indirect
|
||||
sigs.k8s.io/yaml v1.5.0 // indirect
|
||||
sigs.k8s.io/release-utils v0.12.3 // indirect
|
||||
sigs.k8s.io/structured-merge-diff/v6 v6.3.0 // indirect
|
||||
sigs.k8s.io/yaml v1.6.0 // indirect
|
||||
)
|
||||
|
||||
replace github.com/docker/distribution v2.8.3+incompatible => github.com/docker/distribution v2.8.2+incompatible
|
||||
|
||||
replace github.com/docker/docker v27.1.1+incompatible => github.com/docker/docker v26.1.5+incompatible
|
||||
replace github.com/docker/cli => github.com/docker/cli v28.5.1+incompatible
|
||||
|
||||
1036
httphandler/go.sum
1036
httphandler/go.sum
File diff suppressed because it is too large
Load Diff
@@ -6,18 +6,31 @@ import (
|
||||
"net/http"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
"github.com/google/uuid"
|
||||
"github.com/gorilla/schema"
|
||||
"github.com/kubescape/go-logger"
|
||||
"github.com/kubescape/go-logger/helpers"
|
||||
"github.com/kubescape/kubescape/v3/core/cautils"
|
||||
"github.com/kubescape/kubescape/v3/core/cautils/getter"
|
||||
apisv1 "github.com/kubescape/opa-utils/httpserver/apis/v1"
|
||||
utilsapisv1 "github.com/kubescape/opa-utils/httpserver/apis/v1"
|
||||
utilsmetav1 "github.com/kubescape/opa-utils/httpserver/meta/v1"
|
||||
"go.opentelemetry.io/otel/trace"
|
||||
)
|
||||
|
||||
// MetricsQueryParams query params for metrics endpoint
|
||||
type MetricsQueryParams struct {
|
||||
// Frameworks is a comma-separated list of frameworks to scan
|
||||
// Example: "nsa,mitre,cis-v1.10.0"
|
||||
// If not provided, all available frameworks will be scanned
|
||||
Frameworks string `schema:"frameworks" json:"frameworks"`
|
||||
|
||||
// Do not persist data after scanning
|
||||
// default: false
|
||||
SkipPersistence bool `schema:"skipPersistence" json:"skipPersistence"`
|
||||
}
|
||||
|
||||
// Metrics http listener for prometheus support
|
||||
func (handler *HTTPHandler) Metrics(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
@@ -25,13 +38,22 @@ func (handler *HTTPHandler) Metrics(w http.ResponseWriter, r *http.Request) {
|
||||
handler.state.setBusy(scanID)
|
||||
defer handler.state.setNotBusy(scanID)
|
||||
|
||||
metricsQueryParams := &MetricsQueryParams{}
|
||||
if err := schema.NewDecoder().Decode(metricsQueryParams, r.URL.Query()); err != nil {
|
||||
w.WriteHeader(http.StatusBadRequest)
|
||||
handler.writeError(w, fmt.Errorf("failed to parse query params, reason: %s", err.Error()), scanID)
|
||||
return
|
||||
}
|
||||
skipPersistence := r.URL.Query().Get("skipPersistence") == "true"
|
||||
|
||||
resultsFile := filepath.Join(OutputDir, scanID)
|
||||
scanInfo := getPrometheusDefaultScanCommand(scanID, resultsFile)
|
||||
scanInfo := getPrometheusDefaultScanCommand(scanID, resultsFile, metricsQueryParams.Frameworks)
|
||||
|
||||
scanParams := &scanRequestParams{
|
||||
scanQueryParams: &ScanQueryParams{
|
||||
ReturnResults: true,
|
||||
KeepResults: false,
|
||||
ReturnResults: true,
|
||||
KeepResults: false,
|
||||
SkipPersistence: skipPersistence,
|
||||
},
|
||||
scanInfo: scanInfo,
|
||||
scanID: scanID,
|
||||
@@ -69,19 +91,41 @@ func (handler *HTTPHandler) Metrics(w http.ResponseWriter, r *http.Request) {
|
||||
w.Write(f)
|
||||
}
|
||||
|
||||
func getPrometheusDefaultScanCommand(scanID, resultsFile string) *cautils.ScanInfo {
|
||||
func getPrometheusDefaultScanCommand(scanID, resultsFile, frameworksParam string) *cautils.ScanInfo {
|
||||
scanInfo := defaultScanInfo()
|
||||
scanInfo.UseArtifactsFrom = getter.DefaultLocalStore // Load files from cache (this will prevent kubescape fom downloading the artifacts every time)
|
||||
scanInfo.UseArtifactsFrom = getter.DefaultLocalStore // Load files from cache (this will prevent kubescape from downloading the artifacts every time)
|
||||
scanInfo.Submit = false // do not submit results every scan
|
||||
scanInfo.Local = true // do not submit results every scan
|
||||
scanInfo.FrameworkScan = true
|
||||
scanInfo.HostSensorEnabled.SetBool(false) // disable host scanner
|
||||
scanInfo.ScanAll = false // do not scan all frameworks
|
||||
scanInfo.ScanID = scanID // scan ID
|
||||
scanInfo.FailThreshold = 100 // Do not fail scanning
|
||||
scanInfo.ComplianceThreshold = 0 // Do not fail scanning
|
||||
scanInfo.Output = resultsFile // results output
|
||||
scanInfo.Format = envToString("KS_FORMAT", "prometheus") // default output should be json
|
||||
scanInfo.SetPolicyIdentifiers(getter.NativeFrameworks, apisv1.KindFramework)
|
||||
scanInfo.Format = envToString("KS_FORMAT", "prometheus") // default output format is prometheus
|
||||
|
||||
// Check if specific frameworks are requested via query parameter
|
||||
if frameworksParam != "" {
|
||||
// Scan specific frameworks (comma-separated list)
|
||||
frameworks := splitAndTrim(frameworksParam, ",")
|
||||
scanInfo.SetPolicyIdentifiers(frameworks, utilsapisv1.KindFramework)
|
||||
} else {
|
||||
// Default: scan all available frameworks (including CIS)
|
||||
scanInfo.ScanAll = true
|
||||
// Framework identifiers will be set dynamically by the scan process when ScanAll is true
|
||||
}
|
||||
|
||||
return scanInfo
|
||||
}
|
||||
|
||||
// splitAndTrim splits a string by delimiter and trims whitespace from each element
|
||||
func splitAndTrim(s, sep string) []string {
|
||||
parts := strings.Split(s, sep)
|
||||
result := make([]string, 0, len(parts))
|
||||
for _, part := range parts {
|
||||
if trimmed := strings.TrimSpace(part); trimmed != "" {
|
||||
result = append(result, trimmed)
|
||||
}
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
@@ -9,17 +9,88 @@ import (
|
||||
)
|
||||
|
||||
func TestGetPrometheusDefaultScanCommand(t *testing.T) {
|
||||
scanID := "1234"
|
||||
outputFile := filepath.Join(OutputDir, scanID)
|
||||
scanInfo := getPrometheusDefaultScanCommand(scanID, outputFile)
|
||||
t.Run("default behavior - scan all frameworks", func(t *testing.T) {
|
||||
scanID := "1234"
|
||||
outputFile := filepath.Join(OutputDir, scanID)
|
||||
scanInfo := getPrometheusDefaultScanCommand(scanID, outputFile, "")
|
||||
|
||||
assert.Equal(t, scanID, scanInfo.ScanID)
|
||||
assert.Equal(t, outputFile, scanInfo.Output)
|
||||
assert.Equal(t, "prometheus", scanInfo.Format)
|
||||
assert.False(t, scanInfo.Submit)
|
||||
assert.True(t, scanInfo.Local)
|
||||
assert.True(t, scanInfo.FrameworkScan)
|
||||
assert.False(t, scanInfo.ScanAll)
|
||||
assert.False(t, scanInfo.HostSensorEnabled.GetBool())
|
||||
assert.Equal(t, getter.DefaultLocalStore, scanInfo.UseArtifactsFrom)
|
||||
assert.Equal(t, scanID, scanInfo.ScanID)
|
||||
assert.Equal(t, outputFile, scanInfo.Output)
|
||||
assert.Equal(t, "prometheus", scanInfo.Format)
|
||||
assert.False(t, scanInfo.Submit)
|
||||
assert.True(t, scanInfo.Local)
|
||||
assert.True(t, scanInfo.FrameworkScan)
|
||||
assert.True(t, scanInfo.ScanAll) // Scan all available frameworks by default
|
||||
assert.False(t, scanInfo.HostSensorEnabled.GetBool())
|
||||
assert.Equal(t, getter.DefaultLocalStore, scanInfo.UseArtifactsFrom)
|
||||
})
|
||||
|
||||
t.Run("specific frameworks via query parameter", func(t *testing.T) {
|
||||
scanID := "5678"
|
||||
outputFile := filepath.Join(OutputDir, scanID)
|
||||
scanInfo := getPrometheusDefaultScanCommand(scanID, outputFile, "nsa,mitre,cis-v1.10.0")
|
||||
|
||||
assert.Equal(t, scanID, scanInfo.ScanID)
|
||||
assert.Equal(t, outputFile, scanInfo.Output)
|
||||
assert.Equal(t, "prometheus", scanInfo.Format)
|
||||
assert.False(t, scanInfo.Submit)
|
||||
assert.True(t, scanInfo.Local)
|
||||
assert.True(t, scanInfo.FrameworkScan)
|
||||
assert.False(t, scanInfo.ScanAll) // Don't scan all when specific frameworks are set
|
||||
assert.False(t, scanInfo.HostSensorEnabled.GetBool())
|
||||
assert.Equal(t, getter.DefaultLocalStore, scanInfo.UseArtifactsFrom)
|
||||
|
||||
// Verify specific frameworks are set
|
||||
assert.Len(t, scanInfo.PolicyIdentifier, 3)
|
||||
assert.Equal(t, "nsa", scanInfo.PolicyIdentifier[0].Identifier)
|
||||
assert.Equal(t, "mitre", scanInfo.PolicyIdentifier[1].Identifier)
|
||||
assert.Equal(t, "cis-v1.10.0", scanInfo.PolicyIdentifier[2].Identifier)
|
||||
})
|
||||
}
|
||||
|
||||
func TestSplitAndTrim(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
input string
|
||||
sep string
|
||||
expected []string
|
||||
}{
|
||||
{
|
||||
name: "comma-separated with spaces",
|
||||
input: "nsa, mitre, cis-v1.10.0",
|
||||
sep: ",",
|
||||
expected: []string{"nsa", "mitre", "cis-v1.10.0"},
|
||||
},
|
||||
{
|
||||
name: "no spaces",
|
||||
input: "nsa,mitre,cis-v1.10.0",
|
||||
sep: ",",
|
||||
expected: []string{"nsa", "mitre", "cis-v1.10.0"},
|
||||
},
|
||||
{
|
||||
name: "single item",
|
||||
input: "nsa",
|
||||
sep: ",",
|
||||
expected: []string{"nsa"},
|
||||
},
|
||||
{
|
||||
name: "empty string",
|
||||
input: "",
|
||||
sep: ",",
|
||||
expected: []string{},
|
||||
},
|
||||
{
|
||||
name: "whitespace only",
|
||||
input: " , , ",
|
||||
sep: ",",
|
||||
expected: []string{},
|
||||
},
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
result := splitAndTrim(tt.input, tt.sep)
|
||||
assert.Equal(t, tt.expected, result)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,6 +21,9 @@ type ScanQueryParams struct {
|
||||
// Do not delete results after returning (relevant only for synchronous requests)
|
||||
// default: false
|
||||
KeepResults bool `schema:"keep" json:"keep"`
|
||||
// Do not persist data after scanning
|
||||
//default: false
|
||||
SkipPersistence bool `schema:"skipPersistence" json:"skipPersistence"`
|
||||
}
|
||||
|
||||
// swagger:parameters getScanResults
|
||||
|
||||
@@ -22,7 +22,7 @@ func testBody(t *testing.T) io.Reader {
|
||||
return bytes.NewReader(b)
|
||||
}
|
||||
|
||||
type scanner func(_ context.Context, _ *cautils.ScanInfo, _ string) (*reporthandlingv2.PostureReport, error)
|
||||
type scanner func(_ context.Context, _ *cautils.ScanInfo, _ string, _ bool) (*reporthandlingv2.PostureReport, error)
|
||||
|
||||
// TestScan tests that the scan handler passes the scan requests correctly to the underlying scan engine.
|
||||
func TestScan(t *testing.T) {
|
||||
@@ -30,7 +30,7 @@ func TestScan(t *testing.T) {
|
||||
// Our scanner is not setting up the k8s connection; the test is covering the rest of the wiring
|
||||
// that the signaling from the http handler goes all the way to the scanner implementation.
|
||||
defer func(o scanner) { scanImpl = o }(scanImpl)
|
||||
scanImpl = func(context.Context, *cautils.ScanInfo, string) (*reporthandlingv2.PostureReport, error) {
|
||||
scanImpl = func(context.Context, *cautils.ScanInfo, string, bool) (*reporthandlingv2.PostureReport, error) {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ func (handler *HTTPHandler) executeScan(scanReq *scanRequestParams) {
|
||||
response := &utilsmetav1.Response{}
|
||||
|
||||
logger.L().Info("scan triggered", helpers.String("ID", scanReq.scanID))
|
||||
_, err := scanImpl(scanReq.ctx, scanReq.scanInfo, scanReq.scanID)
|
||||
_, err := scanImpl(scanReq.ctx, scanReq.scanInfo, scanReq.scanID, scanReq.scanQueryParams.SkipPersistence)
|
||||
if err != nil {
|
||||
logger.L().Ctx(scanReq.ctx).Error("scanning failed", helpers.String("ID", scanReq.scanID), helpers.Error(err))
|
||||
if scanReq.scanQueryParams.ReturnResults {
|
||||
@@ -62,7 +62,7 @@ func (handler *HTTPHandler) watchForScan() {
|
||||
handler.executeScan(scanReq)
|
||||
}
|
||||
}
|
||||
func scan(ctx context.Context, scanInfo *cautils.ScanInfo, scanID string) (*reporthandlingv2.PostureReport, error) {
|
||||
func scan(ctx context.Context, scanInfo *cautils.ScanInfo, scanID string, skipPersistence bool) (*reporthandlingv2.PostureReport, error) {
|
||||
ctx, spanScan := otel.Tracer("").Start(ctx, "kubescape.scan")
|
||||
defer spanScan.End()
|
||||
|
||||
@@ -86,15 +86,21 @@ func scan(ctx context.Context, scanInfo *cautils.ScanInfo, scanID string) (*repo
|
||||
if err := result.HandleResults(ctx, scanInfo); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
storage := storage.GetStorage()
|
||||
if storage != nil {
|
||||
pr := result.GetResults()
|
||||
|
||||
if err := storage.StorePostureReportResults(ctx, pr); err != nil {
|
||||
return nil, err
|
||||
if !skipPersistence {
|
||||
store := storage.GetStorage()
|
||||
// do not store results locally when we are sending them
|
||||
if store != nil && config.GetAccount() == "" {
|
||||
pr := result.GetResults()
|
||||
|
||||
if err := store.StorePostureReportResults(ctx, pr); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
} else {
|
||||
logger.L().Debug("storage is not initialized - skipping storing results")
|
||||
}
|
||||
} else {
|
||||
logger.L().Debug("storage is not initialized - skipping storing results")
|
||||
logger.L().Info("skipPersistence=true, skipping storing results")
|
||||
}
|
||||
|
||||
return nil, nil
|
||||
|
||||
@@ -61,10 +61,6 @@ func main() {
|
||||
}
|
||||
|
||||
func initializeStorage(clusterName string, cfg config.Config) {
|
||||
if !cfg.ContinuousPostureScan {
|
||||
logger.L().Debug("continuous posture scan - skipping storage initialization")
|
||||
return
|
||||
}
|
||||
namespace := getNamespace(cfg)
|
||||
logger.L().Debug("initializing storage", helpers.String("namespace", namespace))
|
||||
|
||||
@@ -74,7 +70,7 @@ func initializeStorage(clusterName string, cfg config.Config) {
|
||||
logger.L().Fatal("storage initialization error", helpers.Error(err))
|
||||
}
|
||||
|
||||
s, err := storage.NewAPIServerStorage(clusterName, namespace, ksClient)
|
||||
s, err := storage.NewAPIServerStorage(clusterName, namespace, ksClient, cfg.ContinuousPostureScan)
|
||||
if err != nil {
|
||||
logger.L().Fatal("storage initialization error", helpers.Error(err))
|
||||
}
|
||||
|
||||
@@ -30,15 +30,17 @@ var storageInstance *APIServerStore
|
||||
|
||||
type PostureRepository interface {
|
||||
GetWorkloadConfigurationScanResult(ctx context.Context, name, namespace string) (*v1beta1.WorkloadConfigurationScan, error)
|
||||
StoreWorkloadConfigurationScanResult(ctx context.Context, report *v2.PostureReport, result *resourcesresults.Result) (*v1beta1.WorkloadConfigurationScan, error)
|
||||
BuildWorkloadConfigurationScan(ctx context.Context, report *v2.PostureReport, result *resourcesresults.Result) (*v1beta1.WorkloadConfigurationScan, error)
|
||||
StoreWorkloadConfigurationScanResult(ctx context.Context, manifest *v1beta1.WorkloadConfigurationScan) error
|
||||
StoreWorkloadConfigurationScanResultSummary(ctx context.Context, workloadScan *v1beta1.WorkloadConfigurationScan) (*v1beta1.WorkloadConfigurationScanSummary, error)
|
||||
}
|
||||
|
||||
// APIServerStore implements both PostureRepository with in-cluster storage (apiserver) to be used for production
|
||||
type APIServerStore struct {
|
||||
StorageClient spdxv1beta1.SpdxV1beta1Interface
|
||||
clusterName string
|
||||
namespace string
|
||||
StorageClient spdxv1beta1.SpdxV1beta1Interface
|
||||
clusterName string
|
||||
namespace string
|
||||
continuousPostureScan bool
|
||||
}
|
||||
|
||||
var _ PostureRepository = (*APIServerStore)(nil)
|
||||
@@ -52,22 +54,31 @@ func GetStorage() *APIServerStore {
|
||||
}
|
||||
|
||||
// NewAPIServerStorage initializes the APIServerStore struct
|
||||
func NewAPIServerStorage(clusterName string, namespace string, ksClient spdxv1beta1.SpdxV1beta1Interface) (*APIServerStore, error) {
|
||||
func NewAPIServerStorage(clusterName string, namespace string, ksClient spdxv1beta1.SpdxV1beta1Interface, continuousPostureScan bool) (*APIServerStore, error) {
|
||||
return &APIServerStore{
|
||||
StorageClient: ksClient,
|
||||
clusterName: clusterName,
|
||||
namespace: namespace,
|
||||
StorageClient: ksClient,
|
||||
clusterName: clusterName,
|
||||
namespace: namespace,
|
||||
continuousPostureScan: continuousPostureScan,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (a *APIServerStore) StorePostureReportResults(ctx context.Context, pr *v2.PostureReport) error {
|
||||
for i := range pr.Results {
|
||||
detailedObj, err := a.StoreWorkloadConfigurationScanResult(ctx, pr, &pr.Results[i])
|
||||
workloadScan, err := a.BuildWorkloadConfigurationScan(ctx, pr, &pr.Results[i])
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if _, err := a.StoreWorkloadConfigurationScanResultSummary(ctx, detailedObj); err != nil {
|
||||
// Only store full WorkloadConfigurationScan when continuousPostureScan is enabled
|
||||
if a.continuousPostureScan {
|
||||
if err := a.StoreWorkloadConfigurationScanResult(ctx, workloadScan); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
// Always store summaries for headlamp plugin
|
||||
if _, err := a.StoreWorkloadConfigurationScanResultSummary(ctx, workloadScan); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -135,7 +146,8 @@ func (a *APIServerStore) getResourceNamespace(resource workloadinterface.IMetada
|
||||
return resource.GetNamespace()
|
||||
}
|
||||
|
||||
func (a *APIServerStore) StoreWorkloadConfigurationScanResult(ctx context.Context, report *v2.PostureReport, result *resourcesresults.Result) (*v1beta1.WorkloadConfigurationScan, error) {
|
||||
// BuildWorkloadConfigurationScan builds a WorkloadConfigurationScan manifest without storing it
|
||||
func (a *APIServerStore) BuildWorkloadConfigurationScan(ctx context.Context, report *v2.PostureReport, result *resourcesresults.Result) (*v1beta1.WorkloadConfigurationScan, error) {
|
||||
resource, err := findResourceInReport(result.ResourceID, report)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -166,7 +178,13 @@ func (a *APIServerStore) StoreWorkloadConfigurationScanResult(ctx context.Contex
|
||||
},
|
||||
}
|
||||
|
||||
_, err = a.StorageClient.WorkloadConfigurationScans(namespace).Create(context.Background(), &manifest, metav1.CreateOptions{})
|
||||
return &manifest, nil
|
||||
}
|
||||
|
||||
// StoreWorkloadConfigurationScanResult stores a WorkloadConfigurationScan manifest
|
||||
func (a *APIServerStore) StoreWorkloadConfigurationScanResult(ctx context.Context, manifest *v1beta1.WorkloadConfigurationScan) error {
|
||||
namespace := manifest.GetNamespace()
|
||||
_, err := a.StorageClient.WorkloadConfigurationScans(namespace).Create(context.Background(), manifest, metav1.CreateOptions{})
|
||||
switch {
|
||||
case errors.IsAlreadyExists(err):
|
||||
retryErr := retry.RetryOnConflict(retry.DefaultRetry, func() error {
|
||||
@@ -192,11 +210,11 @@ func (a *APIServerStore) StoreWorkloadConfigurationScanResult(ctx context.Contex
|
||||
}
|
||||
case err != nil:
|
||||
logger.L().Ctx(ctx).Warning("failed to store WorkloadConfigurationScan manifest in storage", helpers.Error(err), helpers.String("name", manifest.Name))
|
||||
return nil, err
|
||||
return err
|
||||
default:
|
||||
logger.L().Debug("stored WorkloadConfigurationScan manifest in storage", helpers.String("name", manifest.Name))
|
||||
}
|
||||
return &manifest, nil
|
||||
return nil
|
||||
}
|
||||
|
||||
func mergeWorkloadConfigurationScanSpec(existingSpec v1beta1.WorkloadConfigurationScanSpec, newSpec v1beta1.WorkloadConfigurationScanSpec) v1beta1.WorkloadConfigurationScanSpec {
|
||||
|
||||
105
install.ps1
105
install.ps1
@@ -1,39 +1,96 @@
|
||||
Write-Host "Installing Kubescape..." -ForegroundColor Cyan
|
||||
|
||||
$BASE_DIR=$env:USERPROFILE + "\.kubescape"
|
||||
$packageName = "/kubescape.exe"
|
||||
$BASE_DIR = "$env:USERPROFILE\.kubescape"
|
||||
$KUBESCAPE_EXEC = "kubescape.exe"
|
||||
|
||||
# Get latest release url
|
||||
$config = Invoke-WebRequest -UseBasicParsing "https://api.github.com/repos/kubescape/kubescape/releases/latest" | ConvertFrom-Json
|
||||
$url = $config.html_url.Replace("/tag/","/download/")
|
||||
$fullUrl = $url + $packageName
|
||||
# Determine architecture
|
||||
$arch = if ([Environment]::Is64BitOperatingSystem) {
|
||||
if ($env:PROCESSOR_ARCHITECTURE -eq "ARM64") { "arm64" } else { "amd64" }
|
||||
} else {
|
||||
Write-Host "Error: 32-bit systems are not supported" -ForegroundColor Red
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Create a new directory if needed
|
||||
New-Item -Path $BASE_DIR -ItemType "directory" -ErrorAction SilentlyContinue
|
||||
# Get latest release version from GitHub API
|
||||
function Get-LatestVersion {
|
||||
try {
|
||||
$release = Invoke-RestMethod -Uri "https://api.github.com/repos/kubescape/kubescape/releases/latest" -UseBasicParsing
|
||||
return $release.tag_name
|
||||
} catch {
|
||||
Write-Host "Error: Failed to fetch latest release version" -ForegroundColor Red
|
||||
exit 1
|
||||
}
|
||||
}
|
||||
|
||||
# Parse command line arguments for version
|
||||
$version = $null
|
||||
for ($i = 0; $i -lt $args.Count; $i++) {
|
||||
if ($args[$i] -eq "-v" -and $i + 1 -lt $args.Count) {
|
||||
$version = $args[$i + 1]
|
||||
}
|
||||
}
|
||||
|
||||
# Get version (use provided or fetch latest)
|
||||
if (-not $version) {
|
||||
$version = Get-LatestVersion
|
||||
Write-Host "Latest version: $version" -ForegroundColor Cyan
|
||||
}
|
||||
|
||||
# Remove 'v' prefix if present for the filename
|
||||
$versionNum = $version -replace '^v', ''
|
||||
|
||||
# Create installation directory if needed
|
||||
New-Item -Path $BASE_DIR -ItemType "directory" -ErrorAction SilentlyContinue | Out-Null
|
||||
|
||||
# Build download URL with new naming pattern: kubescape_{version}_windows_{arch}.exe
|
||||
$downloadUrl = "https://github.com/kubescape/kubescape/releases/download/$version/kubescape_${versionNum}_windows_${arch}.exe"
|
||||
|
||||
Write-Host "Downloading from: $downloadUrl" -ForegroundColor Cyan
|
||||
|
||||
$outputPath = Join-Path $BASE_DIR $KUBESCAPE_EXEC
|
||||
|
||||
# Download the binary
|
||||
$useBitTransfer = $null -ne (Get-Module -Name BitsTransfer -ListAvailable) -and ($PSVersionTable.PSVersion.Major -le 5)
|
||||
if ($useBitTransfer)
|
||||
{
|
||||
Write-Information -MessageData 'Using a fallback BitTransfer method since you are running Windows PowerShell'
|
||||
Start-BitsTransfer -Source $fullUrl -Destination $BASE_DIR\kubescape.exe
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
Invoke-WebRequest -Uri $fullUrl -OutFile $BASE_DIR\kubescape.exe
|
||||
try {
|
||||
$useBitTransfer = $null -ne (Get-Module -Name BitsTransfer -ListAvailable) -and ($PSVersionTable.PSVersion.Major -le 5)
|
||||
if ($useBitTransfer) {
|
||||
Write-Host "Using BitsTransfer for download..." -ForegroundColor Gray
|
||||
Start-BitsTransfer -Source $downloadUrl -Destination $outputPath
|
||||
} else {
|
||||
$ProgressPreference = 'SilentlyContinue' # Speeds up Invoke-WebRequest
|
||||
Invoke-WebRequest -Uri $downloadUrl -OutFile $outputPath -UseBasicParsing
|
||||
}
|
||||
} catch {
|
||||
Write-Host "Error: Failed to download kubescape" -ForegroundColor Red
|
||||
Write-Host $_.Exception.Message -ForegroundColor Red
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Verify download was successful
|
||||
if (-not (Test-Path $outputPath) -or (Get-Item $outputPath).Length -eq 0) {
|
||||
Write-Host "Error: Download failed or file is empty" -ForegroundColor Red
|
||||
Remove-Item $outputPath -ErrorAction SilentlyContinue
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Update user PATH if needed
|
||||
$currentPath = [Environment]::GetEnvironmentVariable("Path", "User")
|
||||
if (-not $currentPath.Contains($BASE_DIR)) {
|
||||
$confirmation = Read-Host "Add kubescape to user path? (y/n)"
|
||||
$confirmation = Read-Host "Add kubescape to user PATH? (y/n)"
|
||||
if ($confirmation -eq 'y') {
|
||||
$env:Path=[Environment]::GetEnvironmentVariable("Path", "User") + ";$BASE_DIR;"
|
||||
[Environment]::SetEnvironmentVariable("Path", "${env:Path}", "User")
|
||||
$newPath = $currentPath + ";$BASE_DIR"
|
||||
[Environment]::SetEnvironmentVariable("Path", $newPath, "User")
|
||||
$env:Path = $env:Path + ";$BASE_DIR"
|
||||
Write-Host "Added $BASE_DIR to PATH" -ForegroundColor Green
|
||||
}
|
||||
}
|
||||
|
||||
Write-Host "Finished Installation.`n" -ForegroundColor Green
|
||||
kubescape version
|
||||
Write-Host "`nUsage: $ kubescape scan" -ForegroundColor Magenta
|
||||
Write-Host "`nFinished Installation." -ForegroundColor Green
|
||||
|
||||
# Try to run version command
|
||||
try {
|
||||
& $outputPath version
|
||||
} catch {
|
||||
Write-Host "Installed to: $outputPath" -ForegroundColor Green
|
||||
}
|
||||
|
||||
Write-Host "`nUsage: kubescape scan" -ForegroundColor Magenta
|
||||
|
||||
58
install.sh
58
install.sh
@@ -8,22 +8,41 @@ KUBESCAPE_EXEC=kubescape
|
||||
determine_os_and_arch() {
|
||||
osName=$(uname -s)
|
||||
case $osName in
|
||||
*MINGW*) osName=windows ;;
|
||||
Darwin*) osName=macos ;;
|
||||
*) osName=ubuntu ;;
|
||||
Linux*) osName=linux ;;
|
||||
Darwin*) osName=darwin ;;
|
||||
*MINGW*|*CYGWIN*|*MSYS*)
|
||||
echo -e "\033[31mError: Windows is not supported by this script. Please use the PowerShell installer or download manually from:"
|
||||
echo -e "\033[1;35;40mhttps://github.com/kubescape/kubescape/releases"
|
||||
exit 1
|
||||
;;
|
||||
*)
|
||||
echo -e "\033[31mError: Unsupported operating system: $osName"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
arch=$(uname -m)
|
||||
case $arch in
|
||||
*aarch64*|*arm64*) arch="-arm64" ;;
|
||||
*x86_64*) arch="" ;;
|
||||
x86_64|amd64) arch="amd64" ;;
|
||||
aarch64|arm64) arch="arm64" ;;
|
||||
*)
|
||||
echo -e "\033[33mArchitecture $arch may be unsupported, will try to install the amd64 one anyway."
|
||||
arch=""
|
||||
echo -e "\033[31mError: Unsupported architecture: $arch"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
# Function to get the latest release version from GitHub API
|
||||
get_latest_version() {
|
||||
local latest_release
|
||||
latest_release=$(curl -s "https://api.github.com/repos/kubescape/kubescape/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/')
|
||||
if [ -z "$latest_release" ]; then
|
||||
echo -e "\033[31mError: Failed to fetch latest release version"
|
||||
exit 1
|
||||
fi
|
||||
echo "$latest_release"
|
||||
}
|
||||
|
||||
# Function to remove old installations
|
||||
remove_old_install() {
|
||||
local exec_path=$1
|
||||
@@ -33,26 +52,43 @@ remove_old_install() {
|
||||
}
|
||||
|
||||
# Parse command-line arguments
|
||||
VERSION=""
|
||||
while getopts v: option; do
|
||||
case ${option} in
|
||||
v) RELEASE="download/${OPTARG}";;
|
||||
v) VERSION="${OPTARG}";;
|
||||
*) ;;
|
||||
esac
|
||||
done
|
||||
|
||||
[ -z "${RELEASE}" ] && RELEASE="latest/download"
|
||||
|
||||
echo -e "\033[0;36mInstalling Kubescape..."
|
||||
|
||||
determine_os_and_arch
|
||||
|
||||
# Get version (use provided or fetch latest)
|
||||
if [ -z "${VERSION}" ]; then
|
||||
VERSION=$(get_latest_version)
|
||||
echo -e "\033[0;36mLatest version: $VERSION"
|
||||
fi
|
||||
|
||||
# Remove 'v' prefix if present for the filename
|
||||
VERSION_NUM="${VERSION#v}"
|
||||
|
||||
mkdir -p $BASE_DIR
|
||||
|
||||
OUTPUT=$BASE_DIR/$KUBESCAPE_EXEC
|
||||
DOWNLOAD_URL="https://github.com/kubescape/kubescape/releases/${RELEASE}/kubescape${arch}-${osName}-latest"
|
||||
# New URL pattern: kubescape_{version}_{os}_{arch}
|
||||
DOWNLOAD_URL="https://github.com/kubescape/kubescape/releases/download/${VERSION}/kubescape_${VERSION_NUM}_${osName}_${arch}"
|
||||
|
||||
echo -e "\033[0;36mDownloading from: $DOWNLOAD_URL"
|
||||
curl --progress-bar -L $DOWNLOAD_URL -o $OUTPUT
|
||||
|
||||
# Verify download was successful
|
||||
if [ ! -s "$OUTPUT" ]; then
|
||||
echo -e "\033[31mError: Download failed or file is empty"
|
||||
rm -f "$OUTPUT"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Determine install directory
|
||||
install_dir=/usr/local/bin
|
||||
[ "$(id -u)" -ne 0 ] && install_dir=$BASE_DIR/bin && export PATH=$PATH:$BASE_DIR/bin
|
||||
|
||||
@@ -19,7 +19,7 @@ def run_command(command, stdin=subprocess.PIPE, stderr=subprocess.STDOUT):
|
||||
|
||||
|
||||
def assertion(msg):
|
||||
errors = ["Error: invalid parameter", "exit status 1"]
|
||||
errors = ["Error: invalid parameter", "exit status"]
|
||||
for e in errors:
|
||||
assert e not in msg, msg
|
||||
|
||||
|
||||
@@ -16,12 +16,9 @@ def run(kubescape_exec:str):
|
||||
print("Testing supported commands")
|
||||
|
||||
test_command(command=[kubescape_exec, "version"])
|
||||
test_command(command=[kubescape_exec, "download"])
|
||||
test_command(command=[kubescape_exec, "download", "artifacts"])
|
||||
test_command(command=[kubescape_exec, "config"])
|
||||
test_command(command=[kubescape_exec, "help"])
|
||||
test_command(command=[kubescape_exec, "scan", "framework"])
|
||||
test_command(command=[kubescape_exec, "scan", "control"])
|
||||
test_command(command=[kubescape_exec, "submit", "results"])
|
||||
|
||||
print("Done testing commands")
|
||||
|
||||
|
||||
@@ -3,65 +3,66 @@ import smoke_utils
|
||||
import sys
|
||||
|
||||
|
||||
all_files = os.path.join("..", "*.yaml")
|
||||
# all_files = os.path.join("..", "examples", "online-boutique", "*.yaml")
|
||||
single_file = os.path.join("..", "examples", "online-boutique", "frontend.yaml")
|
||||
curr_dir = os.path.dirname(os.path.realpath(__file__))
|
||||
# examples/online-boutique/*.yaml is at ../examples/online-boutique/*.yaml relative to this script
|
||||
all_files = os.path.join(curr_dir, "..", "examples", "online-boutique", "*.yaml")
|
||||
single_file = os.path.join(curr_dir, "..", "examples", "online-boutique", "frontend.yaml")
|
||||
|
||||
|
||||
def scan_all(kubescape_exec: str):
|
||||
return smoke_utils.run_command(command=[kubescape_exec, "scan", all_files])
|
||||
return smoke_utils.run_command(command=[kubescape_exec, "scan", "--keep-local", all_files])
|
||||
|
||||
|
||||
def scan_control_name(kubescape_exec: str):
|
||||
return smoke_utils.run_command(command=[kubescape_exec, "scan", "control", 'HostPath mount', all_files])
|
||||
return smoke_utils.run_command(command=[kubescape_exec, "scan", "--keep-local", "control", 'HostPath mount', all_files])
|
||||
|
||||
|
||||
def scan_control_id(kubescape_exec: str):
|
||||
return smoke_utils.run_command(command=[kubescape_exec, "scan", "control", 'C-0048', all_files])
|
||||
return smoke_utils.run_command(command=[kubescape_exec, "scan", "--keep-local", "control", 'C-0048', all_files])
|
||||
|
||||
|
||||
def scan_controls(kubescape_exec: str):
|
||||
return smoke_utils.run_command(command=[kubescape_exec, "scan", "control", 'C-0048,C-0016', all_files])
|
||||
return smoke_utils.run_command(command=[kubescape_exec, "scan", "--keep-local", "control", 'C-0048,C-0016', all_files])
|
||||
|
||||
|
||||
def scan_framework(kubescape_exec: str):
|
||||
return smoke_utils.run_command(command=[kubescape_exec, "scan", "framework", "nsa", all_files])
|
||||
return smoke_utils.run_command(command=[kubescape_exec, "scan", "--keep-local", "framework", "nsa", all_files])
|
||||
|
||||
|
||||
def scan_frameworks(kubescape_exec: str):
|
||||
return smoke_utils.run_command(command=[kubescape_exec, "scan", "framework", "nsa,mitre", all_files])
|
||||
return smoke_utils.run_command(command=[kubescape_exec, "scan", "--keep-local", "framework", "nsa,mitre", all_files])
|
||||
|
||||
|
||||
def scan_all(kubescape_exec: str):
|
||||
return smoke_utils.run_command(command=[kubescape_exec, "scan", all_files])
|
||||
return smoke_utils.run_command(command=[kubescape_exec, "scan", "--keep-local", all_files])
|
||||
|
||||
|
||||
def scan_all_format_sarif(kubescape_exec: str):
|
||||
return smoke_utils.run_command(command=[kubescape_exec, "scan", all_files, "--format", "sarif", "--output", "results"])
|
||||
return smoke_utils.run_command(command=[kubescape_exec, "scan", "--keep-local", all_files, "--format", "sarif", "--output", "results"])
|
||||
|
||||
|
||||
def scan_all_format_json(kubescape_exec: str):
|
||||
return smoke_utils.run_command(command=[kubescape_exec, "scan", all_files, "--format", "json", "--output", "results"])
|
||||
return smoke_utils.run_command(command=[kubescape_exec, "scan", "--keep-local", all_files, "--format", "json", "--output", "results"])
|
||||
|
||||
|
||||
def scan_all_format_junit(kubescape_exec: str):
|
||||
return smoke_utils.run_command(command=[kubescape_exec, "scan", all_files, "--format", "junit", "--output", "results"])
|
||||
return smoke_utils.run_command(command=[kubescape_exec, "scan", "--keep-local", all_files, "--format", "junit", "--output", "results"])
|
||||
|
||||
|
||||
def scan_all_format_pretty_printer(kubescape_exec: str):
|
||||
return smoke_utils.run_command(command=[kubescape_exec, "scan", all_files, "--format", "pretty-printer", "--output", "results"])
|
||||
return smoke_utils.run_command(command=[kubescape_exec, "scan", "--keep-local", all_files, "--format", "pretty-printer", "--output", "results"])
|
||||
|
||||
|
||||
def scan_all_format_html(kubescape_exec: str):
|
||||
return smoke_utils.run_command(command=[kubescape_exec, "scan", all_files, "--format", "html", "--output", "results"])
|
||||
return smoke_utils.run_command(command=[kubescape_exec, "scan", "--keep-local", all_files, "--format", "html", "--output", "results"])
|
||||
|
||||
|
||||
def scan_all_format_pdf(kubescape_exec: str):
|
||||
return smoke_utils.run_command(command=[kubescape_exec, "scan", all_files, "--format", "pdf", "--output", "results"])
|
||||
return smoke_utils.run_command(command=[kubescape_exec, "scan", "--keep-local", all_files, "--format", "pdf", "--output", "results"])
|
||||
|
||||
|
||||
def scan_from_stdin(kubescape_exec: str):
|
||||
return smoke_utils.run_command(command=["cat", single_file, "|", kubescape_exec, "scan", "framework", "nsa", "-"])
|
||||
return smoke_utils.run_command(command=["cat", single_file, "|", kubescape_exec, "--keep-local", "scan", "framework", "nsa", "-"])
|
||||
|
||||
|
||||
def run(kubescape_exec: str):
|
||||
|
||||
Reference in New Issue
Block a user