From 440e92f7008d9e39e13b2167e1dc9bc3ebe979c2 Mon Sep 17 00:00:00 2001 From: Hardik Sharma <104981324+hardiksharma11@users.noreply.github.com> Date: Sun, 31 Dec 2023 16:12:49 +0530 Subject: [PATCH 01/12] Create bandit_security_test.yml Added Bandit security test for python --- .github/workflows/bandit_security_test.yml | 29 ++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 .github/workflows/bandit_security_test.yml diff --git a/.github/workflows/bandit_security_test.yml b/.github/workflows/bandit_security_test.yml new file mode 100644 index 000000000..4eeb03ceb --- /dev/null +++ b/.github/workflows/bandit_security_test.yml @@ -0,0 +1,29 @@ +name: Security check - Bandit + +on: push + +jobs: + build: + runs-on: ubuntu-latest + strategy: + matrix: + os: [ ubuntu-latest, macos-latest ] + python-version: [ '2.7.17', '3.8.10' ] + name: Python ${{ matrix.python-version }} ${{ matrix.os }} + + steps: + - uses: actions/checkout@v2 + + - name: Security check - Bandit + uses: ./ + with: + python_version: ${{ matrix.python-version }} + project_path: . + ignore_failure: true + + - name: Security check report artifacts + uses: actions/upload-artifact@v1 + # if: failure() + with: + name: Security report + path: output/security_report.txt From a311e33fba087d794ee079bb0725f868d22d6cb2 Mon Sep 17 00:00:00 2001 From: Hardik Sharma <104981324+hardiksharma11@users.noreply.github.com> Date: Sun, 31 Dec 2023 18:58:38 +0530 Subject: [PATCH 02/12] Update bandit_security_test.yml --- .github/workflows/bandit_security_test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/bandit_security_test.yml b/.github/workflows/bandit_security_test.yml index 4eeb03ceb..02c66853a 100644 --- a/.github/workflows/bandit_security_test.yml +++ b/.github/workflows/bandit_security_test.yml @@ -8,7 +8,7 @@ jobs: strategy: matrix: os: [ ubuntu-latest, macos-latest ] - python-version: [ '2.7.17', '3.8.10' ] + python-version: '3.8' name: Python ${{ matrix.python-version }} ${{ matrix.os }} steps: From 77200865a88a70858885dd8c74fb79a209b8b2eb Mon Sep 17 00:00:00 2001 From: Hardik Sharma <104981324+hardiksharma11@users.noreply.github.com> Date: Sun, 31 Dec 2023 19:03:06 +0530 Subject: [PATCH 03/12] Update bandit_security_test.yml --- .github/workflows/bandit_security_test.yml | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/.github/workflows/bandit_security_test.yml b/.github/workflows/bandit_security_test.yml index 02c66853a..6c77c2cbc 100644 --- a/.github/workflows/bandit_security_test.yml +++ b/.github/workflows/bandit_security_test.yml @@ -8,22 +8,20 @@ jobs: strategy: matrix: os: [ ubuntu-latest, macos-latest ] - python-version: '3.8' - name: Python ${{ matrix.python-version }} ${{ matrix.os }} + name: Python ${{ matrix.os }} steps: - uses: actions/checkout@v2 - name: Security check - Bandit - uses: ./ + uses: ioggstream/bandit-report-artifacts@v0.0.2 with: - python_version: ${{ matrix.python-version }} project_path: . ignore_failure: true + # This is optional - name: Security check report artifacts uses: actions/upload-artifact@v1 - # if: failure() with: name: Security report path: output/security_report.txt From 02ba6ab716c4bdbe0ded3379b10c75479c83edd4 Mon Sep 17 00:00:00 2001 From: Hardik Sharma <104981324+hardiksharma11@users.noreply.github.com> Date: Sun, 31 Dec 2023 19:15:35 +0530 Subject: [PATCH 04/12] Create mypy.yml Mypy is an incredibly useful tool for checking python code quality. It is more specifically a static type checker. --- .github/workflows/mypy.yml | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 .github/workflows/mypy.yml diff --git a/.github/workflows/mypy.yml b/.github/workflows/mypy.yml new file mode 100644 index 000000000..bec330093 --- /dev/null +++ b/.github/workflows/mypy.yml @@ -0,0 +1,20 @@ +name: Mypy + +on: [push] + +jobs: + build: + runs-on: ubuntu-latest + name: Mypy + steps: + - uses: actions/checkout@v1 + - name: Set up Python 3.8 + uses: actions/setup-python@v1 + with: + python-version: 3.8 + - name: Install Dependencies + run: | + pip install mypy + - name: mypy + run: | + mypy src/ From 1673794679e73ad4304e87f449db5ca62d638a8c Mon Sep 17 00:00:00 2001 From: Hardik Sharma <104981324+hardiksharma11@users.noreply.github.com> Date: Sun, 31 Dec 2023 19:17:30 +0530 Subject: [PATCH 05/12] Update mypy.yml --- .github/workflows/mypy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/mypy.yml b/.github/workflows/mypy.yml index bec330093..f8d9982d3 100644 --- a/.github/workflows/mypy.yml +++ b/.github/workflows/mypy.yml @@ -17,4 +17,4 @@ jobs: pip install mypy - name: mypy run: | - mypy src/ + mypy / From 151a82ddcd345b1e0d30732306e1b39281ebd599 Mon Sep 17 00:00:00 2001 From: Hardik Sharma <104981324+hardiksharma11@users.noreply.github.com> Date: Sun, 31 Dec 2023 19:23:09 +0530 Subject: [PATCH 06/12] Update mypy.yml --- .github/workflows/mypy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/mypy.yml b/.github/workflows/mypy.yml index f8d9982d3..676853912 100644 --- a/.github/workflows/mypy.yml +++ b/.github/workflows/mypy.yml @@ -17,4 +17,4 @@ jobs: pip install mypy - name: mypy run: | - mypy / + mypy --strict From 19409280498f10eda3f7529033ef5d15cb5aabe4 Mon Sep 17 00:00:00 2001 From: Hardik Sharma <104981324+hardiksharma11@users.noreply.github.com> Date: Sun, 31 Dec 2023 19:28:24 +0530 Subject: [PATCH 07/12] Update mypy.yml --- .github/workflows/mypy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/mypy.yml b/.github/workflows/mypy.yml index 676853912..edc5f2603 100644 --- a/.github/workflows/mypy.yml +++ b/.github/workflows/mypy.yml @@ -17,4 +17,4 @@ jobs: pip install mypy - name: mypy run: | - mypy --strict + mypy From f16e32d7b023876894c8ca80d4e631d0058ff726 Mon Sep 17 00:00:00 2001 From: Hardik Sharma <104981324+hardiksharma11@users.noreply.github.com> Date: Sun, 31 Dec 2023 19:33:27 +0530 Subject: [PATCH 08/12] Update mypy.yml Apply only on changed files --- .github/workflows/mypy.yml | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/.github/workflows/mypy.yml b/.github/workflows/mypy.yml index edc5f2603..1b18df57a 100644 --- a/.github/workflows/mypy.yml +++ b/.github/workflows/mypy.yml @@ -1,20 +1,23 @@ -name: Mypy - +name: "mypy check" on: [push] jobs: - build: + + static-type-check: runs-on: ubuntu-latest - name: Mypy steps: - - uses: actions/checkout@v1 - - name: Set up Python 3.8 - uses: actions/setup-python@v1 + - uses: actions/checkout@v2 + - uses: actions/setup-python@v3 + with: + python-version: '3.x' + - run: pip install mypy # you can pin your preferred version + - name: Get Python changed files + id: changed-py-files + uses: tj-actions/changed-files@v23 with: - python-version: 3.8 - - name: Install Dependencies - run: | - pip install mypy - - name: mypy - run: | - mypy + files: | + *.py + **/*.py + - name: Run if any of the listed files above is changed + if: steps.changed-py-files.outputs.any_changed == 'true' + run: mypy ${{ steps.changed-py-files.outputs.all_changed_files }} --ignore-missing-imports From 5ba68c4866507cc1f13bd4d89f090bc1ebc4f071 Mon Sep 17 00:00:00 2001 From: Hardik Sharma <104981324+hardiksharma11@users.noreply.github.com> Date: Sun, 31 Dec 2023 19:36:38 +0530 Subject: [PATCH 09/12] Update manage.py --- FusionIIIT/manage.py | 1 + 1 file changed, 1 insertion(+) diff --git a/FusionIIIT/manage.py b/FusionIIIT/manage.py index c4bcdcbec..58fc547f3 100755 --- a/FusionIIIT/manage.py +++ b/FusionIIIT/manage.py @@ -1,5 +1,6 @@ #!/usr/bin/env python import os + import sys if __name__ == "__main__": From f0855826db0f52463feb42c8f6913a84944aaafa Mon Sep 17 00:00:00 2001 From: Hardik Sharma Date: Tue, 2 Jan 2024 18:27:28 +0530 Subject: [PATCH 10/12] Added explanatory comments --- .github/workflows/bandit_security_test.yml | 26 +++++++++---------- .github/workflows/mypy.yml | 25 +++++++++++------- .../migrations/0002_auto_20231225_2358.py | 18 +++++++++++++ FusionIIIT/manage.py | 1 - 4 files changed, 46 insertions(+), 24 deletions(-) create mode 100644 FusionIIIT/applications/globals/migrations/0002_auto_20231225_2358.py diff --git a/.github/workflows/bandit_security_test.yml b/.github/workflows/bandit_security_test.yml index 6c77c2cbc..cf5f29c4e 100644 --- a/.github/workflows/bandit_security_test.yml +++ b/.github/workflows/bandit_security_test.yml @@ -1,27 +1,27 @@ -name: Security check - Bandit +name: Security check - Bandit # Name of the GitHub Actions workflow -on: push +on: push # Trigger the workflow on push events jobs: build: - runs-on: ubuntu-latest + runs-on: ubuntu-latest # Executes the job on the latest version of Ubuntu strategy: matrix: - os: [ ubuntu-latest, macos-latest ] - name: Python ${{ matrix.os }} + os: [ubuntu-latest, macos-latest] # Running matrix jobs on both Ubuntu and macOS + name: Python ${{ matrix.os }} # Name the job based on the OS being used steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v2 # Checks out your repository's code - - name: Security check - Bandit - uses: ioggstream/bandit-report-artifacts@v0.0.2 + - name: Security check - Bandit # Run Bandit security check + uses: ioggstream/bandit-report-artifacts@v0.0.2 # Using Bandit for security checks with: - project_path: . - ignore_failure: true + project_path: . # Path to the project to scan + ignore_failure: true # Continue the workflow even if Bandit reports issues - # This is optional + # This step is optional, it uploads the Bandit report as an artifact - name: Security check report artifacts uses: actions/upload-artifact@v1 with: - name: Security report - path: output/security_report.txt + name: Security report # Name of the artifact + path: output/security_report.txt # Path to the Bandit security report diff --git a/.github/workflows/mypy.yml b/.github/workflows/mypy.yml index 1b18df57a..0a5754521 100644 --- a/.github/workflows/mypy.yml +++ b/.github/workflows/mypy.yml @@ -1,23 +1,28 @@ -name: "mypy check" -on: [push] +name: "mypy check" # Name of the GitHub Actions workflow + +on: [push] # Trigger the workflow on push events jobs: static-type-check: - runs-on: ubuntu-latest + runs-on: ubuntu-latest # Executes the job on the latest version of Ubuntu + steps: - - uses: actions/checkout@v2 - - uses: actions/setup-python@v3 + - uses: actions/checkout@v2 # Checks out your repository's code + - uses: actions/setup-python@v3 # Sets up Python for the job with: - python-version: '3.x' - - run: pip install mypy # you can pin your preferred version - - name: Get Python changed files + python-version: '3.x' # Specifies Python version 3.x + + - run: pip install mypy # Installs mypy for static type checking, you can specify a version here + + - name: Get Python changed files # Identifies changed Python files id: changed-py-files uses: tj-actions/changed-files@v23 with: files: | *.py **/*.py - - name: Run if any of the listed files above is changed - if: steps.changed-py-files.outputs.any_changed == 'true' + + - name: Run if any of the listed files above is changed # Runs mypy on changed files + if: steps.changed-py-files.outputs.any_changed == 'true' # Conditional execution if any Python files changed run: mypy ${{ steps.changed-py-files.outputs.all_changed_files }} --ignore-missing-imports diff --git a/FusionIIIT/applications/globals/migrations/0002_auto_20231225_2358.py b/FusionIIIT/applications/globals/migrations/0002_auto_20231225_2358.py new file mode 100644 index 000000000..abe435203 --- /dev/null +++ b/FusionIIIT/applications/globals/migrations/0002_auto_20231225_2358.py @@ -0,0 +1,18 @@ +# Generated by Django 3.1.5 on 2023-12-25 23:58 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('globals', '0001_initial'), + ] + + operations = [ + migrations.AlterField( + model_name='extrainfo', + name='user_status', + field=models.CharField(choices=[('NEW', 'NEW'), ('PRESENT', 'PRESENT')], default='PRESENT', max_length=50), + ), + ] diff --git a/FusionIIIT/manage.py b/FusionIIIT/manage.py index 58fc547f3..c4bcdcbec 100755 --- a/FusionIIIT/manage.py +++ b/FusionIIIT/manage.py @@ -1,6 +1,5 @@ #!/usr/bin/env python import os - import sys if __name__ == "__main__": From d6d5a69851d823ba3b76b70b3ed818223459b67a Mon Sep 17 00:00:00 2001 From: Hardik Sharma Date: Tue, 2 Jan 2024 18:32:30 +0530 Subject: [PATCH 11/12] Added pull request as a trigger --- .github/workflows/bandit_security_test.yml | 2 +- .github/workflows/mypy.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/bandit_security_test.yml b/.github/workflows/bandit_security_test.yml index cf5f29c4e..a26912690 100644 --- a/.github/workflows/bandit_security_test.yml +++ b/.github/workflows/bandit_security_test.yml @@ -1,6 +1,6 @@ name: Security check - Bandit # Name of the GitHub Actions workflow -on: push # Trigger the workflow on push events +on: [push, pull_request] # Trigger the workflow jobs: build: diff --git a/.github/workflows/mypy.yml b/.github/workflows/mypy.yml index 0a5754521..3369b397f 100644 --- a/.github/workflows/mypy.yml +++ b/.github/workflows/mypy.yml @@ -1,6 +1,6 @@ name: "mypy check" # Name of the GitHub Actions workflow -on: [push] # Trigger the workflow on push events +on: [push, pull_request] # Trigger the workflow jobs: From 969b2f7b7b49598f1c44bca7a65a26592b1126db Mon Sep 17 00:00:00 2001 From: Hardik Sharma Date: Tue, 2 Jan 2024 18:40:41 +0530 Subject: [PATCH 12/12] minor bug fixes --- .../migrations/0002_auto_20231225_2358.py | 18 ------------------ 1 file changed, 18 deletions(-) delete mode 100644 FusionIIIT/applications/globals/migrations/0002_auto_20231225_2358.py diff --git a/FusionIIIT/applications/globals/migrations/0002_auto_20231225_2358.py b/FusionIIIT/applications/globals/migrations/0002_auto_20231225_2358.py deleted file mode 100644 index abe435203..000000000 --- a/FusionIIIT/applications/globals/migrations/0002_auto_20231225_2358.py +++ /dev/null @@ -1,18 +0,0 @@ -# Generated by Django 3.1.5 on 2023-12-25 23:58 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('globals', '0001_initial'), - ] - - operations = [ - migrations.AlterField( - model_name='extrainfo', - name='user_status', - field=models.CharField(choices=[('NEW', 'NEW'), ('PRESENT', 'PRESENT')], default='PRESENT', max_length=50), - ), - ]