Skip to content

Commit 6b845fb

Browse files
committed
feat: using Amazon CodeGuru Security in place of Amazon CodeGuru Reviewer
1 parent 581a6ed commit 6b845fb

File tree

4 files changed

+18
-52
lines changed

4 files changed

+18
-52
lines changed

.codecatalyst/workflows/build.yaml

Lines changed: 11 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -41,50 +41,35 @@ Actions:
4141
# Required - Steps are sequential instructions that run shell commands
4242
Steps:
4343
- Run: ./mvnw -ntp clean
44-
CodeGuruReview:
44+
Code_Security_Review:
4545
DependsOn:
4646
- Mvn_Clean
47-
Identifier: aws/build@v1.0.0
47+
# Identifies the action. Do not modify this value.
48+
Identifier: codecatalyst-labs/scan-with-codeguru-security@v1.0.0
49+
50+
# Specifies the source and/or artifacts to pass to the action as input.
4851
Inputs:
4952
# Optional
5053
Sources:
5154
- WorkflowSource # This specifies that the action requires this Workflow as a source
5255
Outputs:
5356
Reports:
54-
MySAReport:
57+
CodeguruSecuritySAST:
5558
Format: SARIFSA
5659
IncludePaths:
57-
- output/recommendations.sarif.json
58-
# SuccessCriteria:
59-
# StaticAnalysisBug:
60-
# Number: 25
61-
# Severity: HIGH
62-
# StaticAnalysisSecurity:
63-
# Number: 5
64-
# Severity: CRITICAL
65-
# StaticAnalysisQuality:
66-
# Number: 10
67-
# Severity: INFORMATIONAL
60+
- codegurusecurity.sarif
6861
Configuration:
69-
# Required - Steps are sequential instructions that run shell commands
70-
Steps:
71-
# use run-tests $FRAMEWORK to enable advanced testing features such as test case retries
72-
# see info link in shell commands section for more details
73-
- Run: curl -OL https://github.com/aws/aws-codeguru-cli/releases/download/0.1.0/aws-codeguru-cli.zip
74-
- Run: unzip aws-codeguru-cli.zip
75-
- Run: export PATH=$PATH:./aws-codeguru-cli/bin
76-
- Run: ./mvnw -ntp verify
77-
- Run: aws-codeguru-cli --root-dir ./ --build target/classes --src src --output ./output --no-prompt
78-
Compute:
79-
Type: EC2
62+
GenerateReport: true
63+
Path: src
64+
# Required; You can use an environment, AWS account connection, and role to access AWS resources.
8065
Environment:
8166
Connections:
8267
- Role: CodeCatalystTestEnvironmentRole
8368
Name: "123456789012"
8469
Name: TestEnvironment
8570
Mvn_Build_And_Deploy:
8671
DependsOn:
87-
- CodeGuruReview
72+
- Code_Security_Review
8873
# Identifies the action. Do not modify this value.
8974
Identifier: aws/build@v1.0.0
9075
# Specifies the source and/or artifacts to pass to the action as input.

CodeCatalystRolePolicyExample.json

Lines changed: 4 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -13,31 +13,13 @@
1313
},
1414
{
1515
"Action": [
16-
"codeguru-reviewer:ListRepositoryAssociations",
17-
"codeguru-reviewer:AssociateRepository",
18-
"codeguru-reviewer:DescribeRepositoryAssociation",
19-
"codeguru-reviewer:CreateCodeReview",
20-
"codeguru-reviewer:DescribeCodeReview",
21-
"codeguru-reviewer:ListRecommendations",
22-
"iam:CreateServiceLinkedRole"
16+
"codeguru-security:CreateUploadUrl",
17+
"codeguru-security:CreateScan",
18+
"codeguru-security:GetScan",
19+
"codeguru-security:GetFindings"
2320
],
2421
"Resource": "*",
2522
"Effect": "Allow"
26-
},
27-
{
28-
"Action": [
29-
"s3:CreateBucket",
30-
"s3:GetBucket*",
31-
"s3:List*",
32-
"s3:GetObject",
33-
"s3:PutObject",
34-
"s3:DeleteObject"
35-
],
36-
"Resource": [
37-
"arn:aws:s3:::codeguru-reviewer-cli-*",
38-
"arn:aws:s3:::codeguru-reviewer-cli-*/*"
39-
],
40-
"Effect": "Allow"
4123
}
4224
]
4325
}

README.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# CodeCatalyst CI Workflows for Java-SpringBoot Application
22
* This is a simple example of two Continuous Integration workflows created in CodeCatalyst for a Java & Spring-Boot based backend application. The application exposes one API to perform a sum between integers Calculation
33
* The repository includes, inside the `.codecatalyst/workloads` folder, the definition of two CodeCatalyst workflows:
4-
* `build.yaml`: the workflow builds the jar, performs a CodeGuru Reviewer full-repository scan, uploads it to CodeArtifact, builds the Docker images, uploads it to ECR
4+
* `build.yaml`: the workflow builds the jar, performs a CodeGuru Security review, uploads it to CodeArtifact, builds the Docker images, uploads it to ECR
55
* `test.yaml`: the workflow perform unit and coverage tests on code
66

77

@@ -55,16 +55,15 @@ For unit testing we leverage JUnit 5, and for coverage test we leverage Jacoco C
5555
This workflow performs several steps, more specifically:
5656
* Listing files
5757
* Maven Cleaning
58-
* Performs a CodeGuru Reviewer full-repository scan (the report that will be produced will be available for each run)
58+
* Performs a Code Security Review (the report that will be produced will be available for each run)
5959
* Building the jar & uploading it to CodeArtifact repository
6060
* Building the Docker image and uploading it to ECR
6161
6262
![](images/build_workflow.png?raw=true)
6363
6464
## Resources
6565
* [Setting up CodeCatalyst](https://docs.aws.amazon.com/codecatalyst/latest/userguide/setting-up-topnode.html)
66-
* [Getting Started with CodeGuru Reviewer](https://docs.aws.amazon.com/codeguru/latest/reviewer-ug/getting-started-with-guru.html)
67-
* [CodeGuru Reviewer Wrapper CLI](https://github.com/aws/aws-codeguru-cli)
66+
* [Getting Started with CodeGuru Security](https://docs.aws.amazon.com/codeguru/latest/security-api/Welcome.html)
6867
* [Getting started with CodeArtifact](https://docs.aws.amazon.com/codeartifact/latest/ug/getting-started.html)
6968
* [Amazon ECR User Guide](https://docs.aws.amazon.com/AmazonECR/latest/userguide/what-is-ecr.html)
7069

images/build_workflow.png

-13.5 KB
Loading

0 commit comments

Comments
 (0)