Skip to content

Implement platform product improvement backlog#12

Open
tukue wants to merge 6 commits into
mainfrom
feature/platform-product-surface
Open

Implement platform product improvement backlog#12
tukue wants to merge 6 commits into
mainfrom
feature/platform-product-surface

Conversation

@tukue

@tukue tukue commented May 25, 2026

Copy link
Copy Markdown
Owner

No description provided.

@amazon-q-developer amazon-q-developer Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Summary

This PR implements a platform product improvement by introducing a reusable ApiLambdaDynamoService CDK construct, which consolidates Lambda, API Gateway, DynamoDB, and supporting infrastructure into a golden-path pattern. The refactoring improves code reusability and maintainability.

Critical Security Issues (Must Fix Before Merge)

  1. CORS Configuration: The construct allows ALL_ORIGINS in CORS settings, enabling any domain to make cross-origin requests. This creates CSRF vulnerability risks.

  2. VPC Default Security Group: Setting restrictDefaultSecurityGroup: false violates AWS security best practices by allowing unrestricted traffic through the default security group.

  3. DLQ Configuration: The Lambda configuration sets both deadLetterQueueEnabled: true and provides a deadLetterQueue, causing unnecessary resource allocation.

Positive Changes

  • Clean separation of platform constructs into reusable packages
  • Comprehensive test coverage for the new construct
  • Proper validation logic for service naming conventions
  • CI/CD workflow properly updated to trigger on new package paths
  • Maintains security defaults (KMS encryption, IAM auth, VPC isolation)

The architecture refactoring is solid, but the security vulnerabilities must be addressed before merging.


You can now have the agent implement changes and create commits directly on your pull request's source branch. Simply comment with /q followed by your request in natural language to ask the agent to make changes.

authorizationType: apigateway.AuthorizationType.IAM,
},
defaultCorsPreflightOptions: {
allowOrigins: apigateway.Cors.ALL_ORIGINS,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛑 Security Vulnerability: Allowing ALL_ORIGINS in CORS configuration permits any domain to make requests to this API. This enables CSRF attacks and unauthorized cross-origin access.1

Suggested change
allowOrigins: apigateway.Cors.ALL_ORIGINS,
allowOrigins: [''], // Replace with actual allowed origins

Footnotes

  1. CWE-346: Origin Validation Error - https://cwe.mitre.org/data/definitions/346.html

Comment on lines +146 to +147
deadLetterQueueEnabled: true,
deadLetterQueue: this.retryQueue,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Set deadLetterQueueEnabled to false since you're already providing deadLetterQueue. Setting both causes the Lambda service to create an additional DLQ resource that won't be used, wasting resources.

Suggested change
deadLetterQueueEnabled: true,
deadLetterQueue: this.retryQueue,
deadLetterQueueEnabled: false,
deadLetterQueue: this.retryQueue,

new ec2.Vpc(this, 'ServiceVpc', {
maxAzs: 2,
natGateways: 1,
restrictDefaultSecurityGroup: false,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛑 Security Vulnerability: Setting restrictDefaultSecurityGroup to false disables the default security group restrictions, allowing all traffic by default. This violates AWS security best practices and creates an open security group.1

Suggested change
restrictDefaultSecurityGroup: false,
restrictDefaultSecurityGroup: true,

Footnotes

  1. CWE-284: Improper Access Control - https://cwe.mitre.org/data/definitions/284.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant