Skip to content

Commit

Permalink
carbon accounting trivy scan
Browse files Browse the repository at this point in the history
  • Loading branch information
aldousalvarez committed Jan 16, 2024
1 parent 1fb2551 commit 96b64b6
Show file tree
Hide file tree
Showing 9 changed files with 133 additions and 208 deletions.
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-example-carbon-accounting image
runs-on: ubuntu-20.04
steps:
- uses: actions/[email protected]
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 -f ./examples/carbon-accounting/Dockerfile . -t cactus-example-carbon-accounting

- uses: Azure/[email protected]
name: Scan image for vulnerabilities
id: container-scan
continue-on-error: true
with:
image-name: cactus-example-carbon-accounting
52 changes: 52 additions & 0 deletions .github/workflows/trivy-container-scan.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
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 scan for cactus-example-carbon-accounting
uses: aquasecurity/[email protected]
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-iroha 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 ./packages/cactus-plugin-ledger-connector-iroha/ -f ./packages/cactus-plugin-ledger-connector-iroha/Dockerfile -t cactus-plugin-iroha
- name: Run Trivy vulnerability scanner
uses: aquasecurity/[email protected]
with:
image-ref: 'cactus-plugin-iroha'
format: 'table'
exit-code: '0'
ignore-unfixed: false
vuln-type: 'os,library'
severity: 'CRITICAL,HIGH'
Original file line number Diff line number Diff line change
Expand Up @@ -76,13 +76,17 @@
"devDependencies": {
"@types/express": "4.17.19",
"@types/fs-extra": "9.0.13",
"@types/http-cache-semantics": "4.0.4",
"@types/json-stable-stringify": "1.0.34",
"@types/qs": "6.9.10",
"@types/uuid": "8.3.4",
"express-jwt": "8.4.1",
"hardhat": "2.17.2",
"http-cache-semantics": "4.1.1",
"http-status-codes": "2.1.4",
"jose": "4.9.2",
"json-stable-stringify": "1.0.2"
"json-stable-stringify": "1.0.2",
"qs": "6.7.3"
},
"engines": {
"node": ">=18",
Expand Down
9 changes: 4 additions & 5 deletions examples/carbon-accounting/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,11 @@ WORKDIR ${APP}

SHELL ["/bin/bash", "--login", "-i", "-c"]
# Installing Node Version Manager (nvm)
RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | bash
RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.5/install.sh | bash
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

nvm install 20.10.0 && \
nvm use 20.10.0 && \
npm install @hyperledger/[email protected]
SHELL ["/bin/bash", "--login", "-c"]


Expand Down
2 changes: 1 addition & 1 deletion examples/carbon-accounting/supervisord.conf
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ stderr_logfile=/usr/src/app/log/dockerd.err.log
stdout_logfile=/usr/src/app/log/dockerd.out.log

[program:carbon-accounting-app]
command=/home/appuser/.nvm/versions/node/v16.3.0/bin/node /usr/src/app/examples/cactus-example-carbon-accounting-backend/dist/lib/main/typescript/carbon-accounting-app-cli.js
command=/home/appuser/.nvm/versions/node/v16.15.1/bin/node /usr/src/app/examples/cactus-example-carbon-accounting-backend/dist/lib/main/typescript/carbon-accounting-app-cli.js
autostart=true
autorestart=unexpected
exitcodes=0
Expand Down
2 changes: 1 addition & 1 deletion packages/cactus-plugin-ledger-connector-iroha/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
FROM ghcr.io/hyperledger/cactus-cmd-api-server:2022-11-14-6ff6aac
RUN npm install -g yarn@1.22.17
RUN npm i -g corepack && corepack enable && corepack prepare yarn@3.6.0 --activate

ENV NODE_ENV=production
ARG NPM_PKG_VERSION=latest
Expand Down
4 changes: 2 additions & 2 deletions packages/cactus-plugin-persistence-ethereum/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@
"@openapitools/openapi-generator-cli": "2.7.0",
"@types/express": "4.17.19",
"@types/pg": "8.6.5",
"body-parser": "1.19.0",
"express": "4.17.1",
"body-parser": "1.20.2",
"express": "4.18.2",
"jest-extended": "4.0.1",
"npm-run-all": "4.1.5",
"rxjs": "7.8.1",
Expand Down
6 changes: 3 additions & 3 deletions tools/docker/iroha-all-in-one/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
FROM hyperledger/iroha:1.4.0-patch-3
FROM hyperledger/iroha:1.6.0-hotfix-3

ARG DEBIAN_FRONTEND=noninteractive
RUN set -e && apt-get update && \
ARG DEBIAN_FRONTEND=noninteractive
RUN set -e && apt-get update && \
apt-get install -y moreutils jq wget python3 python3-pip && \
pip install iroha && \
apt-get purge -y `apt-get -s purge python3-pip | grep '^ ' | tr -d '*'` && \
Expand Down
Loading

0 comments on commit 96b64b6

Please sign in to comment.