Skip to content

Commit 677c35e

Browse files
authored
Linting changes (#23)
* lint smtp mailer file * add precommit * lint shared functions file * lint shared functions file * format smtp mailer file * add gitleaks precommit * lint ses mailer file * lint mailgun mailer file * lint encryption file * lint destructor file * lint destructor file * lint destructor file * lint creator file * update imports order * update github actions version * update tf files and workflow * remove uploading semgrep results to github * fix iam policy syntax and upgrade python version * update libraries and fix syntax * add script to build lambda layers * use trap
1 parent 7f268fb commit 677c35e

19 files changed

+785
-490
lines changed

.github/workflows/checkov.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@ jobs:
77
scan:
88
runs-on: ubuntu-latest
99
steps:
10-
- uses: actions/checkout@v3
10+
- uses: actions/checkout@v4
1111
- name: Set up Python 3.9
12-
uses: actions/setup-python@v4
12+
uses: actions/setup-python@v5
1313
with:
14-
python-version: 3.9
14+
python-version: 3.11
1515
- name: Scan with Checkov
1616
id: checkov
17-
uses: bridgecrewio/checkov-action@master
17+
uses: bridgecrewio/checkov-action@v12
1818
with:
1919
directory: terraform
2020
framework: terraform

.github/workflows/codeql.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ jobs:
3737

3838
steps:
3939
- name: Checkout repository
40-
uses: actions/checkout@v3
40+
uses: actions/checkout@v4
4141

4242
# Initializes the CodeQL tools for scanning.
4343
- name: Initialize CodeQL

.github/workflows/release.yml

+10-10
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ jobs:
1010
run:
1111
working-directory: terraform
1212
steps:
13-
- uses: actions/checkout@v3
13+
- uses: actions/checkout@v4
1414
- name: Set up Terraform
15-
uses: hashicorp/setup-terraform@v2
15+
uses: hashicorp/setup-terraform@v3
1616
- name: Terraform Init
1717
id: init
1818
run: terraform init
@@ -22,14 +22,14 @@ jobs:
2222
checkov:
2323
runs-on: ubuntu-latest
2424
steps:
25-
- uses: actions/checkout@v3
25+
- uses: actions/checkout@v4
2626
- name: Set up Python 3.9
27-
uses: actions/setup-python@v4
27+
uses: actions/setup-python@v5
2828
with:
29-
python-version: 3.9
29+
python-version: 3.11
3030
- name: Scan with Checkov
3131
id: checkov
32-
uses: bridgecrewio/checkov-action@master
32+
uses: bridgecrewio/checkov-action@v12
3333
with:
3434
directory: terraform
3535
framework: terraform
@@ -39,7 +39,7 @@ jobs:
3939
run:
4040
working-directory: src
4141
steps:
42-
- uses: actions/checkout@v3
42+
- uses: actions/checkout@v4
4343
- name: Initialize CodeQL
4444
uses: github/codeql-action/init@v2
4545
with:
@@ -52,15 +52,15 @@ jobs:
5252
run:
5353
working-directory: src
5454
container:
55-
image: returntocorp/semgrep
55+
image: semgrep/semgrep
5656
steps:
57-
- uses: actions/checkout@v3
57+
- uses: actions/checkout@v4
5858
- run: semgrep ci --config "p/ci" --config "p/python" --config "p/owasp-top-ten" --sarif --output=semgrep.sarif
5959
release:
6060
needs: [test, checkov, codeql, semgrep]
6161
runs-on: ubuntu-latest
6262
steps:
63-
- uses: actions/checkout@v3
63+
- uses: actions/checkout@v4
6464
- uses: "marvinpinto/[email protected]"
6565
with:
6666
repo_token: "${{ secrets.GITHUB_TOKEN }}"

.github/workflows/semgrep.yml

+10-16
Original file line numberDiff line numberDiff line change
@@ -27,21 +27,15 @@ jobs:
2727
semgrep:
2828
name: scan
2929
runs-on: ubuntu-latest
30+
container:
31+
image: semgrep/semgrep
3032
steps:
3133
# Fetch project source
32-
- uses: actions/checkout@v3
33-
34-
- uses: returntocorp/semgrep-action@v1
35-
with:
36-
generateSarif: "1"
37-
config: >-
38-
p/ci
39-
p/python
40-
p/owasp-top-ten
41-
p/cwe-top-25
42-
43-
- name: Upload SARIF file
44-
uses: github/codeql-action/upload-sarif@v2
45-
with:
46-
sarif_file: semgrep.sarif
47-
if: always()
34+
- uses: actions/checkout@v4
35+
# Run the "semgrep ci" command on the command line of the docker image.
36+
- run: semgrep ci --config "p/ci" --config "p/python" --config "p/owasp-top-ten" --sarif --output=semgrep.sarif
37+
env:
38+
# Connect to Semgrep Cloud Platform through your SEMGREP_APP_TOKEN.
39+
# Generate a token from Semgrep Cloud Platform > Settings
40+
# and add it to your GitHub secrets.
41+
SEMGREP_APP_TOKEN: ${{ secrets.SEMGREP_APP_TOKEN }}

.github/workflows/test.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ jobs:
1010
run:
1111
working-directory: terraform
1212
steps:
13-
- uses: actions/checkout@v3
13+
- uses: actions/checkout@v4
1414
- name: Set up Terraform
15-
uses: hashicorp/setup-terraform@v2
15+
uses: hashicorp/setup-terraform@v3
1616
- name: Terraform Init
1717
id: init
1818
run: terraform init

.pre-commit-config.yaml

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
repos:
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
3+
rev: v2.3.0
4+
hooks:
5+
- id: check-yaml
6+
- id: end-of-file-fixer
7+
- id: trailing-whitespace
8+
- repo: https://github.com/astral-sh/ruff-pre-commit
9+
rev: v0.3.2
10+
hooks:
11+
# Run the linter.
12+
- id: ruff
13+
# Run the formatter.
14+
- id: ruff-format
15+
- repo: https://github.com/gitleaks/gitleaks
16+
rev: v8.18.2
17+
hooks:
18+
- id: gitleaks

0 commit comments

Comments
 (0)