Skip to content

Commit 3de8742

Browse files
committed
Address SonarQube warnings
1 parent 5994615 commit 3de8742

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

backend/src/iac/backend-stack.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -342,6 +342,9 @@ export class BackendStack extends cdk.Stack {
342342
},
343343
uri: `${serviceUrl}/api/health`,
344344
}),
345+
{
346+
authorizationType: apigateway.AuthorizationType.NONE,
347+
}
345348
);
346349

347350
// Add execution role policy to allow API Gateway to access VPC resources
@@ -360,6 +363,8 @@ export class BackendStack extends cdk.Stack {
360363
const apiResourcePolicy = new iam.PolicyDocument({
361364
statements: [
362365
// Allow all users to access the health endpoint in all stages
366+
// Security note: This is intentionally public as it's a non-sensitive health check endpoint
367+
// that doesn't expose any protected data or functionality
363368
new iam.PolicyStatement({
364369
effect: iam.Effect.ALLOW,
365370
principals: [new iam.AnyPrincipal()],
@@ -372,6 +377,8 @@ export class BackendStack extends cdk.Stack {
372377
// Allow only authenticated Cognito users to access all other endpoints
373378
new iam.PolicyStatement({
374379
effect: iam.Effect.ALLOW,
380+
// Using AnyPrincipal here but access is restricted by the Cognito condition below
381+
// This is not truly public access as only authenticated users can meet the condition
375382
principals: [new iam.AnyPrincipal()],
376383
actions: ['execute-api:Invoke'],
377384
resources: [`arn:aws:execute-api:${this.region}:${this.account}:${api.restApiId}/*/*`],

0 commit comments

Comments
 (0)