-
Notifications
You must be signed in to change notification settings - Fork 2.6k
feat(nodejs): add a bun.lock analyzer #8897
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Hello @sneaky-potato Don't forget to update |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces support for analyzing bun.lock files for vulnerability scanning by adding a dedicated analyzer for Bun.
- Added support for ftypes.Bun in package URL handling and vulnerability detection.
- Implemented a new bun analyzer with accompanying test cases and integration test fixtures.
- Updated various constants, imports, and routing logic to accommodate Bun analysis.
Reviewed Changes
Copilot reviewed 28 out of 28 changed files in this pull request and generated 1 comment.
Show a summary per file
File | Description |
---|---|
pkg/purl/purl_test.go | Added a new test case for converting bun package URLs. |
pkg/purl/purl.go | Extended URL handling to include ftypes.Bun. |
pkg/fanal/types/const.go | Defined a new constant for bun.lock filenames. |
pkg/fanal/analyzer/language/nodejs/bun/bun_test.go | Added tests for the bun analyzer functionality. |
pkg/fanal/analyzer/language/nodejs/bun/bun.go | Implemented the bun analyzer including file parsing logic. |
pkg/fanal/analyzer/const.go | Added a new analyzer type constant for bun. |
pkg/fanal/analyzer/all/import.go | Included the new bun analyzer in the analyzer registry. |
pkg/detector/library/driver.go | Updated vulnerability detection to recognize Bun. |
integration/testdata/fixtures/repo/bun/package.json | Added fixture package.json for Bun-based repositories. |
integration/testdata/bun.json.golden | Introduced a new golden file for Bun test results. |
integration/repo_test.go | Included integration test case for the Bun analyzer. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sneaky-potato left small comments.
Can you also add a small example of how these changes work in the PR description?
We'll include this example in the release notes.
pkg/fanal/analyzer/language/nodejs/bun/testdata/happy/package.json
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, looks like I didn't hit the submit button...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Left small comments
pkg/fanal/analyzer/language/nodejs/bun/testdata/happy/package.json
Outdated
Show resolved
Hide resolved
Co-authored-by: DmitriyLewen <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sneaky-potato Thanks a lot for your contribution.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your great contribution!
Description
This PR adds an analyzer for
bun.lock
file; thereby adding support to scan repositories developed using bunRun
trivy fs .
in a repository containingbun.lock
file to generate a summary report of vulnerabilities. You may also usetrivy fs . --include-dev-deps
to include scanned information about development dependencies.Related issues
Related PRs
Checklist