Skip to content

Commit

Permalink
Init
Browse files Browse the repository at this point in the history
  • Loading branch information
NJannasch committed Mar 6, 2024
0 parents commit 48824dd
Show file tree
Hide file tree
Showing 10 changed files with 488 additions and 0 deletions.
160 changes: 160 additions & 0 deletions .github/workflows/scan.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,160 @@
# vars.PCC_CONSOLE_URL
# vars.PRISMA_API_URL
# secrets.PC_ACCESS_KEY
# secrets.PC_SECRET_KEY
name: Prisma Cloud Checks
on:
pull_request:
push:
branches:
- main
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

env:
IMAGE_NAME: demo:latest

jobs:
build-and-scan-image:
name: Build & scan image
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write # For SARIF

steps:
- name: Check out the repository
uses: actions/checkout@v2

- name: Build the image
run: docker build -t $IMAGE_NAME .

- name: Container Image Scan
id: scan
uses: PaloAltoNetworks/prisma-cloud-scan@v1
with:
pcc_console_url: ${{ vars.PCC_CONSOLE_URL }}
pcc_user: ${{ secrets.PC_ACCESS_KEY }}
pcc_pass: ${{ secrets.PC_SECRET_KEY }}
image_name: ${{ env.IMAGE_NAME }}

- name: Upload SARIF report
uses: actions/upload-artifact@v2
if: ${{ always() }}
with:
name: SARIF results twistcli
path: ${{ steps.scan.outputs.sarif_file }}

# # Only for public repos or enterprise accounts
# # (Optional) for compatibility with GitHub's code scanning alerts
# - name: Upload SARIF file
# if: ${{ always() }} # necessary if using failure thresholds in the image scan
# uses: github/codeql-action/upload-sarif@v2
# with:
# sarif_file: ${{ steps.scan.outputs.sarif_file }}

sandbox-image:
name: Sandbox image
runs-on: ubuntu-latest
permissions:
actions: read
contents: read

steps:
- name: Check out the repository
uses: actions/checkout@v2

- name: Build the image
run: docker build -t $IMAGE_NAME .

- name: Download Twistcli
if: ${{ always() }}
run: |
chmod +x twistcli_download.sh
./twistcli_download.sh
env:
PCC_URL: ${{ vars.PCC_CONSOLE_URL }}
PC_ACCESS_KEY: ${{ secrets.PC_ACCESS_KEY }}
PC_SECRET_KEY: ${{ secrets.PC_SECRET_KEY }}

- name: Run Image Sandbox
if: ${{ always() }}
run: sudo -E ./twistcli sandbox --address "${PCC_CONSOLE_URL}" ${{ env.IMAGE_NAME }}
env:
PCC_CONSOLE_URL: ${{ vars.PCC_CONSOLE_URL }}
TWISTLOCK_USER: ${{ secrets.PC_ACCESS_KEY }}
TWISTLOCK_PASSWORD: ${{ secrets.PC_SECRET_KEY }}

openapi-scan:
name: Scan OpenAPI Spec
runs-on: ubuntu-latest

steps:
- name: Check out the repository
uses: actions/checkout@v2

- name: Download Twistcli
run: |
chmod +x twistcli_download.sh
./twistcli_download.sh
env:
PCC_URL: ${{ vars.PCC_CONSOLE_URL }}
PC_ACCESS_KEY: ${{ secrets.PC_ACCESS_KEY }}
PC_SECRET_KEY: ${{ secrets.PC_SECRET_KEY }}

- name: Run Scan
run: ./twistcli waas openapi-scan springboot_spec.yaml --address "${PCC_CONSOLE_URL}"
env:
PCC_CONSOLE_URL: ${{ vars.PCC_CONSOLE_URL }}
TWISTLOCK_USER: ${{ secrets.PC_ACCESS_KEY }}
TWISTLOCK_PASSWORD: ${{ secrets.PC_SECRET_KEY }}

checkov-scan:
name: Scan Repo with checkov
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write # For SARIF

steps:
- name: Check out the repository
uses: actions/checkout@v2

- name: Run Bridgecrew Action
id: Bridgecrew
uses: bridgecrewio/bridgecrew-action@master
env:
PRISMA_API_URL: ${{ vars.PRISMA_API_URL }}
with:
api-key: ${{ secrets.PC_ACCESS_KEY }}::${{ secrets.PC_SECRET_KEY }}
quiet: true # only show failed

- name: Upload SARIF report
uses: actions/upload-artifact@v2
if: ${{ always() }}
with:
name: SARIF results Checkov
path: results.sarif

# Only for public repos or enterprise accounts
# Uploads results.sarif to GitHub repository using the upload-sarif action
- uses: github/codeql-action/upload-sarif@v2
with:
# Path to SARIF file relative to the root of the repository
sarif_file: results.sarif

pipeline-exploit:
name: Pull Request annotation
runs-on: ubuntu-latest
if: ${{ github.event_name == 'pull_request' }}
permissions: write-all

steps:
- name: Check out the repository
uses: actions/checkout@v2

- name: Show Pull Request Data
run: |
echo ${{ github.event.pull_request.title }}
160 changes: 160 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,160 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
.pybuilder/
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# poetry
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
#poetry.lock

# pdm
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
#pdm.lock
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
# in version control.
# https://pdm.fming.dev/#use-with-ide
.pdm.toml

# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

# pytype static type analyzer
.pytype/

# Cython debug symbols
cython_debug/

# PyCharm
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/
2 changes: 2 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
FROM simonpanw/spring4shell-vulnerable-tomcat:latest
USER root
28 changes: 28 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
BSD 3-Clause License

Copyright (c) 2024, BusinessAsUsualEnterprise

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.

3. Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# security-scan
This Repository contains some vulnerable artifacts.

## Variables / Secrets
### vars.PRISMA_API_URL
Prisma Cloud URL e.g. https://api.eu.prismacloud.io

### vars.PCC_CONSOLE_URL
Prisma Cloud Compute URL e.g. https://europe-west3.cloud.twistlock.com/eu-1610258

### secrets.PC_ACCESS_KEY
Prisma Cloud Access Key

### secrets.PC_SECRET_KEY
Prisma Cloud Secret Key

## About
Made with ❤ in Dortmund
17 changes: 17 additions & 0 deletions iac/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Minimal misconfigured tf file
terraform {
required_version = ">= 0.12"
}
provider "aws" {
region = "eu-west-1"
}
resource "aws_instance" "example" {
ami = "ami-0c55b159cbfafe1f0"
instance_type = "t2.micro"
tags = {
Name = "example-instance"
}
}
output "public_ip" {
value = aws_instance.example.public_ip
}
Loading

0 comments on commit 48824dd

Please sign in to comment.