-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Cley Pal
committed
Apr 25, 2023
0 parents
commit 61f6446
Showing
40 changed files
with
1,329 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,6 @@ | ||
skip-path: | ||
- venv | ||
- .terraform | ||
# framework: | ||
# - terraform | ||
# - secrets |
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 |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#!/usr/bin/env bash | ||
export AWS_ACCESS_KEY_ID="" | ||
export AWS_SECRET_ACCESS_KEY="" | ||
export AWS_SESSION_TOKEN="" | ||
|
||
# Prisma Cloud | ||
export PRISMA_API_URL="https://<STACK>.prismacloud.io" | ||
export PC_ACCESS_KEY="" | ||
export PC_SECRET_KEY="" | ||
export PCC_CONSOLE_URL="https://<Region>.cloud.twistlock.com/<Identifier>" | ||
export PCC_URL=${PCC_CONSOLE_URL} | ||
|
||
# CLI convenience ENV variables | ||
export TWISTLOCK_USER="${PC_ACCESS_KEY}" | ||
export TWISTLOCK_PASSWORD="${PC_SECRET_KEY}" | ||
export BC_API_KEY="${PC_ACCESS_KEY}::${PC_SECRET_KEY}" |
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 |
---|---|---|
@@ -0,0 +1,69 @@ | ||
name: Build & deploy to Amazon ECR | ||
|
||
on: | ||
# push: | ||
workflow_dispatch: | ||
inputs: | ||
AWS_REGION: | ||
description: 'AWS Region of ECR' | ||
required: true | ||
default: '<ConfigureMe>' | ||
ECR_REPOSITORY: | ||
description: 'AWS ECR name' | ||
required: true | ||
default: '<ConfigureMe>' | ||
CONTAINER_NAME: | ||
description: 'Container name' | ||
required: true | ||
default: 'spring4shell-demo' | ||
WORKDIR: | ||
description: 'WORKDIR / Container folder' | ||
required: true | ||
default: 'code/' | ||
|
||
jobs: | ||
deploy: | ||
name: Deploy | ||
runs-on: ubuntu-latest | ||
environment: production | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Configure AWS credentials | ||
uses: aws-actions/configure-aws-credentials@13d241b293754004c80624b5567555c4a39ffbe3 | ||
with: | ||
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
aws-region: ${{ github.event.inputs.AWS_REGION }} | ||
|
||
- name: Login to Amazon ECR | ||
id: login-ecr | ||
uses: aws-actions/amazon-ecr-login@aaf69d68aa3fb14c1d5a6be9ac61fe15b48453a2 | ||
|
||
- name: Build & tag image | ||
id: build-image | ||
env: | ||
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }} | ||
ECR_REPOSITORY: ${{ github.event.inputs.ECR_REPOSITORY }} | ||
CONTAINER_NAME: ${{ github.event.inputs.CONTAINER_NAME }} | ||
IMAGE_TAG: ${{ github.sha }} | ||
WORKDIR: ${{ github.event.inputs.WORKDIR }} | ||
run: | | ||
# Build a docker container | ||
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$CONTAINER_NAME-$IMAGE_TAG "$WORKDIR" | ||
- name: Push image to Amazon ECR | ||
id: push-image | ||
env: | ||
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }} | ||
ECR_REPOSITORY: ${{ github.event.inputs.ECR_REPOSITORY }} | ||
CONTAINER_NAME: ${{ github.event.inputs.CONTAINER_NAME }} | ||
IMAGE_TAG: ${{ github.sha }} | ||
WORKDIR: ${{ github.event.inputs.WORKDIR }} | ||
run: | | ||
# push it to ECR so that it can | ||
# be deployed to ECS. | ||
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$CONTAINER_NAME-$IMAGE_TAG | ||
echo "::set-output name=image::$ECR_REGISTRY/$ECR_REPOSITORY:$CONTAINER_NAME-$IMAGE_TAG" |
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 |
---|---|---|
@@ -0,0 +1,145 @@ | ||
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: spring4shell-demo:latest | ||
|
||
jobs: | ||
build-and-scan-container: | ||
name: Build, scan and sandbox 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 code/ | ||
|
||
- 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 }} | ||
|
||
- 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 code/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 | ||
|
||
# CLI usage of checkov | ||
# - name: Set up Python | ||
# uses: actions/setup-python@v1 | ||
# with: | ||
# python-version: 3.8 | ||
|
||
# - name: Download checkov | ||
# run: | | ||
# pip install -U checkov | ||
|
||
# - name: Execute checkov | ||
# run: | | ||
# checkov -d . --repo-id "$GITHUB_REPOSITORY" -o github_failed_only | ||
# env: | ||
# BC_API_KEY: ${{ secrets.PC_ACCESS_KEY }}:${{ secrets.PC_SECRET_KEY }} | ||
# PRISMA_API_URL: ${{ vars.PRISMA_API_URL }} |
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 |
---|---|---|
@@ -0,0 +1,141 @@ | ||
# 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/ | ||
pip-wheel-metadata/ | ||
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/ | ||
|
||
# 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 | ||
target/ | ||
|
||
# Jupyter Notebook | ||
.ipynb_checkpoints | ||
|
||
# IPython | ||
profile_default/ | ||
ipython_config.py | ||
|
||
# pyenv | ||
.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 | ||
|
||
# PEP 582; used by e.g. github.com/David-OConnor/pyflow | ||
__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/ | ||
|
||
# Other | ||
.env | ||
.env.self | ||
.terraform/ | ||
ecs/ | ||
outputs/ | ||
*.tfstate.backup | ||
*.tfstate | ||
twistcli | ||
terraform_old/ | ||
other/ |
Oops, something went wrong.