feat(javascript): Add dependency parsing (#4304)

* feat: Add dependency parsing to javascript package locks

Signed-off-by: Tim Olshansky <456103+timols@users.noreply.github.com>

* Bump schema version

Signed-off-by: Tim Olshansky <456103+timols@users.noreply.github.com>

* Add support for yarn and pnpm, excl. yarn v1

Signed-off-by: Tim Olshansky <456103+timols@users.noreply.github.com>

* Add support for dependencies for v1 yarn lock files

Signed-off-by: Tim Olshansky <456103+timols@users.noreply.github.com>

* Ensure schema is correctly generated

Signed-off-by: Tim Olshansky <456103+timols@users.noreply.github.com>

* Fix tests

Signed-off-by: Tim Olshansky <456103+timols@users.noreply.github.com>

* PR feedback

Signed-off-by: Tim Olshansky <456103+timols@users.noreply.github.com>

---------

Signed-off-by: Tim Olshansky <456103+timols@users.noreply.github.com>
This commit is contained in:
Tim Olshansky
2025-11-06 16:03:43 -05:00
committed by GitHub
parent e5711e9b42
commit 4e06a7ab32
18 changed files with 5346 additions and 215 deletions
File diff suppressed because it is too large Load Diff
+61 -3
View File
@@ -1,6 +1,6 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "anchore.io/schema/syft/json/16.0.41/document",
"$id": "anchore.io/schema/syft/json/16.0.42/document",
"$ref": "#/$defs/Document",
"$defs": {
"AlpmDbEntry": {
@@ -1876,15 +1876,48 @@
"integrity": {
"type": "string",
"description": "Integrity is Subresource Integrity hash for verification using standard SRI format (sha512-... or sha1-...). npm changed from SHA-1 to SHA-512 in newer versions. For registry sources this is the integrity from registry, for remote tarballs it's SHA-512 of the file. npm verifies tarball matches this hash before unpacking, throwing EINTEGRITY error if mismatch detected."
},
"dependencies": {
"patternProperties": {
".*": {
"type": "string"
}
},
"type": "object",
"description": "Dependencies is a map of dependencies and their version markers, i.e. \"lodash\": \"^1.0.0\""
}
},
"type": "object",
"required": [
"resolved",
"integrity"
"integrity",
"dependencies"
],
"description": "NpmPackageLockEntry represents a single entry within the \"packages\" section of a package-lock.json file."
},
"JavascriptPnpmLockEntry": {
"properties": {
"resolution": {
"$ref": "#/$defs/PnpmLockResolution",
"description": "Resolution is the resolution information for the package"
},
"dependencies": {
"patternProperties": {
".*": {
"type": "string"
}
},
"type": "object",
"description": "Dependencies is a map of dependencies and their versions"
}
},
"type": "object",
"required": [
"resolution",
"dependencies"
],
"description": "PnpmLockEntry represents a single entry in the \"packages\" section of a pnpm-lock.yaml file."
},
"JavascriptYarnLockEntry": {
"properties": {
"resolved": {
@@ -1894,12 +1927,22 @@
"integrity": {
"type": "string",
"description": "Integrity is Subresource Integrity hash for verification (SRI format)"
},
"dependencies": {
"patternProperties": {
".*": {
"type": "string"
}
},
"type": "object",
"description": "Dependencies is a map of dependencies and their versions"
}
},
"type": "object",
"required": [
"resolved",
"integrity"
"integrity",
"dependencies"
],
"description": "YarnLockEntry represents a single entry section of a yarn.lock file."
},
@@ -2507,6 +2550,9 @@
{
"$ref": "#/$defs/JavascriptNpmPackageLockEntry"
},
{
"$ref": "#/$defs/JavascriptPnpmLockEntry"
},
{
"$ref": "#/$defs/JavascriptYarnLockEntry"
},
@@ -2958,6 +3004,18 @@
],
"description": "PhpPeclEntry represents a single package entry found within php pecl metadata files."
},
"PnpmLockResolution": {
"properties": {
"integrity": {
"type": "string",
"description": "Integrity is Subresource Integrity hash for verification (SRI format)"
}
},
"type": "object",
"required": [
"integrity"
]
},
"PortageDbEntry": {
"properties": {
"installedSize": {