Skip to content

Commit 5e3b4d4

Browse files
Merge pull request #43 from draios/nishantkavuru-patch-1
feat [DEVX-2314] Update kube bench to fix the build git workflow
2 parents 4c60a9f + fed76a0 commit 5e3b4d4

22 files changed

+549
-365
lines changed

.github/workflows/build.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,26 +16,26 @@ on:
1616
jobs:
1717
build:
1818
name: Build
19-
runs-on: ubuntu-18.04
19+
runs-on: ubuntu-latest
2020
steps:
2121
- name: Setup Go
22-
uses: actions/setup-go@v2
22+
uses: actions/setup-go@v5.3.0
2323
with:
24-
go-version: 1.16
24+
go-version: 1.23.6
2525
- name: Checkout code
26-
uses: actions/checkout@v2
26+
uses: actions/checkout@v4.2.2
2727
- name: yaml-lint
2828
uses: ibiqlik/action-yamllint@v3
2929
- name: Run unit tests
3030
run: make tests
3131
- name: Upload code coverage
32-
uses: codecov/codecov-action@v1
32+
uses: codecov/codecov-action@v5.3.1
3333
with:
3434
file: ./coverage.txt
3535
- name: Run integration tests
3636
run: make integration-tests
3737
- name: Dry-run release snapshot
38-
uses: goreleaser/goreleaser-action@v2
38+
uses: goreleaser/goreleaser-action@v6.2.1
3939
with:
40-
version: v0.148.0
41-
args: release --snapshot --skip-publish --rm-dist
40+
version: '~> v2'
41+
args: release --snapshot --skip publish --clean

.github/workflows/publish.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,44 +12,44 @@ env:
1212
jobs:
1313
publish:
1414
name: Publish
15-
runs-on: ubuntu-18.04
15+
runs-on: ubuntu-latest
1616
steps:
1717
- name: Check Out Repo
18-
uses: actions/checkout@v2
18+
uses: actions/checkout@v4.2.2
1919
- name: Set up QEMU
20-
uses: docker/setup-qemu-action@v1
20+
uses: docker/setup-qemu-action@v3.4.0
2121
- name: Set up Docker Buildx
2222
id: buildx
2323
uses: docker/setup-buildx-action@v1
2424
- name: Cache Docker layers
25-
uses: actions/cache@v2
25+
uses: actions/cache@v4.2.1
2626
with:
2727
path: /tmp/.buildx-cache
2828
key: ${{ runner.os }}-buildxarch-${{ github.sha }}
2929
restore-keys: |
3030
${{ runner.os }}-buildxarch-
3131
- name: Login to Docker Hub
32-
uses: docker/login-action@v1
32+
uses: docker/login-action@v3
3333
with:
3434
username: ${{ secrets.DOCKERHUB_USER }}
3535
password: ${{ secrets.DOCKERHUB_TOKEN }}
3636
- name: Login to ECR
37-
uses: docker/login-action@v1
37+
uses: docker/login-action@v3
3838
with:
3939
registry: public.ecr.aws
4040
username: ${{ secrets.ECR_ACCESS_KEY_ID }}
4141
password: ${{ secrets.ECR_SECRET_ACCESS_KEY }}
4242
- name: Get version
4343
id: get_version
44-
uses: crazy-max/ghaction-docker-meta@v1
44+
uses: crazy-max/ghaction-docker-meta@v3.3.1
4545
with:
4646
images: ${{ env.REP }}
4747
tag-semver: |
4848
{{version}}
4949
5050
- name: Build and push - Docker/ECR
5151
id: docker_build
52-
uses: docker/build-push-action@v2
52+
uses: docker/build-push-action@v6.13.0
5353
with:
5454
context: .
5555
platforms: linux/amd64

.github/workflows/release.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,22 +7,22 @@ on:
77
jobs:
88
release:
99
name: Release
10-
runs-on: ubuntu-18.04
10+
runs-on: ubuntu-latest
1111
steps:
1212
- name: Setup Go
13-
uses: actions/setup-go@v2
13+
uses: actions/setup-go@v5.3.0
1414
with:
15-
go-version: 1.16
15+
go-version: 1.23.6
1616
- name: Checkout code
17-
uses: actions/checkout@v2
17+
uses: actions/checkout@v4.2.2
1818
- name: Run unit tests
1919
run: make tests
2020
- name: Run integration tests
2121
run: make integration-tests
2222
- name: Release
23-
uses: goreleaser/goreleaser-action@v2
23+
uses: goreleaser/goreleaser-action@v6.2.1
2424
with:
25-
version: v0.148.0
25+
version: '~> v2'
2626
args: release --rm-dist
2727
env:
2828
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.goreleaser.yml

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
---
2+
version: 2
3+
24
env:
35
- GO111MODULE=on
46
- KUBEBENCH_CFG=/etc/kube-bench/cfg
@@ -20,7 +22,7 @@ builds:
2022
# Archive customization
2123
archives:
2224
- id: default
23-
format: tar.gz
25+
formats: ['tar.gz']
2426
name_template: '{{ .Binary }}_{{.Version}}_{{ .Os }}_{{ .Arch }}{{ if .Arm }}v{{.Arm }}{{ end }}'
2527
files:
2628
- "cfg/**/*"
@@ -32,9 +34,17 @@ nfpms:
3234
description: "The Kubernetes Bench for Security is a Go application that checks whether Kubernetes is deployed according to security best practices"
3335
license: Apache-2.0
3436
homepage: https://github.com/aquasecurity/kube-bench
35-
files:
36-
"cfg/**/*": "/etc/kube-bench/cfg"
37-
"cfg/config.yaml": "/etc/kube-bench/cfg"
37+
contents:
38+
- src: "cfg/**/*"
39+
dst: "/etc/kube-bench/cfg"
40+
file_info:
41+
mode: 0644
42+
mtime: "{{ .CommitDate }}"
43+
- src: "cfg/config.yaml"
44+
dst: "/etc/kube-bench/cfg"
45+
file_info:
46+
mode: 0644
47+
mtime: "{{ .CommitDate }}"
3848
formats:
3949
- deb
4050
- rpm

Dependency-Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM golang:1.23 AS builder
1+
FROM golang:1.23.6 AS builder
22

33
ENV OUTPUT_DIR=/out
44
ENV KUBECTL_VERSION="v1.31.4"

Dependency-Dockerfile_linux_arm64

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM golang:1.23 AS builder
1+
FROM golang:1.23.6 AS builder
22

33
ENV OUTPUT_DIR=/out
44
ENV KUBECTL_VERSION="v1.31.4"

Dependency-Dockerfile_linux_s390x

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM golang:1.23 AS builder
1+
FROM golang:1.23.6 AS builder
22

33
ENV OUTPUT_DIR=/out
44
ENV KUBECTL_VERSION="v1.31.4"

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM golang:1.23 AS build
1+
FROM golang:1.23.6 AS build
22
WORKDIR /go/src/github.com/aquasecurity/kube-bench/
33
COPY go.mod go.sum ./
44
COPY main.go .

cfg/rh-1.0/policies.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ groups:
275275
- id: 5.2.9
276276
text: "Minimize the admission of containers with capabilities assigned (Manual)"
277277
audit: |
278-
for i in `oc get scc --template '{{range.items}}{{.metadata.name}}{{"\n"}}{{end}}'`; do
278+
for i in `oc get scc --template '{{range.items}}{{.metadata.name}}{{"\n"}}{{end}}'`; do
279279
echo "Capabilities=$(oc describe scc $i | grep "Required Drop Capabilities" | sed 's/[[:blank:]]*Required[[:blank:]]*Drop[[:blank:]]*Capabilities:[[:blank:]]*//')"
280280
done
281281
use_multiple_values: true
@@ -436,9 +436,9 @@ groups:
436436
oc get all -n default -o jsonpath="{range .items[*]}{.metadata.name}{'\n'}{end}{'\n'}" | tr '\n' ',' | sed -e 's/^/default-namespace-items=/' -e 's/,$//' -e 's/=$/=<none>/' -e 's/,$//'
437437
tests:
438438
test_items:
439-
- flag: "default-namespace-items"
440-
compare:
441-
op: eq
439+
- flag: "default-namespace-items"
440+
compare:
441+
op: eq
442442
value: "<none>"
443443
remediation: |
444444
Ensure that namespaces are created to allow for appropriate segregation of Kubernetes

go.mod

Lines changed: 34 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,78 +1,86 @@
11
module github.com/aquasecurity/kube-bench
22

3-
go 1.23
3+
go 1.23.6
44

55
require (
66
github.com/aws/aws-sdk-go v1.35.28
7-
github.com/fatih/color v1.5.0
8-
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b
9-
github.com/jinzhu/gorm v0.0.0-20160404144928-5174cc5c242a
10-
github.com/magiconair/properties v1.8.0
11-
github.com/onsi/ginkgo v1.10.1
7+
github.com/fatih/color v1.18.0
8+
github.com/golang/glog v1.2.4
9+
github.com/jinzhu/gorm v1.9.16
10+
github.com/magiconair/properties v1.8.9
11+
github.com/onsi/ginkgo v1.16.5
1212
github.com/pkg/errors v0.9.1
13-
github.com/spf13/cobra v0.0.3
13+
github.com/spf13/cobra v1.8.0
1414
github.com/spf13/viper v1.4.0
15-
github.com/stretchr/testify v1.4.0
16-
gopkg.in/yaml.v2 v2.2.8
15+
github.com/stretchr/testify v1.5.1
16+
gopkg.in/yaml.v2 v2.4.0
1717
k8s.io/api v0.0.0-20190409021203-6e4e0e4f393b
1818
k8s.io/apimachinery v0.0.0-20190404173353-6a84e37a896d
1919
k8s.io/client-go v11.0.0+incompatible
20-
sigs.k8s.io/kind v0.5.1
20+
sigs.k8s.io/kind v0.27.0
2121
)
2222

2323
require (
24+
al.essio.dev/pkg/shellescape v1.5.1 // indirect
25+
github.com/BurntSushi/toml v1.4.0 // indirect
2426
github.com/PuerkitoBio/purell v1.1.1 // indirect
2527
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 // indirect
2628
github.com/davecgh/go-spew v1.1.1 // indirect
27-
github.com/denisenkom/go-mssqldb v0.0.0-20190515213511-eb9f6a1743f3 // indirect
29+
github.com/denisenkom/go-mssqldb v0.0.0-20191124224453-732737034ffd // indirect
2830
github.com/emicklei/go-restful v2.9.6+incompatible // indirect
2931
github.com/erikstmartin/go-testdb v0.0.0-20160219214506-8d10e4a1bae5 // indirect
3032
github.com/evanphx/json-patch v4.5.0+incompatible // indirect
31-
github.com/fsnotify/fsnotify v1.4.7 // indirect
33+
github.com/evanphx/json-patch/v5 v5.6.0 // indirect
34+
github.com/fsnotify/fsnotify v1.4.9 // indirect
3235
github.com/go-openapi/jsonpointer v0.19.2 // indirect
3336
github.com/go-openapi/jsonreference v0.19.2 // indirect
3437
github.com/go-openapi/spec v0.19.2 // indirect
3538
github.com/go-openapi/swag v0.19.2 // indirect
36-
github.com/go-sql-driver/mysql v1.4.1 // indirect
39+
github.com/go-sql-driver/mysql v1.5.0 // indirect
3740
github.com/gogo/protobuf v1.2.1 // indirect
38-
github.com/golang/protobuf v1.3.1 // indirect
41+
github.com/golang/protobuf v1.4.2 // indirect
3942
github.com/google/gofuzz v1.0.0 // indirect
43+
github.com/google/safetext v0.0.0-20220905092116-b49f7bc46da2 // indirect
4044
github.com/googleapis/gnostic v0.3.0 // indirect
4145
github.com/hashicorp/hcl v1.0.0 // indirect
4246
github.com/imdario/mergo v0.3.5 // indirect
43-
github.com/inconshreveable/mousetrap v1.0.0 // indirect
44-
github.com/jinzhu/inflection v0.0.0-20170102125226-1c35d901db3d // indirect
47+
github.com/inconshreveable/mousetrap v1.1.0 // indirect
48+
github.com/jinzhu/inflection v1.0.0 // indirect
4549
github.com/jinzhu/now v1.0.1 // indirect
4650
github.com/jmespath/go-jmespath v0.4.0 // indirect
4751
github.com/json-iterator/go v1.1.6 // indirect
4852
github.com/konsorten/go-windows-terminal-sequences v1.0.1 // indirect
49-
github.com/lib/pq v0.0.0-20171126050459-83612a56d3dd // indirect
53+
github.com/lib/pq v1.1.1 // indirect
5054
github.com/mailru/easyjson v0.0.0-20190620125010-da37f6c1e481 // indirect
51-
github.com/mattn/go-colorable v0.0.0-20170210172801-5411d3eea597 // indirect
52-
github.com/mattn/go-isatty v0.0.0-20170307163044-57fdcb988a5c // indirect
53-
github.com/mattn/go-sqlite3 v1.10.0 // indirect
55+
github.com/mattn/go-colorable v0.1.13 // indirect
56+
github.com/mattn/go-isatty v0.0.20 // indirect
57+
github.com/mattn/go-sqlite3 v1.14.0 // indirect
5458
github.com/mitchellh/mapstructure v1.1.2 // indirect
5559
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
5660
github.com/modern-go/reflect2 v1.0.1 // indirect
57-
github.com/pelletier/go-toml v1.2.0 // indirect
61+
github.com/nxadm/tail v1.4.8 // indirect
62+
github.com/pelletier/go-toml v1.9.5 // indirect
5863
github.com/pmezard/go-difflib v1.0.0 // indirect
5964
github.com/sirupsen/logrus v1.4.1 // indirect
6065
github.com/spf13/afero v1.2.2 // indirect
6166
github.com/spf13/cast v1.3.0 // indirect
6267
github.com/spf13/jwalterweatherman v1.0.0 // indirect
63-
github.com/spf13/pflag v1.0.3 // indirect
68+
github.com/spf13/pflag v1.0.5 // indirect
6469
github.com/stretchr/objx v0.2.0 // indirect
65-
golang.org/x/crypto v0.0.0-20190611184440-5c40567a22f8 // indirect
66-
golang.org/x/net v0.0.0-20200202094626-16171245cfb2 // indirect
70+
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9 // indirect
71+
golang.org/x/net v0.0.0-20201021035429-f5854403a974 // indirect
6772
golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d // indirect
68-
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f // indirect
73+
golang.org/x/sys v0.25.0 // indirect
6974
golang.org/x/text v0.4.0 // indirect
7075
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4 // indirect
7176
google.golang.org/appengine v1.5.0 // indirect
77+
google.golang.org/protobuf v1.23.0 // indirect
7278
gopkg.in/inf.v0 v0.9.1 // indirect
79+
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 // indirect
80+
gopkg.in/yaml.v3 v3.0.1 // indirect
7381
k8s.io/klog v0.3.3 // indirect
7482
k8s.io/kube-openapi v0.0.0-20190603182131-db7b694dc208 // indirect
7583
k8s.io/utils v0.0.0-20191114200735-6ca3b61696b6 // indirect
7684
sigs.k8s.io/kustomize/v3 v3.1.1-0.20190821175718-4b67a6de1296 // indirect
77-
sigs.k8s.io/yaml v1.1.0 // indirect
85+
sigs.k8s.io/yaml v1.4.0 // indirect
7886
)

0 commit comments

Comments
 (0)