forked from Checkmarx/kics
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
KICS Docker queries multi-staged aware (Checkmarx#4877)
- Loading branch information
1 parent
7366eb7
commit 26ee35a
Showing
34 changed files
with
289 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 5 additions & 1 deletion
6
assets/queries/dockerfile/healthcheck_instruction_missing/query.rego
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
assets/queries/dockerfile/healthcheck_instruction_missing/test/negative2.dockerfile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
FROM golang:1.16 AS builder | ||
WORKDIR /go/src/github.com/alexellis/href-counter/ | ||
RUN go get -d -v golang.org/x/net/html | ||
COPY app.go ./ | ||
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o app . | ||
|
||
FROM alpine:latest | ||
RUN apk --no-cache add ca-certificates | ||
WORKDIR /root/ | ||
COPY --from=builder /go/src/github.com/alexellis/href-counter/app ./ | ||
CMD ["./app"] | ||
RUN useradd -ms /bin/bash patrick | ||
|
||
USER patrick | ||
HEALTHCHECK CMD curl --fail http://localhost:3000 || exit 1 |
14 changes: 14 additions & 0 deletions
14
assets/queries/dockerfile/healthcheck_instruction_missing/test/positive2.dockerfile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
FROM golang:1.16 AS builder | ||
WORKDIR /go/src/github.com/alexellis/href-counter/ | ||
RUN go get -d -v golang.org/x/net/html | ||
COPY app.go ./ | ||
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o app . | ||
|
||
FROM alpine:latest | ||
RUN apk --no-cache add ca-certificates | ||
WORKDIR /root/ | ||
COPY --from=builder /go/src/github.com/alexellis/href-counter/app ./ | ||
CMD ["./app"] | ||
RUN useradd -ms /bin/bash patrick | ||
|
||
USER patrick |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
assets/queries/dockerfile/last_user_is_root/test/negative2.dockerfile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
FROM golang:1.16 AS builder | ||
WORKDIR /go/src/github.com/alexellis/href-counter/ | ||
RUN go get -d -v golang.org/x/net/html | ||
COPY app.go ./ | ||
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o app . | ||
USER root | ||
|
||
FROM alpine:latest | ||
RUN apk --no-cache add ca-certificates | ||
WORKDIR /root/ | ||
COPY --from=builder /go/src/github.com/alexellis/href-counter/app ./ | ||
CMD ["./app"] | ||
RUN useradd -ms /bin/bash patrick | ||
|
||
USER patrick |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
assets/queries/dockerfile/missing_dnf_clean_all/test/negative2.dockerfile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
FROM golang:1.16 AS builder | ||
WORKDIR /go/src/github.com/alexellis/href-counter/ | ||
RUN go get -d -v golang.org/x/net/html | ||
COPY app.go ./ | ||
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o app . | ||
RUN set -uex && \ | ||
dnf config-manager --add-repo https://download.docker.com/linux/fedora/docker-ce.repo && \ | ||
sed -i 's/\$releasever/26/g' /etc/yum.repos.d/docker-ce.repo && \ | ||
dnf install -vy docker-ce | ||
|
||
FROM alpine:latest | ||
RUN apk --no-cache add ca-certificates | ||
WORKDIR /root/ | ||
COPY --from=builder /go/src/github.com/alexellis/href-counter/app ./ | ||
CMD ["./app"] | ||
RUN useradd -ms /bin/bash patrick | ||
|
||
USER patrick |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
assets/queries/dockerfile/missing_user_instruction/test/negative2.dockerfile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
FROM golang:1.16 AS builder | ||
WORKDIR /go/src/github.com/alexellis/href-counter/ | ||
RUN go get -d -v golang.org/x/net/html | ||
COPY app.go ./ | ||
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o app . | ||
|
||
FROM alpine:latest | ||
RUN apk --no-cache add ca-certificates | ||
WORKDIR /root/ | ||
COPY --from=builder /go/src/github.com/alexellis/href-counter/app ./ | ||
CMD ["./app"] | ||
RUN useradd -ms /bin/bash patrick | ||
|
||
USER patrick |
7 changes: 7 additions & 0 deletions
7
assets/queries/dockerfile/missing_user_instruction/test/negative3.dockerfile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
FROM python:2.7 | ||
RUN pip install Flask==0.11.1 | ||
RUN useradd -ms /bin/bash patrick | ||
COPY --chown=patrick:patrick app /app | ||
WORKDIR /app | ||
USER patrick | ||
CMD ["python", "app.py"] |
11 changes: 11 additions & 0 deletions
11
assets/queries/dockerfile/missing_user_instruction/test/positive2.dockerfile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
FROM golang:1.16 AS builder | ||
WORKDIR /go/src/github.com/alexellis/href-counter/ | ||
RUN go get -d -v golang.org/x/net/html | ||
COPY app.go ./ | ||
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o app . | ||
|
||
FROM alpine:latest | ||
RUN apk --no-cache add ca-certificates | ||
WORKDIR /root/ | ||
COPY --from=builder /go/src/github.com/alexellis/href-counter/app ./ | ||
CMD ["./app"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
assets/queries/dockerfile/missing_zypper_clean/test/negative2.dockerfile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
FROM golang:1.16 AS builder | ||
WORKDIR /go/src/github.com/alexellis/href-counter/ | ||
RUN go get -d -v golang.org/x/net/html | ||
COPY app.go ./ | ||
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o app . | ||
RUN zypper install | ||
|
||
FROM alpine:latest | ||
RUN apk --no-cache add ca-certificates | ||
WORKDIR /root/ | ||
COPY --from=builder /go/src/github.com/alexellis/href-counter/app ./ | ||
CMD ["./app"] | ||
RUN useradd -ms /bin/bash patrick | ||
|
||
USER patrick |
7 changes: 4 additions & 3 deletions
7
assets/queries/dockerfile/missing_zypper_non_interactive_switch/query.rego
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
assets/queries/dockerfile/missing_zypper_non_interactive_switch/test/negative2.dockerfile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
FROM golang:1.16 AS builder | ||
WORKDIR /go/src/github.com/alexellis/href-counter/ | ||
RUN go get -d -v golang.org/x/net/html | ||
COPY app.go ./ | ||
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o app . | ||
RUN zypper install httpd && zypper clean | ||
|
||
FROM alpine:latest | ||
RUN apk --no-cache add ca-certificates | ||
WORKDIR /root/ | ||
COPY --from=builder /go/src/github.com/alexellis/href-counter/app ./ | ||
CMD ["./app"] | ||
RUN useradd -ms /bin/bash patrick | ||
|
||
USER patrick |
4 changes: 4 additions & 0 deletions
4
assets/queries/dockerfile/multiple_cmd_instructions_listed/query.rego
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
assets/queries/dockerfile/multiple_cmd_instructions_listed/test/negative2.dockerfile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
FROM golang:1.16 AS builder | ||
WORKDIR /go/src/github.com/alexellis/href-counter/ | ||
RUN go get -d -v golang.org/x/net/html | ||
COPY app.go ./ | ||
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o app . | ||
CMD ["./app"] | ||
CMD ["./apps"] | ||
|
||
FROM alpine:latest | ||
RUN apk --no-cache add ca-certificates | ||
WORKDIR /root/ | ||
COPY --from=builder /go/src/github.com/alexellis/href-counter/app ./ | ||
CMD ["./app"] | ||
RUN useradd -ms /bin/bash patrick | ||
|
||
USER patrick |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 5 additions & 1 deletion
6
assets/queries/dockerfile/multiple_entrypoint_instructions_listed/query.rego
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
assets/queries/dockerfile/multiple_entrypoint_instructions_listed/test/negative2.dockerfile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
FROM golang:1.16 AS builder | ||
WORKDIR /go/src/github.com/alexellis/href-counter/ | ||
RUN go get -d -v golang.org/x/net/html | ||
COPY app.go ./ | ||
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o app . | ||
ENTRYPOINT [ "/opt/app/run.sh", "--port", "8080" ] | ||
ENTRYPOINT [ "/opt/app/run.sh", "--port", "8000" ] | ||
|
||
FROM alpine:latest | ||
RUN apk --no-cache add ca-certificates | ||
WORKDIR /root/ | ||
COPY --from=builder /go/src/github.com/alexellis/href-counter/app ./ | ||
CMD ["./app"] | ||
RUN useradd -ms /bin/bash patrick | ||
|
||
USER patrick |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.