@@ -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