@exodus/stasis 1.0.0-beta.8 → 1.0.0-rc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -2
- package/bin/stasis.js +263 -446
- package/package.json +38 -13
- package/src/audit-corrections.js +11 -42
- package/src/audit.js +256 -212
- package/src/babel.js +119 -82
- package/src/bundle-from-lockfile.js +9 -21
- package/src/bundle-reader.js +24 -8
- package/src/bundle.js +0 -3
- package/src/cmd/build.js +211 -117
- package/src/cmd/bundle-options.js +347 -0
- package/src/cmd/bundle.js +1718 -908
- package/src/cmd/diff.js +1 -4
- package/src/cmd/github-bundle.js +48 -21
- package/src/cmd/output.js +24 -12
- package/src/cmd/sbom.js +6 -9
- package/src/cmd/tokens.js +60 -0
- package/src/define.js +218 -0
- package/src/diff.js +73 -129
- package/src/esbuild.js +0 -4
- package/src/flow.js +27 -0
- package/src/installed.js +265 -0
- package/src/json-stream.js +4 -9
- package/src/loader-mock.js +3 -8
- package/src/loader.js +1 -5
- package/src/loaders/bash.js +43 -120
- package/src/loaders/cargo.js +301 -808
- package/src/loaders/foundry.js +112 -290
- package/src/loaders/paths.js +15 -26
- package/src/loaders/php.js +221 -475
- package/src/loaders/rust.js +518 -1461
- package/src/loaders/solidity-ownership.js +51 -142
- package/src/loaders/solidity.js +42 -188
- package/src/loaders/toml.js +7 -17
- package/src/lockfile.js +0 -3
- package/src/metro-assets.js +41 -0
- package/src/metro-resolver.js +58 -133
- package/src/metro-transformer.js +0 -6
- package/src/metro.js +0 -4
- package/src/mock.js +32 -80
- package/src/parse.js +8 -7
- package/src/prune.js +0 -3
- package/src/resolve-fields.js +170 -235
- package/src/resolve-node.js +33 -46
- package/src/resolve-typescript.js +166 -298
- package/src/rollup.js +0 -4
- package/src/run-installed.js +10 -0
- package/src/sbom.js +70 -97
- package/src/scan.js +241 -278
- package/src/sixel.js +310 -0
- package/src/table.js +95 -0
- package/src/validate-notes.d.ts +19 -0
- package/src/validate-notes.js +72 -0
- package/src/validate.d.ts +159 -0
- package/src/validate.js +1315 -0
- package/src/vfs-bundle/entries.js +54 -46
- package/src/vfs-bundle/github.js +115 -92
- package/src/vfs-bundle/glob.js +379 -0
- package/src/vfs-bundle/lazy.js +99 -0
- package/src/vfs-bundle/prisma.js +235 -105
- package/src/vfs-bundle/soldeer.js +28 -49
- package/src/vfs-bundle/tree.js +434 -259
- package/src/vfs-bundle/yarnclean.js +79 -0
- package/src/vfs-bundle.js +25 -51
- package/src/webpack.js +0 -4
- package/src/why.js +79 -231
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@exodus/stasis",
|
|
3
|
-
"version": "1.0.0-
|
|
3
|
+
"version": "1.0.0-rc.0",
|
|
4
4
|
"description": "File-level source bundles and lockfiles",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -20,7 +20,15 @@
|
|
|
20
20
|
"./prune": "./src/prune.js",
|
|
21
21
|
"./sbom": "./src/sbom.js",
|
|
22
22
|
"./audit-corrections": "./src/audit-corrections.js",
|
|
23
|
+
"./validate": {
|
|
24
|
+
"types": "./src/validate.d.ts",
|
|
25
|
+
"default": "./src/validate.js"
|
|
26
|
+
},
|
|
23
27
|
"./vfs-bundle": "./src/vfs-bundle.js",
|
|
28
|
+
"./validate-notes": {
|
|
29
|
+
"types": "./src/validate-notes.d.ts",
|
|
30
|
+
"default": "./src/validate-notes.js"
|
|
31
|
+
},
|
|
24
32
|
"./logo.svg": "./logo.svg"
|
|
25
33
|
},
|
|
26
34
|
"files": [
|
|
@@ -34,13 +42,18 @@
|
|
|
34
42
|
"src/bundle-from-lockfile.js",
|
|
35
43
|
"src/bundle-reader.js",
|
|
36
44
|
"src/cmd/bundle.js",
|
|
45
|
+
"src/cmd/bundle-options.js",
|
|
37
46
|
"src/cmd/build.js",
|
|
38
47
|
"src/cmd/diff.js",
|
|
39
48
|
"src/cmd/github-bundle.js",
|
|
40
49
|
"src/cmd/output.js",
|
|
41
50
|
"src/cmd/sbom.js",
|
|
51
|
+
"src/cmd/tokens.js",
|
|
52
|
+
"src/define.js",
|
|
42
53
|
"src/diff.js",
|
|
43
54
|
"src/esbuild.js",
|
|
55
|
+
"src/flow.js",
|
|
56
|
+
"src/installed.js",
|
|
44
57
|
"src/json-stream.js",
|
|
45
58
|
"src/loader.js",
|
|
46
59
|
"src/loader-mock.js",
|
|
@@ -55,6 +68,7 @@
|
|
|
55
68
|
"src/loaders/paths.js",
|
|
56
69
|
"src/lockfile.js",
|
|
57
70
|
"src/metro.js",
|
|
71
|
+
"src/metro-assets.js",
|
|
58
72
|
"src/metro-resolver.js",
|
|
59
73
|
"src/metro-transformer.js",
|
|
60
74
|
"src/mock.js",
|
|
@@ -64,14 +78,24 @@
|
|
|
64
78
|
"src/resolve-node.js",
|
|
65
79
|
"src/resolve-typescript.js",
|
|
66
80
|
"src/rollup.js",
|
|
81
|
+
"src/run-installed.js",
|
|
67
82
|
"src/sbom.js",
|
|
83
|
+
"src/sixel.js",
|
|
84
|
+
"src/table.js",
|
|
85
|
+
"src/validate.d.ts",
|
|
86
|
+
"src/validate.js",
|
|
87
|
+
"src/validate-notes.d.ts",
|
|
88
|
+
"src/validate-notes.js",
|
|
68
89
|
"src/scan.js",
|
|
69
90
|
"src/vfs-bundle.js",
|
|
70
91
|
"src/vfs-bundle/entries.js",
|
|
71
92
|
"src/vfs-bundle/github.js",
|
|
93
|
+
"src/vfs-bundle/glob.js",
|
|
94
|
+
"src/vfs-bundle/lazy.js",
|
|
72
95
|
"src/vfs-bundle/prisma.js",
|
|
73
96
|
"src/vfs-bundle/soldeer.js",
|
|
74
97
|
"src/vfs-bundle/tree.js",
|
|
98
|
+
"src/vfs-bundle/yarnclean.js",
|
|
75
99
|
"src/webpack.js",
|
|
76
100
|
"src/why.js"
|
|
77
101
|
],
|
|
@@ -94,19 +118,20 @@
|
|
|
94
118
|
"homepage": "https://github.com/PreventiveMeasures/stasis#readme",
|
|
95
119
|
"dependencies": {
|
|
96
120
|
"@exodus/bytes": "^1.16.0",
|
|
97
|
-
"@exodus/stasis-core": "1.0.0-
|
|
98
|
-
"@exodus/stasis-plugins": "1.0.0-
|
|
99
|
-
"@preventive/archive": "1.
|
|
100
|
-
"@preventive/deptree": "1.
|
|
101
|
-
"@preventive/lockfile": "1.
|
|
102
|
-
"@preventive/
|
|
103
|
-
"@preventive/
|
|
121
|
+
"@exodus/stasis-core": "1.0.0-rc.0",
|
|
122
|
+
"@exodus/stasis-plugins": "1.0.0-rc.0",
|
|
123
|
+
"@preventive/archive": "^1.4.0",
|
|
124
|
+
"@preventive/deptree": "^1.5.0",
|
|
125
|
+
"@preventive/lockfile": "^1.3.0",
|
|
126
|
+
"@preventive/rn": "1.0.0-alpha.6",
|
|
127
|
+
"@preventive/upstream": "^1.6.0",
|
|
128
|
+
"@preventive/vfs": "^1.1.0",
|
|
129
|
+
"flow-remove-types": "^2.322.0",
|
|
104
130
|
"oxc-parser": "^0.152.0"
|
|
105
131
|
},
|
|
106
132
|
"peerDependencies": {
|
|
107
133
|
"@prisma/client-generator-ts": "7.10.0",
|
|
108
|
-
"esbuild": "*"
|
|
109
|
-
"flow-remove-types": "*"
|
|
134
|
+
"esbuild": "*"
|
|
110
135
|
},
|
|
111
136
|
"peerDependenciesMeta": {
|
|
112
137
|
"@prisma/client-generator-ts": {
|
|
@@ -114,9 +139,9 @@
|
|
|
114
139
|
},
|
|
115
140
|
"esbuild": {
|
|
116
141
|
"optional": true
|
|
117
|
-
},
|
|
118
|
-
"flow-remove-types": {
|
|
119
|
-
"optional": true
|
|
120
142
|
}
|
|
143
|
+
},
|
|
144
|
+
"optionalDependencies": {
|
|
145
|
+
"minimatch": "^10.2.6"
|
|
121
146
|
}
|
|
122
147
|
}
|
package/src/audit-corrections.js
CHANGED
|
@@ -1,22 +1,7 @@
|
|
|
1
1
|
import { satisfies, valid } from '@preventive/upstream/semver.js'
|
|
2
2
|
|
|
3
|
-
//
|
|
4
|
-
//
|
|
5
|
-
// target is one of these files is not evidence the package is really used, so a
|
|
6
|
-
// package pulled in only through corrected files is skipped by the audit (see
|
|
7
|
-
// collectPackagesFromFile) -- none of its real code ships, so no advisory applies.
|
|
8
|
-
//
|
|
9
|
-
// Exported as `@exodus/stasis/audit-corrections`, as plain data, so a tool that
|
|
10
|
-
// lays out or reads packages without stasis -- a tree @preventive/deptree builds,
|
|
11
|
-
// a server reading bundles -- can apply the same corrections without its own copy.
|
|
12
|
-
// Each entry names a package of `ecosystem`, one audit-irrelevant `file` (relative
|
|
13
|
-
// to the module dir), `range` -- the semver range VERIFIED to match the rationale --
|
|
14
|
-
// and `integrity`, the sha512 of every distinct copy of `file` the versions in
|
|
15
|
-
// `range` publish, as a stasis lockfile records a file: a holder of the file's bytes
|
|
16
|
-
// can tell they are one of the copies verified. The correction never applies outside
|
|
17
|
-
// the range: a release could change the file, so the range is widened only after
|
|
18
|
-
// re-checking the file in the new versions, adding any new copy's integrity. Frozen,
|
|
19
|
-
// as the audit reads these very objects.
|
|
3
|
+
// Files that are no evidence of a package's real code: one shipped only as these is not audited. Each `range` is
|
|
4
|
+
// VERIFIED, widened only after re-checking `file`; `integrity` is the sha512 of each copy of it there, as a lockfile has it.
|
|
20
5
|
export const CORRECTIONS = Object.freeze([
|
|
21
6
|
{
|
|
22
7
|
// ws's browser build is a noop stub -- `module.exports = function () { throw
|
|
@@ -55,42 +40,26 @@ export const CORRECTIONS = Object.freeze([
|
|
|
55
40
|
},
|
|
56
41
|
].map((correction) => Object.freeze({ ...correction, integrity: Object.freeze(correction.integrity) })))
|
|
57
42
|
|
|
58
|
-
//
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
function isCorrectedFile(name, version, rel, ecosystem) {
|
|
62
|
-
for (const correction of CORRECTIONS) {
|
|
63
|
-
if (correction.ecosystem !== ecosystem || correction.name !== name || correction.file !== rel) continue
|
|
64
|
-
if (valid(version) && satisfies(version, correction.range)) return true
|
|
65
|
-
}
|
|
66
|
-
return false
|
|
67
|
-
}
|
|
43
|
+
// An unknown or unparsable version is never corrected: fail closed, the package stays audited.
|
|
44
|
+
const isCorrectedFile = (name, version, rel, ecosystem) => CORRECTIONS.some((correction) => correction.ecosystem === ecosystem && correction.name === name
|
|
45
|
+
&& correction.file === rel && valid(version) && satisfies(version, correction.range))
|
|
68
46
|
|
|
69
|
-
// A manifest
|
|
70
|
-
//
|
|
71
|
-
// packages' manifests for Haste/asset resolution) and consumers record them
|
|
72
|
-
// alongside bundled files, but no package code ships through one. So too for the
|
|
73
|
-
// manifests the other ecosystems' bundles carry beside a dependency's code
|
|
74
|
-
// (--cargo-manifests, --manifests): its Cargo.toml and the checksums cargo vendored
|
|
75
|
-
// it with (a registry's copy, a git checkout's, or one whose source isn't known),
|
|
76
|
-
// its composer.json, a Solidity dependency's foundry.toml and remappings.
|
|
47
|
+
// A manifest is never code, though the graph records resolver reads of `package.json` (react-native scans its siblings'
|
|
48
|
+
// for Haste), nor are those other ecosystems' bundles carry (--cargo-manifests, --manifests).
|
|
77
49
|
const CARGO_MANIFESTS = new Set(['Cargo.toml', 'Cargo.lock', '.cargo-checksum.json'])
|
|
50
|
+
const FOUNDRY_MANIFESTS = new Set(['package.json', 'foundry.toml', 'remappings.txt', 'soldeer.toml'])
|
|
78
51
|
const MANIFESTS = {
|
|
79
52
|
npm: new Set(['package.json']),
|
|
80
53
|
cargo: CARGO_MANIFESTS,
|
|
81
54
|
'cargo-git': CARGO_MANIFESTS,
|
|
82
55
|
'cargo-unknown': CARGO_MANIFESTS,
|
|
83
56
|
composer: new Set(['composer.json', 'composer.lock']),
|
|
84
|
-
soldeer:
|
|
85
|
-
github:
|
|
57
|
+
soldeer: FOUNDRY_MANIFESTS,
|
|
58
|
+
github: FOUNDRY_MANIFESTS,
|
|
86
59
|
}
|
|
87
60
|
const isManifest = (rel, ecosystem) => MANIFESTS[ecosystem]?.has(rel.slice(rel.lastIndexOf('/') + 1)) ?? false
|
|
88
61
|
|
|
89
|
-
//
|
|
90
|
-
// `ecosystem` (npm by default)? This is the one rule every audit surface shares --
|
|
91
|
-
// package presence, the reason column, and the --why chain graph all count a file
|
|
92
|
-
// (or an edge targeting it) only when it passes. Manifests never do; CORRECTIONS'
|
|
93
|
-
// files don't within their verified range.
|
|
62
|
+
// The one rule package presence, the reason column and the --why graph share.
|
|
94
63
|
export function isEvidenceFile(name, version, rel, ecosystem = 'npm') {
|
|
95
64
|
return !isManifest(rel, ecosystem) && !isCorrectedFile(name, version, rel, ecosystem)
|
|
96
65
|
}
|