Skip to content

Commit 56152b2

Browse files
authored
Merge pull request #5 from haqimazhar/codeguru-poc
[MASTER]: Test Codeguru poc
2 parents 2e9f649 + 8787da7 commit 56152b2

File tree

6 files changed

+16
-24
lines changed

6 files changed

+16
-24
lines changed

workflows/main.yml renamed to .github/workflows/main.yml

Lines changed: 11 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ on:
33
push:
44
branches:
55
- 'dev'
6+
- 'codeguru-poc'
67
pull_request:
78
branches:
89
- "main"
@@ -33,31 +34,19 @@ jobs:
3334
aws-region: ap-southeast-1
3435
role-session-name: GitHubActionScript
3536

37+
3638
- name: CodeGuru Security
3739
uses: aws-actions/codeguru-security@v1
3840
with:
39-
source_path: .
40-
aws_region: ap-southeast-1
41-
fail_on_severity: Critical
41+
source_path: .
42+
aws_region: ap-southeast-1
43+
# fail_on_severity: Critical
4244
- name: Print findings
4345
run: |
44-
ls -l
45-
cat codeguru-security-results.sarif.json
46-
47-
- name: Upload SARIF file as artifact
48-
uses: actions/upload-artifact@v3
49-
with:
50-
name: codeguru-security-results
51-
path: codeguru-security-results.sarif.json
52-
53-
- name: Install dependencies
54-
run: cd action && npm install
55-
56-
- name: Comment on PR with scan results
57-
uses: ./action
46+
ls -l
47+
cat codeguru-security-results.sarif.json
48+
49+
- name: Upload result
50+
uses: github/codeql-action/upload-sarif@v2
5851
with:
59-
token: ${{ secrets.GITHUB_TOKEN }}
60-
repository: ${{ github.repository }}
61-
pull_request_number: ${{ github.event.pull_request.number }}
62-
sarif_path: codeguru-security-results.sarif.json
63-
initial_commit_sha: ${{ github.event.pull_request.head.sha }}
52+
sarif_file: codeguru-security-results.sarif.json

python/src/detectors/code_injection/code_injection.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ def execute_input_noncompliant():
1818
# {fact [email protected] defects=0}
1919
from flask import app
2020

21-
2221
@app.route('/')
2322
def execute_input_compliant():
2423
from flask import request

python/src/detectors/code_readability/code_readability.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
def avoid_complex_comprehension_noncompliant():
66
text = [['bar', 'pie', 'line'],
77
['Rome', 'Madrid', 'Houston'],
8-
['aa', 'bb', 'cc', 'dd']]
8+
['aa', 'bb', 'cc', 'dd', 'ee']]
99
# Noncompliant: list comprehensions with more than two control
1010
# sub expressions are hard to read and maintain.
1111
text_3 = [y.upper() for x in text if len(x) == 3 for y in x

python/src/detectors/dangerous_global_variables/dangerous_global_variables.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ def dangerous_global_noncompliant(w):
77
# from multiple sections.
88
global width
99
width = w
10+
lol = lambda x: x + width
1011
# {/fact}
1112

1213

python/src/detectors/improper_authentication/improper_authentication.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ def improper_authentication_noncompliant(token):
66
import jwt
77
# Noncompliant: The verify flag is set to false.
88
jwt.decode(token, verify=False)
9+
910
# {/fact}
1011

1112

@@ -14,4 +15,5 @@ def improper_authentication_compliant(token):
1415
import jwt
1516
# Compliant: The verify flag is set to true.
1617
jwt.decode(token, verify=True)
18+
1719
# {/fact}

python/src/detectors/improper_error_handling/improper_error_handling.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ def error_handling_continue_noncompliant():
1818
for i in range(10):
1919
try:
2020
int(number)
21+
print("Number is an integer.")
2122
except Exception:
2223
# Noncompliant: has improper error handling.
2324
continue

0 commit comments

Comments
 (0)