Skip to content

Commit 5ea749c

Browse files
codybornclaude
andauthored
fix: grant IntegTests CodeBuild role kms:Decrypt for beta/prod secrets (#677)
The beta/prod integ-test secrets (gpa_url, tapi_api_key, tapi_url, cosigner) are encrypted with a shared customer-managed KMS key (2df28f63-...). CDK auto-grants secretsmanager:GetSecretValue for the env-var secrets but not kms:Decrypt, so the IntegTests CodeBuild build fails resolving them with "AccessDeniedException: Access to KMS is not allowed". This is a pre-existing gap surfaced by the first pipeline run in a while, not the gouda-service-rpc-urls-2 change (already reverted in #676). Add a rolePolicyStatement granting kms:Decrypt on that key to the IntegTests CodeBuildStep (applies to both beta and prod). The key policy already delegates to IAM, so no key-policy change is needed. Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent b9a453d commit 5ea749c

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

bin/app.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { BuildEnvironmentVariableType, BuildSpec, ComputeType } from 'aws-cdk-li
55
import * as sm from 'aws-cdk-lib/aws-secretsmanager'
66

77
import { PipelineNotificationEvents } from 'aws-cdk-lib/aws-codepipeline'
8+
import { PolicyStatement } from 'aws-cdk-lib/aws-iam'
89
import { CodeBuildStep, CodePipeline, CodePipelineSource } from 'aws-cdk-lib/pipelines'
910
import { Construct } from 'constructs'
1011
import dotenv from 'dotenv'
@@ -272,6 +273,18 @@ export class APIPipeline extends Stack {
272273
const testAction = new CodeBuildStep(`${SERVICE_NAME}-IntegTests-${apiStage.stageName}`, {
273274
projectName: `${SERVICE_NAME}-IntegTests-${apiStage.stageName}`,
274275
input: sourceArtifact,
276+
// Several beta/prod integ-test secrets (gpa_url, tapi_api_key, tapi_url,
277+
// cosigner) are encrypted with a shared customer-managed KMS key. CDK
278+
// auto-grants secretsmanager:GetSecretValue for the env-var secrets but
279+
// not kms:Decrypt, so without this the build fails resolving them with
280+
// "AccessDeniedException: Access to KMS is not allowed". The key policy
281+
// delegates to IAM, so this IAM grant is sufficient (no key-policy edit).
282+
rolePolicyStatements: [
283+
new PolicyStatement({
284+
actions: ['kms:Decrypt'],
285+
resources: ['arn:aws:kms:us-east-2:644039819003:key/2df28f63-7535-49e9-892a-8ea0471366bf'],
286+
}),
287+
],
275288
envFromCfnOutputs: {
276289
UNISWAP_API: apiStage.url,
277290
},

0 commit comments

Comments
 (0)