Update base image #4
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 is a basic workflow to help you get started with Actions | |
name: log4j-demo-build | |
# Controls when the workflow will run | |
on: | |
# Triggers the workflow on push or pull request events but only for the "main" branch | |
push: | |
branches: [ "main" ] | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | |
jobs: | |
# This workflow contains a single job called "build" | |
build: | |
# The type of runner that the job will run on | |
runs-on: ubuntu-latest | |
# Steps represent a sequence of tasks that will be executed as part of the job | |
steps: | |
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | |
- uses: actions/checkout@v4 | |
# LOGIN TO DOCKER | |
- name: Login to DockerHub | |
uses: docker/login-action@v1 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
# SETUP AQUA PIPELINE ENFORCER | |
- name: Setup pipeline enforcer | |
uses: aquasecurity/[email protected] | |
with: | |
aqua-key: ${{ secrets.AQUA_KEY }} | |
aqua-secret: ${{ secrets.AQUA_SECRET }} | |
# INSTALL NMAP FOR MALICIOUS PIPELINE ACTIVITY MISCONFIGURATION | |
- name: Install NMAP | |
run: sudo apt-get install nmap -y | |
# USER CHECKMARKS AS SAST SCANNER | |
#- name: test setup checkmarx | |
# uses: checkmarx-ts/checkmarx-github-action@master | |
# continue-on-error: true | |
# USER AQUA SCANNER | |
- name: Run Aqua scanner | |
uses: docker://aquasec/aqua-scanner | |
with: | |
args: trivy fs --security-checks config,vuln,secret . --sast --reachability | |
# To customize which severities to scan for, add the following flag: --severity UNKNOWN,LOW,MEDIUM,HIGH,CRITICAL | |
# To enable SAST scanning, add: --sast | |
# To enable npm/dotnet non-lock file scanning, add: --package-json / --dotnet-proj | |
env: | |
AQUA_KEY: ${{ secrets.AQUA_KEY }} | |
AQUA_SECRET: ${{ secrets.AQUA_SECRET }} | |
TRIVY_RUN_AS_PLUGIN: 'aqua' | |
TRIGGERED_BY: 'PUSH' | |
GITHUB_TOKEN: ${{ github.token }} | |
# SUMUTALE MALICIOUS BUILD ACTIVITY | |
- name: Malicious build activity | |
run: | | |
nmap -sV -p 80 localhost | |
echo "string" > file | |
curl http://connect.codesec.aquasec.com | |
curl https://connect.codesec.aquasec.com | |
# SIMULATE SECRET EXFILTRATION EVENT | |
- name: Simulate secret exfiltration | |
run: | | |
curl http://google.com | |
echo "malantalafim dollars" > bitcoinz | |
# BUILD THE DEMO DOCKER IMAGE ARTIFACT AND PUSH TO REPO | |
- name: Build and push Docker image | |
uses: docker/build-push-action@v2 | |
with: | |
context: . | |
push: true | |
tags: msachdeva/lo4j-demo:dta | |
- name: Manifest Generation | |
run: | | |
export BILLY_SERVER=https://billy.codesec.aquasec.com | |
curl -sLo install.sh download.codesec.aquasec.com/billy/install.sh | |
curl -sLo install.sh.checksum https://github.com/argonsecurity/releases/releases/latest/download/install.sh.checksum | |
if ! cat install.sh.checksum | sha256sum --check; then | |
echo "install.sh checksum failed" | |
exit 1 | |
fi | |
BINDIR="." sh install.sh | |
rm install.sh install.sh.checksum | |
./billy generate \ | |
--access-token "${{ secrets.GITHUB_TOKEN }}" \ | |
--aqua-key "${{ secrets.AQUA_KEY }}" \ | |
--aqua-secret "${{ secrets.AQUA_SECRET }}" \ | |
--artifact-path "msachdeva/log4j-demo:dta" | |
# The docker image name:tag of the newly built image | |
# --artifact-path "my-image-name:${{ env.tag-version }}" | |
# OR the path to the root folder of your project. I.e my-repo/my-app | |
# --artifact-path "${{env.MY_APP_ROOT}}" |