aws / aws/aws-cdk

aws-lambda-nodejs: CDK Lambda/Inspector incompatibility

Open
#31,493 1 comment 8 reactions 0 assignees View on GitHub
@aws-cdk/aws-lambda @aws-cdk/aws-lambda-nodejs effort/medium feature-request p2
Dominant language
TypeScript
Stars
12.9k
Forks
4.6k
Avg merge
1d 19h
Merged PRs (30d)
74

Description

### Describe the feature

NodejsFunction construct in CDK for provisioning Lambdas uses esbuild to bundle the source code. This is a pattern that many follow which is in accordance with AWS guidance/documentation.

The Inspector service can not get successful scans for these functions as its SBOM generator tool is expecting a node_modules directory to determine the dependencies for the function. This results in an empty 'components' array in the SBOM file (CycloneDX format) and thus Inspector reports no vulnerabilities for the function.

Although it is possible to use a command hook to re-create the required node_modules directory structure, this shouldn't be a requirement for teams to handle by themselves.

### Use Case

The feature request is to improve the compatibility between Lambdas that are provisioned by CDK and the Inspector service. This should have the effect that Inspector can successfully find dependencies for these functions and therefore provide accurate vulnerability information.

### Proposed Solution

_No response_

### Other Information

_No response_

### Acknowledgements

- [ ] I may be able to implement this feature request
- [ ] This feature might incur a breaking change

### CDK version used

2.158.0

### Environment details (OS name and version, etc.)

MacOs

Contributor guide

Open the contributing guide

Research direction

Start with the NodejsFunction construct and its esbuild bundling behavior, then investigate how AWS Inspector generates CycloneDX SBOMs for the resulting Lambda artifacts. Define a supported compatibility approach and verify that Inspector reports dependency components and vulnerabilities rather than an empty components array.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, node.js, typescript
Domain
cloud, devops
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.