Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

ci: add container scanning to default checks #1993

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"Bools",
"brioux",
"cactusf",
"cactuts",
"cafile",
"caio",
"cccs",
Expand Down
38 changes: 38 additions & 0 deletions .github/workflows/azure-container-scan.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: azure-container-image-scan

on:
push:
pull_request:
# Publish `main` as Docker `latest` image.
branches:
- main

# Publish `v1.2.3` tags as releases.
tags:
- v*


jobs:
build-secure-and-push:
name: Scan cactus-besu-all-in-one image
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2.4.0
env:
# (Required) The token to use to make API calls to GitHub.
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"

- uses: actions/checkout@v1
- name: Login to DockerHub Registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin


- name: Build Images from Dockerfile
run: DOCKER_BUILDKIT=1 docker build ./tools/docker/besu-all-in-one -f ./tools/docker/besu-all-in-one/Dockerfile -t cactus-besu-all-in-one

- uses: Azure/container-scan@v0.1
name: Scan image for vulnerabilities
id: container-scan
continue-on-error: true
with:
image-name: cactus-besu-all-in-one
53 changes: 53 additions & 0 deletions .github/workflows/trivy-container-scan.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: trivy-container-image-scan

on:
push:
pull_request:
# Publish `main` as Docker `latest` image.
branches:
- main

# Publish `v1.2.3` tags as releases.
tags:
- v*


jobs:

build:
name: Scan cactus-example-carbon-accounting table image
runs-on: ubuntu-20.04
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Build an image from Dockerfile
run: |
DOCKER_BUILDKIT=1 docker build ./ -f ./examples/carbon-accounting/Dockerfile -t cactus-example-carbon-accounting
- name: Run Trivy vulnerability scanner
uses: aquasecurity/trivy-action@0.11.2
with:
image-ref: 'cactus-example-carbon-accounting'
format: 'table'
exit-code: '0'
ignore-unfixed: true
vuln-type: 'os,library'
severity: 'CRITICAL,HIGH'

build2:
name: Scan cactus-example-carbon-accounting json image
runs-on: ubuntu-20.04
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Build an image from Dockerfile
run: |
DOCKER_BUILDKIT=1 docker build ./ -f ./examples/carbon-accounting/Dockerfile -t cactus-example-carbon-accounting
- name: Run Trivy vulnerability scanner
uses: aquasecurity/trivy-action@0.11.2
with:
image-ref: 'cactus-example-carbon-accounting'
format: 'json'
exit-code: '0'
ignore-unfixed: true
vuln-type: 'os,library'
severity: 'CRITICAL,HIGH'
2 changes: 1 addition & 1 deletion examples/carbon-accounting/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | b
RUN source ~/.bashrc && \
nvm install 16.15.1 && \
npm install -g yarn && \
yarn add @hyperledger/cactus-example-carbon-accounting-backend@0.9.1-ci-942.cbb849c6.35 --ignore-engines --production
yarn add @hyperledger/cactus-example-carbon-accounting-backend@1.1.0 --ignore-engines --production

SHELL ["/bin/bash", "--login", "-c"]

Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
FROM rust:1.63.0 as builder
FROM rust:1.65.0 as builder

WORKDIR /
RUN USER=root cargo new --bin cactus-keychain-vault-server
WORKDIR /cactus-keychain-vault-server
ADD ./rust/gen/ ./
RUN cargo build --release --example server

FROM debian:buster-slim
FROM debian:bullseye-slim
ARG APP=/usr/src/app

RUN apt-get update
Expand Down
2 changes: 1 addition & 1 deletion packages/cactus-plugin-ledger-connector-besu/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ghcr.io/hyperledger/cactus-cmd-api-server:2022-08-05-7309f2a
FROM ghcr.io/hyperledger/cactus-cmd-api-server:2022-11-15-f4ae605
RUN npm install -g yarn@1.22.17

ENV NODE_ENV=production
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,12 @@ test(testCase, async (t: Test) => {
const ledger = new FabricTestLedgerV1({
emitContainerLogs: true,
publishAllPorts: true,
imageName: "ghcr.io/hyperledger/cactus-fabric2-all-in-one",
envVars: new Map([["FABRIC_VERSION", "2.2.0"]]),
imageName: "cactuts/faio",
envVars: new Map([
["FABRIC_VERSION", "2.4.4"],
["CA_VERSION", "1.5.3"],
]),
imageVersion: "latest",
logLevel,
});

Expand Down
2 changes: 2 additions & 0 deletions tools/docker/besu-all-in-one/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ FROM quorumengineering/tessera:$TESSERA_VERSION AS tessera

COPY --from=besu /opt/besu/ /opt/besu/

USER root

RUN mkdir /config/
RUN mkdir /config/orion/
RUN mkdir /config/besu/
Expand Down
2 changes: 1 addition & 1 deletion tools/docker/corda-all-in-one/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ FROM docker:24.0.2-dind

ARG SAMPLES_KOTLIN_SHA=30fd841dd035934bae75ab8910da3b6e3d5d6ee7
ARG SAMPLES_KOTLIN_CORDAPP_SUB_DIR_PATH="./Advanced/obligation-cordapp/"
ARG CORDA_TOOLS_SHELL_CLI_VERSION=4.7
ARG CORDA_TOOLS_SHELL_CLI_VERSION=4.8.9

WORKDIR /

Expand Down
6 changes: 3 additions & 3 deletions tools/docker/corda-all-in-one/corda-v4_8/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
FROM docker:24.0.2-dind

# cordaVersion=4.8.5
# cordaCoreVersion=4.8.5
# cordaVersion=4.9
# cordaCoreVersion=4.9
ARG SAMPLES_KOTLIN_SHA=1504878ce446555bd861bbe4dd3d1154e905a07f
ARG SAMPLES_KOTLIN_CORDAPP_SUB_DIR_PATH="./Advanced/obligation-cordapp/"
ARG CORDA_TOOLS_SHELL_CLI_VERSION=4.8
ARG CORDA_TOOLS_SHELL_CLI_VERSION=4.8.7

WORKDIR /

Expand Down
13 changes: 7 additions & 6 deletions tools/docker/fabric-all-in-one/Dockerfile_v2.x
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@
# https://github.com/docker-library/docker/issues/170
FROM docker:24.0.2-dind

ARG FABRIC_VERSION=2.2.0
ARG CA_VERSION=1.4.9
ARG FABRIC_VERSION=2.4.4
ARG CA_VERSION=1.5.3
ARG COUCH_VERSION_FABRIC=0.4
ARG COUCH_VERSION=3.1.1
ARG COUCH_VERSION=3.2.2
ARG FABRIC_NODEENV=2.4.2

WORKDIR /

Expand Down Expand Up @@ -46,8 +47,8 @@ RUN apk add --no-cache file
RUN apk add --no-cache npm nodejs

# Download and setup path variables for Go
RUN wget https://golang.org/dl/go1.15.5.linux-amd64.tar.gz
RUN tar -xvf go1.15.5.linux-amd64.tar.gz
RUN wget https://golang.org/dl/go1.18.3.linux-amd64.tar.gz
RUN tar -xvf go1.18.3.linux-amd64.tar.gz
RUN mv go /usr/local
ENV GOROOT=/usr/local/go
ENV GOPATH=/usr/local/go
Expand Down Expand Up @@ -149,7 +150,7 @@ RUN mkdir -p /etc/couchdb/
RUN /download-frozen-image-v2.sh /etc/hyperledger/fabric/fabric-peer/ hyperledger/fabric-peer:${FABRIC_VERSION}
RUN /download-frozen-image-v2.sh /etc/hyperledger/fabric/fabric-orderer/ hyperledger/fabric-orderer:${FABRIC_VERSION}
RUN /download-frozen-image-v2.sh /etc/hyperledger/fabric/fabric-ccenv/ hyperledger/fabric-ccenv:${FABRIC_VERSION}
RUN /download-frozen-image-v2.sh /etc/hyperledger/fabric/fabric-nodeenv/ hyperledger/fabric-nodeenv:${FABRIC_VERSION}
RUN /download-frozen-image-v2.sh /etc/hyperledger/fabric/fabric-nodeenv/ hyperledger/fabric-nodeenv:${FABRIC_NODEENV}
RUN /download-frozen-image-v2.sh /etc/hyperledger/fabric/fabric-tools/ hyperledger/fabric-tools:${FABRIC_VERSION}
RUN /download-frozen-image-v2.sh /etc/hyperledger/fabric/fabric-baseos/ hyperledger/fabric-baseos:${FABRIC_VERSION}
RUN /download-frozen-image-v2.sh /etc/hyperledger/fabric/fabric-ca/ hyperledger/fabric-ca:${CA_VERSION}
Expand Down
Loading