-
-
Notifications
You must be signed in to change notification settings - Fork 361
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: update security scanners (#1107)
- Loading branch information
1 parent
3276408
commit 1857ba3
Showing
5 changed files
with
61 additions
and
47 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,74 +14,71 @@ jobs: | |
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
uses: actions/checkout@v3 | ||
- name: Setup Env | ||
id: vars | ||
shell: bash | ||
run: | | ||
echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})" | ||
echo "::set-output name=sha_short::$(git rev-parse --short HEAD)" | ||
echo "SHA_SHORT=$(git rev-parse --short HEAD)" >> "${GITHUB_ENV}" | ||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v1 | ||
uses: docker/setup-qemu-action@v2 | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v1 | ||
uses: docker/setup-buildx-action@v2 | ||
- name: Build images | ||
shell: bash | ||
run: | | ||
touch oathkeeper | ||
DOCKER_BUILDKIT=1 docker build -t oryd/oathkeeper:${{ steps.vars.outputs.sha_short }} --build-arg=COMMIT=${{ steps.vars.outputs.sha_short }} . | ||
DOCKER_BUILDKIT=1 docker build -t oryd/oathkeeper:alpine-${{ steps.vars.outputs.sha_short }} --build-arg=COMMIT=${{ steps.vars.outputs.sha_short }} -f Dockerfile-alpine . | ||
rm oathkeeper | ||
IMAGE_TAG="${{ env.SHA_SHORT }}" make docker | ||
- name: Anchore Scanner | ||
uses: anchore/scan-action@v3 | ||
id: grype-scan | ||
with: | ||
image: oryd/oathkeeper:${{ steps.vars.outputs.sha_short }} | ||
image: oryd/oathkeeper:${{ env.SHA_SHORT }}-alpine | ||
fail-build: true | ||
severity-cutoff: high | ||
debug: false | ||
acs-report-enable: true | ||
- name: Anchore Scanner | ||
uses: anchore/scan-action@v3 | ||
id: grype-scan-alpine | ||
with: | ||
image: oryd/oathkeeper:alpine-${{ steps.vars.outputs.sha_short }} | ||
fail-build: true | ||
severity-cutoff: high | ||
debug: false | ||
acs-report-enable: true | ||
add-cpes-if-none: true | ||
- name: Inspect action SARIF report | ||
shell: bash | ||
if: ${{ always() }} | ||
run: | | ||
echo "::group::Anchore Scan Details" | ||
jq '.runs[0].results' ${{ steps.grype-scan.outputs.sarif }} | ||
jq '.runs[0].results' ${{ steps.grype-scan-alpine.outputs.sarif }} | ||
echo "::endgroup::" | ||
- name: Trivy Scanner | ||
uses: aquasecurity/trivy-action@master | ||
if: ${{ always() }} | ||
- name: Anchore upload scan SARIF report | ||
if: always() | ||
uses: github/codeql-action/upload-sarif@v2 | ||
with: | ||
image-ref: oryd/oathkeeper:${{ steps.vars.outputs.sha_short }} | ||
format: "table" | ||
exit-code: "42" | ||
ignore-unfixed: true | ||
vuln-type: "os,library" | ||
severity: "CRITICAL,HIGH" | ||
- name: Trivy Scanner 2 | ||
sarif_file: ${{ steps.grype-scan.outputs.sarif }} | ||
- name: Trivy Scanner | ||
uses: aquasecurity/trivy-action@master | ||
if: ${{ always() }} | ||
with: | ||
image-ref: oryd/oathkeeper:alpine-${{ steps.vars.outputs.sha_short }} | ||
image-ref: oryd/oathkeeper:${{ env.SHA_SHORT }}-alpine | ||
format: "table" | ||
exit-code: "42" | ||
ignore-unfixed: true | ||
vuln-type: "os,library" | ||
severity: "CRITICAL,HIGH" | ||
scanners: "vuln,secret,config" | ||
- name: Dockle Linter | ||
uses: erzz/[email protected] | ||
if: ${{ always() }} | ||
with: | ||
image: oryd/oathkeeper:${{ steps.vars.outputs.sha_short }} | ||
image: oryd/oathkeeper:${{ env.SHA_SHORT }}-alpine | ||
exit-code: 42 | ||
failure-threshold: fatal | ||
failure-threshold: high | ||
- name: Hadolint | ||
uses: hadolint/[email protected] | ||
id: hadolint | ||
if: ${{ always() }} | ||
with: | ||
dockerfile: Dockerfile-alpine | ||
verbose: true | ||
format: "json" | ||
failure-threshold: "error" | ||
- name: View Hadolint results | ||
if: ${{ always() }} | ||
shell: bash | ||
run: | | ||
echo "::group::Hadolint Scan Details" | ||
echo "${HADOLINT_RESULTS}" | jq '.' | ||
echo "::endgroup::" |
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 |
---|---|---|
@@ -1,16 +1,20 @@ | ||
# To compile this image manually run: | ||
# | ||
# $ make docker | ||
FROM alpine:3.17.3 | ||
FROM alpine:3.18 as base | ||
|
||
RUN apk --no-cache --update-cache --upgrade --latest add ca-certificates | ||
|
||
############# | ||
FROM scratch | ||
|
||
COPY --from=0 /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ | ||
COPY --from=base /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ | ||
COPY oathkeeper /usr/bin/oathkeeper | ||
|
||
USER 1000 | ||
|
||
EXPOSE 4455 | ||
EXPOSE 4456 | ||
|
||
ENTRYPOINT ["oathkeeper"] | ||
CMD ["serve"] |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,26 @@ | ||
FROM golang:1.19-alpine3.17 | ||
FROM golang:1.20-alpine3.18 AS builder | ||
|
||
RUN addgroup -S ory; \ | ||
adduser -S ory -G ory -D -H -s /bin/nologin | ||
|
||
RUN apk --no-cache --update-cache --upgrade --latest add ca-certificates | ||
|
||
ADD . /app | ||
COPY . /app | ||
WORKDIR /app | ||
ENV GO111MODULE on | ||
RUN go mod download && go mod tidy | ||
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build | ||
|
||
USER ory | ||
############ | ||
FROM alpine:3.18 AS runner | ||
|
||
ENTRYPOINT ["/app/oathkeeper"] | ||
RUN apk --no-cache --update-cache --upgrade --latest add ca-certificates | ||
|
||
COPY --from=builder /app/oathkeeper /usr/bin/oathkeeper | ||
USER 1000 | ||
|
||
EXPOSE 4455 | ||
EXPOSE 4456 | ||
|
||
ENTRYPOINT ["/usr/bin/oathkeeper"] | ||
CMD ["serve"] |
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