Node.JS package.json parser rejects valid names with slashes (e.g. "rxjs/ajax")
#10599
-
QuestionI've encountered a problem with Trivy's Node.js Example// rxjs/ajax/package.json
{
"name": "rxjs/ajax",
"typings": "./index.d.ts",
"main": "./index.js"
}Currently, Trivy fails to parse these packages with the following error: CauseLooking at the code in parse.go, the regex used in var nameRegexp = regexp.MustCompile(`^(@[A-Za-z0-9-._]+/)?[A-Za-z0-9-._]+$`)This only allows for a single optional scope and then the package name, but prohibits package names containing a slash. While NPM's official documentation prohibits "non-URL-safe characters" in published packages (see RFC 3986, Section 2.3), such names do exist in real-world Node.js projects, particularly in RxJS v6 (maybe even v7) distribution within Steps to reproduce
Expected BehaviorTrivy should gracefully handle package names with slashes when parsing ReferencesTargetFilesystem ScannerVulnerability Output FormatJSON ModeStandalone Operating SystemWindows Server VersionShould be either 0.70 or 0.69 |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
|
Thanks for the report!
According to the npm docs, name format requirements only apply when publishing to the registry. Since this That said, the error |
Beta Was this translation helpful? Give feedback.
-
|
Track #10607 |
Beta Was this translation helpful? Give feedback.
Track #10607