Skip to content

Testing #1

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

Open
wants to merge 110 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
110 commits
Select commit Hold shift + click to select a range
e30e4e7
edit
thogue12 Feb 27, 2025
4552ba8
I added some things to the pylint job
thogue12 Mar 1, 2025
d0f9f43
recent commit
thogue12 Mar 1, 2025
7e92a41
added a blank line at the end of the main.py file
thogue12 Mar 1, 2025
cd09719
I added another empty line at the end of the test_main.py file
thogue12 Mar 1, 2025
b9d57ff
I removed the extra white space at the end of the test_main.py file
thogue12 Mar 1, 2025
2c361d7
I added another empty line at the end of the test_main.py file
thogue12 Mar 1, 2025
5a24fa5
I added another empty line at the end of the test_main.py file
thogue12 Mar 1, 2025
dbf7fc1
I added another empty line at the end of the test_main.py file
thogue12 Mar 1, 2025
3d643eb
changed the python version to 3.12.4
thogue12 Mar 1, 2025
5d44d9b
added some commands to the snyk job from the error log
thogue12 Mar 1, 2025
a91dde7
new change
thogue12 Mar 1, 2025
6bc61d6
another change
thogue12 Mar 1, 2025
2bf8ab4
added the docker build job to the trivy job
thogue12 Mar 1, 2025
1dc1489
added sarif file
thogue12 Mar 1, 2025
23dfe52
added sarif file
thogue12 Mar 1, 2025
03a160b
edited the trivy file to change the format from templat to sarif and …
thogue12 Mar 1, 2025
fa3f100
edited the trivy file to change the format from templat to sarif and …
thogue12 Mar 1, 2025
b5ec42d
installed black
thogue12 Mar 1, 2025
bcad054
fixing pylint issues
damienjburks Mar 1, 2025
3452d99
updating
damienjburks Mar 1, 2025
af31bae
edit
thogue12 Mar 8, 2025
b9046ca
edit
thogue12 Mar 8, 2025
b2c23d5
edit
thogue12 Mar 8, 2025
3fd8c78
edit
thogue12 Mar 8, 2025
7a918b2
testing the new test
thogue12 Mar 11, 2025
2621321
testing the new test
thogue12 Mar 11, 2025
e8f0544
testing the new test
thogue12 Mar 11, 2025
fef50a0
i re added the requirements.txt even though they are already there
thogue12 Mar 13, 2025
4e6d6e4
i re added the requirements.txt even though they are already there
thogue12 Mar 13, 2025
048e428
i re added the requirements.txt even though they are already there
thogue12 Mar 13, 2025
c1455b3
i re added the requirements.txt even though they are already there
thogue12 Mar 13, 2025
b2c38ec
i re added the requirements.txt even though they are already there
thogue12 Mar 13, 2025
e216f89
i re added the requirements.txt even though they are already there
thogue12 Mar 13, 2025
f69e8e2
i re added the requirements.txt even though they are already there
thogue12 Mar 13, 2025
a8cc83d
i re added the requirements.txt even though they are already there
thogue12 Mar 13, 2025
e8c0282
i re added the requirements.txt even though they are already there
thogue12 Mar 13, 2025
05f77c3
i re added the requirements.txt even though they are already there
thogue12 Mar 13, 2025
ad9562e
i re added the requirements.txt even though they are already there
thogue12 Mar 13, 2025
a55d5ad
i re added the requirements.txt even though they are already there
thogue12 Mar 13, 2025
4b38b0a
i re added the requirements.txt even though they are already there
thogue12 Mar 13, 2025
e36e67c
i re added the requirements.txt even though they are already there
thogue12 Mar 13, 2025
61219c6
i re added the requirements.txt even though they are already there
thogue12 Mar 13, 2025
906e128
fixing pylint issues
damienjburks Mar 18, 2025
3da0ceb
merging changes
thogue12 Mar 21, 2025
61ef245
edit
thogue12 Mar 21, 2025
6c72e01
edit
thogue12 Mar 21, 2025
c2f9a77
updating snyk
damienjburks Mar 21, 2025
cce49ad
updating pr workflow by changing from target to just regular PR
damienjburks Mar 21, 2025
b766cbe
fixing snyk because teh action doesn't work
damienjburks Mar 21, 2025
e6da009
testing hoping that it actually works...
damienjburks Mar 21, 2025
87b2d76
commenting out sec scans
damienjburks Mar 21, 2025
6c892dc
updating snyk again - we're CLOSE
damienjburks Mar 21, 2025
3f31375
help us
damienjburks Mar 21, 2025
fdd0b99
removing snyk scans
damienjburks Mar 22, 2025
9dfcae2
adding sleep command for container
damienjburks Mar 22, 2025
2c5fbce
disabling issue writing
damienjburks Mar 22, 2025
4465d00
uncommenting lines for PR workflow
damienjburks Mar 22, 2025
acef22a
added image push to ghcr
thogue12 Mar 28, 2025
12cc763
added image push to ghcr
thogue12 Mar 28, 2025
357d277
added image push to ghcr
thogue12 Mar 28, 2025
32a41ac
edited the permissions
thogue12 Mar 28, 2025
101b9e9
added ghcr token and took out useless stuff
thogue12 Apr 1, 2025
16e4366
added ghcr token and took out useless stuff
thogue12 Apr 1, 2025
a37b439
added ghcr token and took out useless stuff
thogue12 Apr 1, 2025
1642f4a
added ghcr token and took out useless stuff
thogue12 Apr 1, 2025
60adc43
added ghcr token and took out useless stuff
thogue12 Apr 1, 2025
640269e
added ghcr token and took out useless stuff
thogue12 Apr 1, 2025
06f992c
added ghcr token and took out useless stuff
thogue12 Apr 1, 2025
529144b
added ghcr token and took out useless stuff
thogue12 Apr 1, 2025
2a2c83d
added ghcr token and took out useless stuff
thogue12 Apr 1, 2025
d61e15a
added ghcr token and took out useless stuff
thogue12 Apr 1, 2025
1541982
cahnged how the username is called
thogue12 Apr 1, 2025
cd5ed5a
cahnged how the username is called
thogue12 Apr 1, 2025
3003112
cahnged how the username is called
thogue12 Apr 1, 2025
34b3a2f
cahnged how the username is called
thogue12 Apr 2, 2025
c408f00
cahnged how the username is called
thogue12 Apr 2, 2025
fe50a62
cahnged how the username is called
thogue12 Apr 2, 2025
1c54b0d
cahnged how the username is called
thogue12 Apr 2, 2025
6e10bba
cahnged how the username is called
thogue12 Apr 2, 2025
287a471
cahnged how the username is called
thogue12 Apr 2, 2025
71fe139
changed the username, password, and included docker build job
thogue12 Apr 2, 2025
67a9023
changed the username, password, and included docker build job
thogue12 Apr 2, 2025
4541060
changed the username, password, and included docker build job
thogue12 Apr 2, 2025
47360f8
changed the username, password, and included docker build job
thogue12 Apr 2, 2025
dd3e4e9
changed the username, password, and included docker build job
thogue12 Apr 2, 2025
4d6d785
changed the username, password, and included docker build job, also a…
thogue12 Apr 2, 2025
ce90833
changed the username, password, and included docker build job, also a…
thogue12 Apr 2, 2025
d9be750
changed the username, password, and included docker build job, also a…
thogue12 Apr 2, 2025
6c0f286
added a timeout feature to ensure the container was running before pu…
thogue12 Apr 2, 2025
5a2b551
added a timeout feature to ensure the container was running before pu…
thogue12 Apr 2, 2025
90c75ea
added a timeout feature to ensure the container was running before pu…
thogue12 Apr 2, 2025
e9e652b
edit
thogue12 Apr 2, 2025
798981f
used the image name from earlier jobs
thogue12 Apr 2, 2025
74b85b7
used the image name from earlier jobs
thogue12 Apr 2, 2025
533dcad
used the image name from earlier jobs
thogue12 Apr 3, 2025
f616651
used the image name from earlier jobs
thogue12 Apr 3, 2025
c9951eb
used the image name from earlier jobs
thogue12 Apr 3, 2025
2d755d5
used the image name from earlier jobs
thogue12 Apr 3, 2025
06ebafd
used the image name from earlier jobs
thogue12 Apr 3, 2025
905587a
used the image name from earlier jobs
thogue12 Apr 3, 2025
46ba1d9
used the image name from earlier jobs
thogue12 Apr 3, 2025
1304e1d
Adjusted the tages syntax
thogue12 Apr 3, 2025
a1bd640
Adjusted the tags syntax
thogue12 Apr 3, 2025
5f0f0d9
Adjusted the tags syntax
thogue12 Apr 3, 2025
b020f96
Adjusted the tags syntax
thogue12 Apr 3, 2025
0c50105
Adjusted the tags syntax
thogue12 Apr 3, 2025
9024962
Adjusted the tags syntax
thogue12 Apr 3, 2025
99c5fdc
Adjusted the tags syntax
thogue12 Apr 3, 2025
f2911ba
removed the id-token: write permission
thogue12 Apr 24, 2025
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
Binary file modified .github/.DS_Store
Binary file not shown.
3 changes: 2 additions & 1 deletion .github/workflows/build-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,5 @@ jobs:

- name: Build Docker Image
run: |
docker build -t awesome-fastapi:${{ github.sha }} .
docker build -t awesome-fastapi:${{ github.sha }} .

3 changes: 1 addition & 2 deletions .github/workflows/lint-format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,8 @@ jobs:

- name: Install dependencies
run: |
pip install -r requirements.txt
python -m pip install --upgrade pip
pip install pylint
pip install pylint black

- name: Run pylint
run: pylint .
Expand Down
11 changes: 8 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
name: Main Workflow
on:
push:
branches:
- main

workflow_dispatch:

permissions:
contents: read
security-events: write
actions: read
packages: write


jobs:
Expand All @@ -20,4 +21,8 @@ jobs:

unit-sec-scan:
uses: ./.github/workflows/unit-sec-test.yml
needs: lint-format
needs: lint-format

push-docker-image:
uses: ./.github/workflows/push-docker-image.yml
needs: unit-sec-scan
2 changes: 1 addition & 1 deletion .github/workflows/pr.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: PR Workflow
on:
pull_request_target:
pull_request:
types:
- opened
- edited
Expand Down
58 changes: 58 additions & 0 deletions .github/workflows/push-docker-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: Push Docker Image


on:
workflow_call:

env:
# Use docker.io for Docker Hub if empty
REGISTRY: ghcr.io
IMAGE_NAME: 'awesome-fastapi'


jobs:
Push_Image:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4

# Set up Docker Buildx
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226

# Extract metadata (tags, labels) for Docker
- name: Extract metadata for Docker
id: meta
uses: docker/metadata-action@v3
with:
images: ghcr.io/${{ github.repository_owner }}/${{ env.IMAGE_NAME }}

# Login against a Docker registry
- name: Log into registry ${{ env.REGISTRY }}
if: github.event_name != 'pull_request'
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}


# Build and tag Docker Image
- name: Build Docker Image
run: |
docker build -t ghcr.io/${{ github.repository_owner }}/${{ env.IMAGE_NAME }}:${{ github.sha }} .

- name: Tag Docker Image
run: |
docker tag ghcr.io/${{ github.repository_owner }}/${{ env.IMAGE_NAME }}:${{ github.sha }} ghcr.io/${{ github.repository_owner }}/${{ env.IMAGE_NAME }}:latest
docker tag ghcr.io/${{ github.repository_owner }}/${{ env.IMAGE_NAME }}:${{ github.sha }} ghcr.io/${{ github.repository_owner }}/${{ env.IMAGE_NAME }}:testing


# Push the Docker image to the registry
- name: Push Docker Image to GHCR
run: |
docker push ghcr.io/${{ github.repository_owner }}/${{ env.IMAGE_NAME }}:${{ github.sha }}
docker push ghcr.io/${{ github.repository_owner }}/${{ env.IMAGE_NAME }}:latest
docker push ghcr.io/${{ github.repository_owner }}/${{ env.IMAGE_NAME }}:testing
90 changes: 38 additions & 52 deletions .github/workflows/unit-sec-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,42 +13,12 @@ jobs:
uses: actions/checkout@v4

- name: Install dependencies
run: pip install -r requirements.txt

run: |
pip install -r requirements.txt

- name: Run tests
run: pytest tests/


# Run snyk code scanning for vulnerabilities
snyk_scan:
permissions:
contents: read
security-events: write
actions: read
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.12.5"


- name: Install dependencies
run: pip install -r requirements.txt

- name: Install Snyk CLI
uses: snyk/actions/setup@806182742461562b67788a64410098c9d9b96adb

env:
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
- name: Snyk Code test
run: snyk code test --sarif > snyk-cide.sarif

- name: Snyk Test Dependencies
run: snyk test


# Scan the contianer and lists all security vulnerabilities
trivy_scans:
name: Run Trivy security scanner against the image
Expand All @@ -57,13 +27,16 @@ jobs:
- name: Checkout code
uses: actions/checkout@v4

- name: Run Trivy vulnerability scanner
uses: aquasecurity/trivy-action@7b7aa264d83dc58691451798b4d117d53d21edfe
- name: Build Docker Image
run: |
docker build -t awesome-fastapi:${{ github.sha }} . ###- This section needed to be added becasue the image was not persisting between jobs--##

- name: Run Trivy Vulnerability Scanner
uses: aquasecurity/[email protected]
with:
image-ref: 'awesome-fastapi:${{ github.sha }}'
format: 'template'
template: '@/contrib/sarif.tpl'
output: 'GitHub Actions/Trivy Automation'
format: 'sarif'
output: 'trivy-results.sarif'
severity: 'CRITICAL,HIGH'

- name: Upload Trivy scan results to GitHub Security tab
Expand All @@ -75,17 +48,30 @@ jobs:
runs-on: ubuntu-latest
name: app scan
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: master

- name: zap scan
uses: zaproxy/[email protected]
with:
token: ${{ secrets.GITHUB_TOKEN}}
docker_name: 'ghcr.io/zaproxy/zaproxy:stable'
format: openapi
target: '<fast-api-url>'
rules_file_name: '.zap/rules.tsv'
cmd_options: '-a'
- name: Checkout
uses: actions/checkout@v4

# Build and Tag Image
# Run Docker Image in detached mode
- name: Build Docker Image
run: |
docker build -t awesome-fastapi:${{ github.sha }} .
docker run -d -p 8080:8080 awesome-fastapi:${{ github.sha }}

- name: Wait for Docker container to be ready
run: sleep 30

- name: Confirm Docker container is running
run: docker ps

# Run OWASP ZAP scan
- name: zap scan
uses: zaproxy/[email protected]
with:
token: ${{ secrets.GITHUB_TOKEN }}
docker_name: 'ghcr.io/zaproxy/zaproxy:stable'
format: openapi
target: 'http://0.0.0.0:8080'
rules_file_name: '.zap/rules.tsv'
cmd_options: '-a'
allow_issue_writing: false
124 changes: 0 additions & 124 deletions DevSecOps-Pipeline.yml

This file was deleted.

Loading