Skip to content

Commit afac2e2

Browse files
committed
Remove public health endpoint
1 parent af1b8d2 commit afac2e2

File tree

1 file changed

+0
-30
lines changed

1 file changed

+0
-30
lines changed

backend/src/iac/backend-stack.ts

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -332,24 +332,6 @@ export class BackendStack extends cdk.Stack {
332332
},
333333
});
334334

335-
// Add health check endpoint without authorization
336-
const healthResource = api.root.addResource('health');
337-
healthResource.addMethod(
338-
'GET',
339-
new apigateway.Integration({
340-
type: apigateway.IntegrationType.HTTP_PROXY,
341-
integrationHttpMethod: 'GET',
342-
options: {
343-
connectionType: apigateway.ConnectionType.VPC_LINK,
344-
vpcLink: vpcLink,
345-
},
346-
uri: `${serviceUrl}/api/health`,
347-
}),
348-
{
349-
authorizationType: apigateway.AuthorizationType.NONE,
350-
},
351-
);
352-
353335
// Add execution role policy to allow API Gateway to access VPC resources
354336
new iam.Role(this, `${appName}APIGatewayVPCRole-${props.environment}`, {
355337
assumedBy: new iam.ServicePrincipal('apigateway.amazonaws.com'),
@@ -365,18 +347,6 @@ export class BackendStack extends cdk.Stack {
365347

366348
const apiResourcePolicy = new iam.PolicyDocument({
367349
statements: [
368-
// Allow all users to access the health endpoint in all stages
369-
// Security note: This is intentionally public as it's a non-sensitive health check endpoint
370-
// that doesn't expose any protected data or functionality
371-
new iam.PolicyStatement({
372-
effect: iam.Effect.ALLOW,
373-
principals: [new iam.AnyPrincipal()],
374-
actions: ['execute-api:Invoke'],
375-
resources: [
376-
`arn:aws:execute-api:${this.region}:${this.account}:${api.restApiId}/*/GET/health`,
377-
],
378-
}),
379-
380350
// Allow only authenticated Cognito users to access all other endpoints
381351
new iam.PolicyStatement({
382352
effect: iam.Effect.ALLOW,

0 commit comments

Comments
 (0)