@@ -72,7 +72,53 @@ located under `./src`. The option `--output ./output` specifies where CodeGuru s
7272CodeGuru produces a Json and Html report.
7373
7474You can provide your own bucket name using the ` --bucket-name ` option. Note that, currently, CodeGuru Reviewer only
75- accepts bucket names that start with the prefix ` codeguru-reviewer- ` .
75+ supports bucket names that start with the prefix ` codeguru-reviewer- ` out of the box. If you choose a different naming
76+ pattern for your bucket you need to:
77+ 1 . Grant ` S3:GetObject ` permissions on their S3 bucket to ` codeguru-reviewer.amazonaws.com `
78+ 2 . If you are using SSE on the S3 bucket, Grant ` KMS::Decrypt ` permissions to ` codeguru-reviewer.amazonaws.com `
79+
80+ ### Using Encryption
81+
82+ CodeGuru Reviewer allows you to use a customer managed key (CMCMK) to encrypt content of the S3 bucket that is used
83+ store source and build artifacts, and all metadata and recommendations that are produced by CodeGuru Reviewer.
84+ First, create a customer owned key in KMS.
85+ You need to grant CodeGuru Reviewer permission to decrypt artifacts with this key by adding the
86+ following Statement to your Key policy:
87+
88+ ``` json
89+ {
90+ "Sid" : " Allow CodeGuru to use the key to decrypt artifact" ,
91+ "Effect" : " Allow" ,
92+ "Principal" : {
93+ "AWS" : " *"
94+ },
95+ "Action" : [
96+ " kms:Decrypt" ,
97+ " kms:DescribeKey"
98+ ],
99+ "Resource" : " *" ,
100+ "Condition" : {
101+ "StringEquals" : {
102+ "kms:ViaService" : " codeguru-reviewer.amazonaws.com" ,
103+ "kms:CallerAccount" : [Your AWS ACCOUNT ID ]
104+ }
105+ }
106+ }
107+ ```
108+ Then, enable server-side for the bucket that you are using with CodeGuru Reviewer. The bucket name should be
109+ ` codeguru-reviewer-cli-[YOUR ACCOUNT]-[YOUR REGION] ` , unless you provided a custom name. For encryption, use the
110+ KMS key that you created in the previous step.
111+
112+ Now you can analyze a repository by providing the KMS key ID (not the alias). For example:
113+ ```
114+ codeguru-reviewer -r ./ -kms 12345678-abcd-abcd-1234-1234567890ab
115+ ```
116+ The first time you analyze a repository with the CodeGuru Reviewer CLI, a new association will be created and
117+ the provided key will be associated with this repository. Fur subsequent scans, you do not need to provide the
118+ key again. Note that you can start using a key after the repository is already associated. If you want to switch
119+ from not using a key to using a key, you need to delete the existing association first in the AWS Console and
120+ then trigger a new scan with the CLI where you provide the key.
121+
76122
77123### Running from CI/CD
78124
0 commit comments