@cdxgen/cdxgen 13.2.0 → 13.3.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 +28 -12
- package/bin/cdxgen.js +227 -119
- package/bin/evinse.js +5 -0
- package/bin/sign.js +88 -14
- package/bin/tracebom.js +64 -4
- package/bin/validate.js +29 -7
- package/bin/verify.js +79 -39
- package/data/remediations.json +24 -0
- package/lib/cli/bomAssembly.js +105 -15
- package/lib/cli/cliOptions.js +93 -1
- package/lib/cli/index.js +43 -4
- package/lib/cli/jsBom.js +49 -24
- package/lib/cli/jvmBom.js +46 -12
- package/lib/cli/managedBom.js +112 -41
- package/lib/cli/nativeBom.js +125 -14
- package/lib/core/env.js +5 -6
- package/lib/core/fs.js +174 -6
- package/lib/core/metadataProperties.js +97 -0
- package/lib/core/projectConfig.js +31 -4
- package/lib/ecosystems/bunutils.js +269 -101
- package/lib/ecosystems/caxa.js +434 -2
- package/lib/ecosystems/cmakeResolver.js +66 -0
- package/lib/ecosystems/cppEvidence.js +64 -31
- package/lib/ecosystems/ecosystems.js +19 -8
- package/lib/ecosystems/gradleutils.js +42 -7
- package/lib/ecosystems/jsEvidence.js +19 -20
- package/lib/ecosystems/kosi.js +10 -3
- package/lib/ecosystems/npmutils.js +110 -9
- package/lib/ecosystems/parsers-dotnet.js +51 -10
- package/lib/ecosystems/parsers-go.js +47 -9
- package/lib/ecosystems/parsers-js.js +171 -50
- package/lib/ecosystems/parsers-misc.js +747 -161
- package/lib/ecosystems/parsers-python.js +26 -14
- package/lib/ecosystems/parsers-rust.js +24 -18
- package/lib/ecosystems/rubyutils.js +1426 -166
- package/lib/ecosystems/rusi.js +32 -1
- package/lib/evinser/evinser.js +436 -128
- package/lib/evinser/swiftsem.js +1914 -302
- package/lib/helpers/bomSigner.js +652 -221
- package/lib/inventory/atomUtils.js +568 -31
- package/lib/inventory/cdxrs.js +103 -12
- package/lib/inventory/depsUtils.js +183 -11
- package/lib/inventory/display.js +4 -5
- package/lib/inventory/dosai.js +550 -13
- package/lib/inventory/dynamic.js +39 -1
- package/lib/inventory/evidenceUtils.js +14 -6
- package/lib/inventory/fetchBatch.js +116 -17
- package/lib/inventory/protobom.js +8 -1
- package/lib/inventory/purl.js +152 -3
- package/lib/inventory/sbomDocument.js +2 -70
- package/lib/inventory/source.js +37 -19
- package/lib/inventory/traceRunner.js +210 -21
- package/lib/managers/binary.js +115 -24
- package/lib/managers/docker.js +440 -20
- package/lib/managers/oci.js +39 -1
- package/lib/parsers/cmakeLists.js +452 -0
- package/lib/parsers/largeJson.js +454 -0
- package/lib/parsers/npmrc.js +19 -1
- package/lib/stages/postgen/postgen.js +68 -15
- package/lib/validator/bomValidator.js +6 -16
- package/lib/validator/index.js +48 -10
- package/lib/validator/reporters/console.js +3 -0
- package/lib/validator/reporters/json.js +1 -0
- package/lib/validator/reporters/sarif.js +7 -0
- package/package.json +20 -20
- package/types/lib/cli/bomAssembly.d.ts +2 -1
- package/types/lib/cli/bomAssembly.d.ts.map +1 -1
- package/types/lib/cli/cliOptions.d.ts +33 -1
- package/types/lib/cli/cliOptions.d.ts.map +1 -1
- package/types/lib/cli/index.d.ts.map +1 -1
- package/types/lib/cli/jsBom.d.ts.map +1 -1
- package/types/lib/cli/jvmBom.d.ts.map +1 -1
- package/types/lib/cli/managedBom.d.ts.map +1 -1
- package/types/lib/cli/nativeBom.d.ts.map +1 -1
- package/types/lib/core/env.d.ts.map +1 -1
- package/types/lib/core/fs.d.ts +55 -0
- package/types/lib/core/fs.d.ts.map +1 -1
- package/types/lib/core/metadataProperties.d.ts +39 -0
- package/types/lib/core/metadataProperties.d.ts.map +1 -0
- package/types/lib/core/projectConfig.d.ts +6 -2
- package/types/lib/core/projectConfig.d.ts.map +1 -1
- package/types/lib/ecosystems/bunutils.d.ts +12 -5
- package/types/lib/ecosystems/bunutils.d.ts.map +1 -1
- package/types/lib/ecosystems/caxa.d.ts +14 -0
- package/types/lib/ecosystems/caxa.d.ts.map +1 -1
- package/types/lib/ecosystems/cmakeResolver.d.ts +23 -0
- package/types/lib/ecosystems/cmakeResolver.d.ts.map +1 -1
- package/types/lib/ecosystems/cppEvidence.d.ts +1 -1
- package/types/lib/ecosystems/cppEvidence.d.ts.map +1 -1
- package/types/lib/ecosystems/ecosystems.d.ts.map +1 -1
- package/types/lib/ecosystems/golem.d.ts.map +1 -1
- package/types/lib/ecosystems/gradleutils.d.ts +20 -4
- package/types/lib/ecosystems/gradleutils.d.ts.map +1 -1
- package/types/lib/ecosystems/jsEvidence.d.ts +5 -2
- package/types/lib/ecosystems/jsEvidence.d.ts.map +1 -1
- package/types/lib/ecosystems/kosi.d.ts +13 -0
- package/types/lib/ecosystems/kosi.d.ts.map +1 -1
- package/types/lib/ecosystems/npmutils.d.ts +42 -0
- package/types/lib/ecosystems/npmutils.d.ts.map +1 -1
- package/types/lib/ecosystems/parsers-dotnet.d.ts.map +1 -1
- package/types/lib/ecosystems/parsers-go.d.ts +10 -0
- package/types/lib/ecosystems/parsers-go.d.ts.map +1 -1
- package/types/lib/ecosystems/parsers-js.d.ts +10 -4
- package/types/lib/ecosystems/parsers-js.d.ts.map +1 -1
- package/types/lib/ecosystems/parsers-misc.d.ts +67 -3
- package/types/lib/ecosystems/parsers-misc.d.ts.map +1 -1
- package/types/lib/ecosystems/parsers-python.d.ts.map +1 -1
- package/types/lib/ecosystems/parsers-rust.d.ts.map +1 -1
- package/types/lib/ecosystems/pythonutils.d.ts +1 -1
- package/types/lib/ecosystems/rubyutils.d.ts +143 -2
- package/types/lib/ecosystems/rubyutils.d.ts.map +1 -1
- package/types/lib/ecosystems/rusi.d.ts +13 -0
- package/types/lib/ecosystems/rusi.d.ts.map +1 -1
- package/types/lib/evinser/evinser.d.ts +59 -9
- package/types/lib/evinser/evinser.d.ts.map +1 -1
- package/types/lib/evinser/swiftsem.d.ts +280 -15
- package/types/lib/evinser/swiftsem.d.ts.map +1 -1
- package/types/lib/helpers/bomSigner.d.ts +106 -13
- package/types/lib/helpers/bomSigner.d.ts.map +1 -1
- package/types/lib/inventory/atomUtils.d.ts +145 -3
- package/types/lib/inventory/atomUtils.d.ts.map +1 -1
- package/types/lib/inventory/cdxrs.d.ts +8 -3
- package/types/lib/inventory/cdxrs.d.ts.map +1 -1
- package/types/lib/inventory/depsUtils.d.ts +15 -0
- package/types/lib/inventory/depsUtils.d.ts.map +1 -1
- package/types/lib/inventory/display.d.ts.map +1 -1
- package/types/lib/inventory/dosai.d.ts +64 -1
- package/types/lib/inventory/dosai.d.ts.map +1 -1
- package/types/lib/inventory/dynamic.d.ts.map +1 -1
- package/types/lib/inventory/evidenceUtils.d.ts.map +1 -1
- package/types/lib/inventory/fetchBatch.d.ts.map +1 -1
- package/types/lib/inventory/plugins.d.ts.map +1 -1
- package/types/lib/inventory/protobom.d.ts.map +1 -1
- package/types/lib/inventory/purl.d.ts +71 -2
- package/types/lib/inventory/purl.d.ts.map +1 -1
- package/types/lib/inventory/sbomDocument.d.ts.map +1 -1
- package/types/lib/inventory/source.d.ts.map +1 -1
- package/types/lib/inventory/traceRunner.d.ts +47 -1
- package/types/lib/inventory/traceRunner.d.ts.map +1 -1
- package/types/lib/managers/binary.d.ts +30 -1
- package/types/lib/managers/binary.d.ts.map +1 -1
- package/types/lib/managers/docker.d.ts +29 -0
- package/types/lib/managers/docker.d.ts.map +1 -1
- package/types/lib/managers/oci.d.ts +14 -0
- package/types/lib/managers/oci.d.ts.map +1 -1
- package/types/lib/parsers/cmakeLists.d.ts +76 -0
- package/types/lib/parsers/cmakeLists.d.ts.map +1 -0
- package/types/lib/parsers/largeJson.d.ts +52 -0
- package/types/lib/parsers/largeJson.d.ts.map +1 -0
- package/types/lib/parsers/npmrc.d.ts +5 -0
- package/types/lib/parsers/npmrc.d.ts.map +1 -1
- package/types/lib/stages/postgen/postgen.d.ts.map +1 -1
- package/types/lib/validator/bomValidator.d.ts.map +1 -1
- package/types/lib/validator/index.d.ts +10 -1
- package/types/lib/validator/index.d.ts.map +1 -1
- package/types/lib/validator/reporters/console.d.ts.map +1 -1
- package/types/lib/validator/reporters/json.d.ts.map +1 -1
- package/types/lib/validator/reporters/sarif.d.ts.map +1 -1
|
@@ -1,11 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Convert a SwiftPM target or package name into its module name.
|
|
3
|
+
*
|
|
4
|
+
* @param {String} name Target or package name
|
|
5
|
+
* @returns {String} Module name
|
|
6
|
+
*/
|
|
7
|
+
export declare function toModuleName(name: string): string;
|
|
8
|
+
/**
|
|
9
|
+
* Decide whether a module belongs to tests or to an aggregate product and so
|
|
10
|
+
* must not contribute build symbols or semantic context.
|
|
11
|
+
*
|
|
12
|
+
* @param {String} moduleName Module name
|
|
13
|
+
* @returns {boolean} `true` when the module should be skipped
|
|
14
|
+
*/
|
|
15
|
+
export declare function isTestOrAggregateModule(moduleName: string): boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Parse the JSON printed by `swift -print-target-info`.
|
|
18
|
+
*
|
|
19
|
+
* `paths.runtimeResourcePath` is `<toolchain>/usr/lib/swift` for every
|
|
20
|
+
* toolchain layout (Xcode, `.xctoolchain` bundles, swiftly, Linux tarballs),
|
|
21
|
+
* so it names the toolchain that actually compiles the project.
|
|
22
|
+
*
|
|
23
|
+
* @param {Object} targetInfo Parsed `-print-target-info` output
|
|
24
|
+
* @returns {undefined|Object} `{ compilerVersion, triple, runtimeResourcePath, toolchainDir }`
|
|
25
|
+
*/
|
|
26
|
+
export declare function parseSwiftTargetInfo(targetInfo: Object): undefined | Object;
|
|
27
|
+
/**
|
|
28
|
+
* Identify the toolchain that `swift` resolves to inside a project directory.
|
|
29
|
+
*
|
|
30
|
+
* The query runs in the project directory because toolchain managers such as
|
|
31
|
+
* swiftly select the toolchain per directory (`.swift-version`), so the
|
|
32
|
+
* compiler that builds a project can differ from the one on the PATH of the
|
|
33
|
+
* calling process.
|
|
34
|
+
*
|
|
35
|
+
* @param {String} basePath Project directory
|
|
36
|
+
* @returns {undefined|Object} Toolchain details, see parseSwiftTargetInfo
|
|
37
|
+
*/
|
|
38
|
+
export declare function resolveSwiftToolchain(basePath: string): undefined | Object;
|
|
39
|
+
/**
|
|
40
|
+
* Environment overrides that make sourcekitten load the SourceKit of the
|
|
41
|
+
* toolchain that builds the project.
|
|
42
|
+
*
|
|
43
|
+
* Without guidance sourcekitten uses the toolchain of the selected Xcode (or
|
|
44
|
+
* the `swift` found on the PATH on Linux). SourceKit cannot load modules
|
|
45
|
+
* produced by a different compiler version, so every reference to a
|
|
46
|
+
* dependency then goes unresolved. On macOS sourcekitten honours
|
|
47
|
+
* `XCODE_DEFAULT_TOOLCHAIN_OVERRIDE` ahead of `xcrun`; on Linux it honours
|
|
48
|
+
* `LINUX_SOURCEKIT_LIB_PATH`. Explicitly configured values always win.
|
|
49
|
+
*
|
|
50
|
+
* @param {Object} toolchain Toolchain details from resolveSwiftToolchain
|
|
51
|
+
* @param {String} [platform] Platform name, defaults to process.platform
|
|
52
|
+
* @returns {undefined|Object} Environment overrides for sourcekitten
|
|
53
|
+
*/
|
|
54
|
+
export declare function sourcekittenEnvForToolchain(toolchain: Object, platform?: string): undefined | Object;
|
|
1
55
|
/**
|
|
2
56
|
* Retrieve the structure information of a .swift file in json format
|
|
3
57
|
*
|
|
4
58
|
* @param {String} filePath Path to .swift file
|
|
59
|
+
* @param {Object} [env] Environment overrides for sourcekitten
|
|
5
60
|
*
|
|
6
61
|
* @returns {undefined|Object} JSON representation of the swift file or undefined.
|
|
7
62
|
*/
|
|
8
|
-
export declare function getStructure(filePath: string): undefined | Object;
|
|
63
|
+
export declare function getStructure(filePath: string, env?: Object): undefined | Object;
|
|
9
64
|
/**
|
|
10
65
|
* Parse the data from the structure command
|
|
11
66
|
*
|
|
@@ -13,35 +68,150 @@ export declare function getStructure(filePath: string): undefined | Object;
|
|
|
13
68
|
* @returns {Object|undefined} Parsed value
|
|
14
69
|
*/
|
|
15
70
|
export declare function parseStructure(structureJson: Object): Object | undefined;
|
|
71
|
+
/**
|
|
72
|
+
* Split a Swift command line, as printed by a verbose build or given in an
|
|
73
|
+
* environment variable, into arguments.
|
|
74
|
+
*
|
|
75
|
+
* Paths on Windows use backslash separators, so a backslash there is literal
|
|
76
|
+
* unless it precedes a double quote (the `CommandLineToArgvW` rules). Single
|
|
77
|
+
* quotes, which SwiftPM uses to quote arguments on every platform, keep their
|
|
78
|
+
* content literal. Elsewhere shell quoting applies.
|
|
79
|
+
*
|
|
80
|
+
* @param {String} commandString Command line
|
|
81
|
+
* @param {String} [platform] Platform name, defaults to process.platform
|
|
82
|
+
* @returns {Array<String>} Arguments
|
|
83
|
+
*/
|
|
84
|
+
export declare function splitSwiftCommandArgs(commandString: string, platform?: string): Array<string>;
|
|
16
85
|
/**
|
|
17
86
|
* Method to perform swift build in verbose mode.
|
|
18
87
|
*
|
|
88
|
+
* `SWIFT_BUILD_ARGS` adds arguments to the build, for example
|
|
89
|
+
* `--build-system native` to use the llbuild engine with Swift 6.4.
|
|
90
|
+
*
|
|
19
91
|
* @param {String} basePath Path
|
|
20
92
|
* @returns {undefined|String} Verbose build output
|
|
21
93
|
*/
|
|
22
94
|
export declare function verboseBuild(basePath: string): undefined | string;
|
|
23
95
|
/**
|
|
24
|
-
*
|
|
96
|
+
* Reduce one module's compiler invocation to the arguments that affect how
|
|
97
|
+
* its sources are type-checked.
|
|
98
|
+
*
|
|
99
|
+
* Only known argument classes are kept, so outputs, incremental build
|
|
100
|
+
* bookkeeping, response files, and flags a SourceKit build may not know are
|
|
101
|
+
* dropped. The order of the kept arguments is preserved, which keeps paired
|
|
102
|
+
* clang arguments such as `-Xcc -I -Xcc <path>` intact. The module cache is
|
|
103
|
+
* dropped as well: the build's cache may hold modules of other toolchains.
|
|
104
|
+
*
|
|
105
|
+
* @param {Array<String>} tokens Tokenized compiler invocation
|
|
106
|
+
* @returns {Array<String>} Sanitized compiler arguments
|
|
107
|
+
*/
|
|
108
|
+
export declare function sanitizeSwiftModuleArgs(tokens: Array<string>): Array<string>;
|
|
109
|
+
/**
|
|
110
|
+
* Extract the per-module compiler invocations printed by a verbose swift
|
|
111
|
+
* build.
|
|
112
|
+
*
|
|
113
|
+
* Both engines print one driver invocation per module that carries
|
|
114
|
+
* `-module-name`: llbuild prints `swiftc ... -module-name X ... @sources`,
|
|
115
|
+
* while the Swift Build engine prints `builtin-SwiftDriver -- swiftc ...
|
|
116
|
+
* -module-name X ... @<target>.SwiftFileList`. llbuild also prints the
|
|
117
|
+
* frontend jobs of each module, which are only used when no driver line is
|
|
118
|
+
* found. Package manifest and plugin compilations are skipped.
|
|
119
|
+
*
|
|
120
|
+
* @param {String} buildOutput Verbose build output
|
|
121
|
+
* @param {String} [platform] Platform that printed the output, which decides
|
|
122
|
+
* its quoting rules; defaults to process.platform
|
|
123
|
+
* @returns {Object} Map of module name to `{ args, sources, isDriver }`
|
|
124
|
+
*/
|
|
125
|
+
export declare function parseSwiftModuleInvocations(buildOutput: string, platform?: string): Object;
|
|
126
|
+
/**
|
|
127
|
+
* Parse the llbuild engine's build description
|
|
128
|
+
* (`.build/<triple>/debug/description.json`).
|
|
129
|
+
*
|
|
130
|
+
* Its `swiftCommands` record every Swift module the build compiled, with the
|
|
131
|
+
* exact source list and compiler arguments. Host-tool variants
|
|
132
|
+
* (`...-tool.module`, built for macros and plugins) are used only when a
|
|
133
|
+
* module has no regular variant.
|
|
134
|
+
*
|
|
135
|
+
* @param {Object} descriptionJson Parsed description.json
|
|
136
|
+
* @returns {Object} Map of module name to `{ args, sources, isDriver }`
|
|
137
|
+
*/
|
|
138
|
+
export declare function parseSwiftBuildDescription(descriptionJson: Object): Object;
|
|
139
|
+
/**
|
|
140
|
+
* Merge the sanitized arguments of several modules into one argument list,
|
|
141
|
+
* used when a source file cannot be attributed to a single module. The first
|
|
142
|
+
* module's single-value flags win, include paths accumulate, and `-Xcc`
|
|
143
|
+
* values are merged per clang argument group.
|
|
144
|
+
*
|
|
145
|
+
* @param {Array<Array<String>>} argLists Sanitized argument lists, most relevant first
|
|
146
|
+
* @returns {Array<String>} Merged arguments
|
|
147
|
+
*/
|
|
148
|
+
export declare function mergeSwiftModuleArgs(argLists: Array<Array<string>>): Array<string>;
|
|
149
|
+
/**
|
|
150
|
+
* Method to parse the verbose swift build output to identify key compiler
|
|
151
|
+
* parameters. The arguments of the root package's modules are merged, or of
|
|
152
|
+
* every module when the root modules are unknown.
|
|
25
153
|
*
|
|
26
154
|
* @param {String} buildOutput Verbose build output
|
|
27
|
-
* @
|
|
155
|
+
* @param {Array<String>|Set<String>} [rootModules] Module names of the root package
|
|
156
|
+
* @returns {Object} `{ params, compilerArgs }` where params maps module names to their arguments
|
|
28
157
|
*/
|
|
29
|
-
export declare function extractCompilerParamsFromBuild(buildOutput: string): Object;
|
|
158
|
+
export declare function extractCompilerParamsFromBuild(buildOutput: string, rootModules?: Array<string> | Set<string>): Object;
|
|
30
159
|
/**
|
|
31
160
|
* Method to index a swift file and extract metadata
|
|
32
161
|
*
|
|
33
162
|
* @param {String} filePath Path to .swift file
|
|
34
|
-
* @param {String|Array<string>} compilerArgs Compiler arguments
|
|
163
|
+
* @param {String|Array<string>} compilerArgs Compiler arguments. They should
|
|
164
|
+
* list every source of the file's module so that references across files
|
|
165
|
+
* resolve; the file itself is appended when missing.
|
|
166
|
+
* @param {Object} [env] Environment overrides for sourcekitten
|
|
35
167
|
* @returns {undefined|Object} metadata
|
|
36
168
|
*/
|
|
37
|
-
export declare function index(filePath: string, compilerArgs: string | Array<string
|
|
169
|
+
export declare function index(filePath: string, compilerArgs: string | Array<string>, env?: Object): undefined | Object;
|
|
38
170
|
/**
|
|
39
171
|
* Parse the data from the index command
|
|
40
172
|
*
|
|
173
|
+
* Besides the symbol names and lines, the unified symbol resolution (USR) of
|
|
174
|
+
* every indexed entity is recorded with its lines. A USR identifies the
|
|
175
|
+
* declaration the compiler resolved a reference to, including the module
|
|
176
|
+
* that declares it, which is what attributes a usage to a dependency.
|
|
177
|
+
*
|
|
41
178
|
* @param {Object} indexJson Json from the index command
|
|
42
179
|
* @returns {Object|undefined} Parsed value
|
|
43
180
|
*/
|
|
44
181
|
export declare function parseIndex(indexJson: Object): Object | undefined;
|
|
182
|
+
/**
|
|
183
|
+
* Identify the module that declares an entity from its demangled name.
|
|
184
|
+
*
|
|
185
|
+
* Qualified names start with the module (`Yams.dump(object:...)`), and
|
|
186
|
+
* members declared in extensions carry the extending module
|
|
187
|
+
* (`(extension in Yams):Swift.String.yaml`), which is what a usage of the
|
|
188
|
+
* member depends on.
|
|
189
|
+
*
|
|
190
|
+
* @param {String} demangled Output of `swift demangle --compact`
|
|
191
|
+
* @returns {undefined|String} Module name
|
|
192
|
+
*/
|
|
193
|
+
export declare function moduleFromDemangledName(demangled: string): undefined | string;
|
|
194
|
+
/**
|
|
195
|
+
* Identify the module of a mangled Swift name without the demangler. Only the
|
|
196
|
+
* leading module context is decoded, so extension members are attributed to
|
|
197
|
+
* the extended type's module.
|
|
198
|
+
*
|
|
199
|
+
* @param {String} mangled Mangled name starting with `$s`
|
|
200
|
+
* @returns {undefined|String} Module name
|
|
201
|
+
*/
|
|
202
|
+
export declare function moduleFromMangledPrefix(mangled: string): undefined | string;
|
|
203
|
+
/**
|
|
204
|
+
* Identify the declaring module of each USR.
|
|
205
|
+
*
|
|
206
|
+
* Swift USRs are demangled in one batch with `swift demangle`; clang module
|
|
207
|
+
* references (`c:@M@<module>`, emitted for import declarations) carry the
|
|
208
|
+
* module name directly. Other clang USRs name no module and are skipped.
|
|
209
|
+
*
|
|
210
|
+
* @param {Array<String>} usrs USRs to resolve
|
|
211
|
+
* @param {String} basePath Directory to run the demangler in
|
|
212
|
+
* @returns {Map<String, String>} USR to module name
|
|
213
|
+
*/
|
|
214
|
+
export declare function resolveUsrModules(usrs: Array<string>, basePath: string): Map<string, string>;
|
|
45
215
|
/**
|
|
46
216
|
* Method to execute dump-package package command.
|
|
47
217
|
*
|
|
@@ -61,9 +231,10 @@ export declare function parseDumpPackage(dumpJson: Object): Object | undefined;
|
|
|
61
231
|
*
|
|
62
232
|
* @param {String} moduleName Module name
|
|
63
233
|
* @param {String|Array<string>} compilerArgs Compiler arguments extracted from verbose build log
|
|
234
|
+
* @param {Object} [env] Environment overrides for sourcekitten
|
|
64
235
|
* @returns {undefined|Object} JSON representation of the swift module or undefined.
|
|
65
236
|
*/
|
|
66
|
-
export declare function moduleInfo(moduleName: string, compilerArgs: string | Array<string
|
|
237
|
+
export declare function moduleInfo(moduleName: string, compilerArgs: string | Array<string>, env?: Object): undefined | Object;
|
|
67
238
|
/**
|
|
68
239
|
* Parse the data from module-info command to replicate the swift interface
|
|
69
240
|
*
|
|
@@ -72,32 +243,126 @@ export declare function moduleInfo(moduleName: string, compilerArgs: string | Ar
|
|
|
72
243
|
*/
|
|
73
244
|
export declare function parseModuleInfo(moduleInfoJson: Object): Object | undefined;
|
|
74
245
|
/**
|
|
75
|
-
* Method to collect the build symbols from the output file maps generated by
|
|
246
|
+
* Method to collect the build symbols from the output file maps generated by
|
|
247
|
+
* swift build.
|
|
248
|
+
*
|
|
249
|
+
* Both build engines are supported: the llbuild engine writes per-module
|
|
250
|
+
* `output-file-map.json` files, while the Swift Build engine (default from
|
|
251
|
+
* Swift 6.4) writes per-target `<target>-OutputFileMap.json` files under
|
|
252
|
+
* `.build/out/Intermediates.noindex`.
|
|
76
253
|
*
|
|
77
254
|
* @param {String} basePath Path
|
|
78
255
|
* @param {Object} options CLI options
|
|
79
|
-
* @
|
|
256
|
+
* @param {Array<String>} [fileMaps] Output file maps, found under basePath when omitted
|
|
257
|
+
* @returns {Object} symbols map keyed by module name
|
|
80
258
|
*/
|
|
81
|
-
export declare function collectBuildSymbols(basePath: string, options: Object): Object;
|
|
259
|
+
export declare function collectBuildSymbols(basePath: string, options: Object, fileMaps?: Array<string>): Object;
|
|
82
260
|
/**
|
|
83
|
-
* Method to parse output file map to identify the module
|
|
84
|
-
*
|
|
261
|
+
* Method to parse output file map to identify the module, its sources, and
|
|
262
|
+
* their symbols. The symbol list is imprecise; the sources are exact.
|
|
263
|
+
*
|
|
264
|
+
* The module name is derived from the containing directory for llbuild maps
|
|
265
|
+
* (`<Module>.build` and, since Swift 6.4, `<Module>-tool.build`) and from the
|
|
266
|
+
* file name for Swift Build maps (`<target>-OutputFileMap.json`, where the
|
|
267
|
+
* target name still needs to be sanitised into a module name).
|
|
85
268
|
*
|
|
86
269
|
* @param filemap {String} File name
|
|
87
|
-
* @returns {Object} parsed module metadata
|
|
270
|
+
* @returns {Object} parsed module metadata `{ moduleName, moduleSymbols, sourceFiles }`
|
|
88
271
|
*/
|
|
89
272
|
export declare function parseOutputFileMap(filemap: string): Object;
|
|
273
|
+
/**
|
|
274
|
+
* Parse `.build/workspace-state.json` into the dependency packages of the
|
|
275
|
+
* workspace and the directory each one was materialised in.
|
|
276
|
+
*
|
|
277
|
+
* @param {Object} stateJson Parsed workspace-state.json
|
|
278
|
+
* @param {String} basePath Root package directory
|
|
279
|
+
* @returns {Array<Object>} `{ identity, name, location, kind, dir }` per package
|
|
280
|
+
*/
|
|
281
|
+
export declare function parseSwiftWorkspaceState(stateJson: Object, basePath: string): Array<Object>;
|
|
282
|
+
/**
|
|
283
|
+
* Parse the Swift Build engine's project model (`.build/manifest.pif`) into
|
|
284
|
+
* the module names each package declares.
|
|
285
|
+
*
|
|
286
|
+
* The manifest is a list of workspace, project, and target objects linked
|
|
287
|
+
* through their `signature` hashes. A project's guid is `PACKAGE:<identity>`
|
|
288
|
+
* and each target records its `PRODUCT_MODULE_NAME`. Unlike the verbose
|
|
289
|
+
* build output, the manifest lists modules whose compilation never started,
|
|
290
|
+
* which keeps the module-to-package mapping complete when a build fails.
|
|
291
|
+
*
|
|
292
|
+
* @param {Array} manifestJson Parsed manifest.pif contents
|
|
293
|
+
* @returns {Object} Map of package identity to module names
|
|
294
|
+
*/
|
|
295
|
+
export declare function parseSwiftBuildManifest(manifestJson: any[]): Object;
|
|
296
|
+
/**
|
|
297
|
+
* Collect the modules imported by a Swift source file, with their lines.
|
|
298
|
+
*
|
|
299
|
+
* Declarations such as `@testable import Foo`, `public import Foo`,
|
|
300
|
+
* `@_implementationOnly import cmark_gfm`, and `import struct Foo.Bar` are
|
|
301
|
+
* recognised; comments, string literals, and `canImport` conditions are not
|
|
302
|
+
* imports.
|
|
303
|
+
*
|
|
304
|
+
* @param {String} sourceText Swift source
|
|
305
|
+
* @returns {Array<Object>} `{ module, line }` per import declaration
|
|
306
|
+
*/
|
|
307
|
+
export declare function parseSwiftImports(sourceText: string): Array<Object>;
|
|
308
|
+
/**
|
|
309
|
+
* Collect the clang module names declared at the top level of a module map.
|
|
310
|
+
*
|
|
311
|
+
* @param {String} moduleMapText module.modulemap contents
|
|
312
|
+
* @returns {Object} `{ modules, headerPaths }`
|
|
313
|
+
*/
|
|
314
|
+
export declare function parseClangModuleMap(moduleMapText: string): Object;
|
|
315
|
+
/**
|
|
316
|
+
* Build a description of every module in a completed swift build: its
|
|
317
|
+
* compiler arguments, sources, and owning package.
|
|
318
|
+
*
|
|
319
|
+
* Arguments come from the llbuild build description when present and from
|
|
320
|
+
* the verbose build output otherwise (the only source for the Swift Build
|
|
321
|
+
* engine); sources come from the same places or from the output file maps.
|
|
322
|
+
* Packages come from `workspace-state.json`, and every module is attributed
|
|
323
|
+
* to the package whose directory holds its sources. Clang modules are
|
|
324
|
+
* discovered through their module maps.
|
|
325
|
+
*
|
|
326
|
+
* @param {String} basePath Root package directory
|
|
327
|
+
* @param {String} buildOutput Verbose build output
|
|
328
|
+
* @param {Object} options CLI options
|
|
329
|
+
* @param {Object} [rootMetadata] Parsed dump-package of the root package
|
|
330
|
+
* @returns {Object} `{ modules, packages, root, clangModules, fileMaps }`
|
|
331
|
+
*/
|
|
332
|
+
export declare function collectSwiftBuildPlan(basePath: string, buildOutput: string, options: Object, rootMetadata?: Object): Object;
|
|
333
|
+
/**
|
|
334
|
+
* Check that sourcekitten can load SourceKit, with a trivial syntax request.
|
|
335
|
+
*
|
|
336
|
+
* A missing binary, a binary without its Swift runtime (`error while loading
|
|
337
|
+
* shared libraries: libswiftCore.so`), or one linked against a different
|
|
338
|
+
* Swift runtime than the toolchain provides (Linux has no stable Swift ABI, so
|
|
339
|
+
* such a binary crashes inside libswiftCore) fails every request; the probe
|
|
340
|
+
* turns that into one clear message instead of silent empty results.
|
|
341
|
+
*
|
|
342
|
+
* @param {Object} [env] Environment overrides for sourcekitten
|
|
343
|
+
* @returns {boolean} `true` when sourcekitten answered the probe
|
|
344
|
+
*/
|
|
345
|
+
export declare function isSourcekittenUsable(env?: Object): boolean;
|
|
90
346
|
/**
|
|
91
347
|
* Create a precise semantics slices file for a swift project.
|
|
92
348
|
*
|
|
349
|
+
* The project is built once in verbose mode. Every source file of the root
|
|
350
|
+
* package's (non-test) modules is then indexed with sourcekitten using that
|
|
351
|
+
* module's own compiler arguments and source list, with sourcekitten aligned
|
|
352
|
+
* to the toolchain that compiled the project. The declaring module of every
|
|
353
|
+
* resolved reference is recovered from its USR, which attributes each usage
|
|
354
|
+
* to the package that provides the module (`moduleReferences`).
|
|
355
|
+
*
|
|
93
356
|
* @param basePath basePath Path
|
|
94
357
|
* @param options options CLI options
|
|
95
358
|
*/
|
|
96
359
|
export declare function createSemanticsSlices(basePath: any, options: any): {
|
|
360
|
+
projectPath: any;
|
|
361
|
+
toolchain: any;
|
|
97
362
|
packageMetadata: Object | undefined;
|
|
363
|
+
packages: any;
|
|
364
|
+
packageModules: {};
|
|
98
365
|
buildSymbols: Object;
|
|
99
|
-
moduleInfos: {};
|
|
100
|
-
fileStructures: {};
|
|
101
366
|
fileIndexes: {};
|
|
102
367
|
} | undefined;
|
|
103
368
|
//# sourceMappingURL=swiftsem.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"swiftsem.d.ts","sourceRoot":"","sources":["../../../lib/evinser/swiftsem.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"swiftsem.d.ts","sourceRoot":"","sources":["../../../lib/evinser/swiftsem.js"],"names":[],"mappings":"AAoGA;;;;;GAKG;AACH,w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,MAGmC,GAFjC,MAAM,GAAC,SAAS,CAkG5B;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,mBAAmB,CAAC,QAAQ,QAAA,EAAE,OAAO,EAJ1C,MAI0C,EAAE,QAAQ,AAH5D,CACA,EADQ,KAAK,QAG+C,GAFlD,MAAM,CA8BlB;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,QAAA,GAF7B,MAAM,CAiClB;AAED;;;;;;;GAOG;AACH,wBAAgB,wBAAwB,CAAC,SAAS,EAJvC,MAIuC,EAAE,QAAQ,QAAA,GAF/C,KAAK,CAAC,MAAM,CAAC,CA8CzB;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,uBAAuB,CAAC,YAAY,OAAA,GAFvC,MAAM,CAuClB;AAsFD;;;;;;;;;;GAUG;AACH,wBAAgB,iBAAiB,CAAC,UAAU,QAAA,GAF/B,KAAK,CAAC,MAAM,CAAC,CAmDzB;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,aAAa,QAAA,GAFpC,MAAM,CA0ClB;AAqED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,qBAAqB,CACnC,QAAQ,QAAA,EACR,WAAW,QAAA,EACX,OAAO,EAPE,MAOF,EACP,YAAY,AAPX,CACA,EADQ,MAOG,GAND,MAAM,CAyNlB;AAiCD;;;;;;;;;;;GAWG;AACH,wBAAgB,oBAAoB,CAAC,GAAG,AAHrC,CACA,EADQ,MAG6B,GAF3B,OAAO,CA6BnB;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,qBAAqB,CAAC,QAAQ,KAAA,EAAE,OAAO,KAAA;;;;;;;;cA2LtD"}
|
|
@@ -1,28 +1,121 @@
|
|
|
1
1
|
import crypto from "node:crypto";
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* Renders a value taken from a document for a message. JSON can make any field
|
|
4
|
+
* an object or array, and interpolating those directly can throw.
|
|
5
|
+
*
|
|
6
|
+
* @param {any} value - Value to render
|
|
7
|
+
* @returns {string} - Printable text
|
|
8
|
+
*/
|
|
9
|
+
export declare function displayValue(value: any): string;
|
|
10
|
+
/**
|
|
11
|
+
* Wraps shared-secret material for HMAC (HS256, HS384, HS512) signing or
|
|
12
|
+
* verification.
|
|
13
|
+
*
|
|
14
|
+
* HMAC is only ever used with a key produced by this function (or any secret
|
|
15
|
+
* KeyObject). Public and private keys are refused, so a document cannot switch
|
|
16
|
+
* a verifier to HMAC and use its public key as the secret.
|
|
17
|
+
*
|
|
18
|
+
* @param {string|Buffer|crypto.KeyObject} material - Secret bytes, a UTF-8 string, or a secret KeyObject
|
|
19
|
+
* @returns {crypto.KeyObject} - A secret KeyObject
|
|
20
|
+
*/
|
|
21
|
+
export declare function loadSharedSecret(material: string | Buffer | crypto.KeyObject): crypto.KeyObject;
|
|
22
|
+
/**
|
|
23
|
+
* Loads the key used to verify signatures.
|
|
24
|
+
*
|
|
25
|
+
* Strings and Buffers are always parsed as asymmetric keys (a private key is
|
|
26
|
+
* reduced to its public half). To verify HMAC signatures, pass the result of
|
|
27
|
+
* {@link loadSharedSecret} instead.
|
|
28
|
+
*
|
|
29
|
+
* @param {string|Buffer|Object|crypto.KeyObject} key - PEM text, a createPublicKey() input, or a KeyObject
|
|
30
|
+
* @returns {crypto.KeyObject} - A public or secret KeyObject
|
|
31
|
+
*/
|
|
32
|
+
export declare function loadVerificationKey(key: string | Buffer | Object | crypto.KeyObject): crypto.KeyObject;
|
|
33
|
+
/**
|
|
34
|
+
* Generates a PEM key pair suitable for the given JSF algorithm.
|
|
35
|
+
*
|
|
36
|
+
* @param {string} algorithm - JSF algorithm identifier
|
|
37
|
+
* @returns {{ publicKey: string, privateKey: string }} - PEM encoded SPKI public key and PKCS#8 private key
|
|
38
|
+
*/
|
|
39
|
+
export declare function generateSigningKeyPair(algorithm: string): {
|
|
40
|
+
publicKey: string;
|
|
41
|
+
privateKey: string;
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* Applies JSF signatures to the BOM and, optionally, its components, services,
|
|
45
|
+
* and annotations.
|
|
46
|
+
*
|
|
47
|
+
* Nested elements are signed by default. When a `signers` or `chain` signature
|
|
48
|
+
* is appended to a BOM that already has a root signature, nested elements are
|
|
49
|
+
* skipped by default, because changing them would invalidate the existing root
|
|
50
|
+
* signature; explicitly requesting nested signing in that case is an error.
|
|
4
51
|
*
|
|
5
52
|
* @param {Object} bomJson - CycloneDX BOM Object
|
|
6
|
-
* @param {Object} options - Signing options
|
|
53
|
+
* @param {Object} options - Signing options
|
|
54
|
+
* @param {string|Buffer|Object|crypto.KeyObject} options.privateKey - Private key (PEM or KeyObject), or the shared secret for HS* algorithms
|
|
55
|
+
* @param {string} [options.algorithm] - JSF algorithm identifier (default RS512). It must match the key type.
|
|
56
|
+
* @param {Object} [options.publicKeyJwk] - JWK of the signing key's public key to embed
|
|
57
|
+
* @param {string} [options.keyId] - Key ID to embed
|
|
58
|
+
* @param {string} [options.mode] - 'replace' (default), 'signers', or 'chain'
|
|
59
|
+
* @param {boolean} [options.signComponents] - Sign each component
|
|
60
|
+
* @param {boolean} [options.signServices] - Sign each service
|
|
61
|
+
* @param {boolean} [options.signAnnotations] - Sign each annotation
|
|
7
62
|
* @returns {Object} - Signed BOM Object
|
|
8
63
|
*/
|
|
9
|
-
export declare function signBom(bomJson: Object, options?:
|
|
64
|
+
export declare function signBom(bomJson: Object, options?: {
|
|
65
|
+
privateKey: string | Buffer | Object | crypto.KeyObject;
|
|
66
|
+
algorithm?: string;
|
|
67
|
+
publicKeyJwk?: Object;
|
|
68
|
+
keyId?: string;
|
|
69
|
+
mode?: string;
|
|
70
|
+
signComponents?: boolean;
|
|
71
|
+
signServices?: boolean;
|
|
72
|
+
signAnnotations?: boolean;
|
|
73
|
+
}): Object;
|
|
10
74
|
/**
|
|
11
|
-
* Verifies the
|
|
12
|
-
*
|
|
75
|
+
* Verifies the signature of a single node (e.g., BOM root, Component, Service,
|
|
76
|
+
* Annotation). Handles single signatures, multi-signatures (signers), and
|
|
77
|
+
* signature chains, and returns the first signature object that matches the key.
|
|
78
|
+
*
|
|
79
|
+
* A signature only matches when its declared algorithm fits the key type, its
|
|
80
|
+
* embedded publicKey (if any) is the verification key, and its value covers the
|
|
81
|
+
* node content plus the signature metadata as JSF defines.
|
|
13
82
|
*
|
|
14
83
|
* @param {Object} node - The BOM or granular object to verify
|
|
15
|
-
* @param {string|crypto.KeyObject} publicKey -
|
|
16
|
-
* @
|
|
84
|
+
* @param {string|Buffer|Object|crypto.KeyObject} publicKey - Verification key. Strings and Buffers are parsed as public keys; use loadSharedSecret() for HMAC.
|
|
85
|
+
* @param {Object} [options]
|
|
86
|
+
* @param {string[]} [options.reasons] - When no signature matches, receives the reason each entry was rejected
|
|
87
|
+
* @returns {boolean|Object} - Matching signature object if valid. False otherwise.
|
|
17
88
|
*/
|
|
18
|
-
export declare function verifyNode(node: Object, publicKey: string | crypto.KeyObject
|
|
89
|
+
export declare function verifyNode(node: Object, publicKey: string | Buffer | Object | crypto.KeyObject, options?: {
|
|
90
|
+
reasons?: string[];
|
|
91
|
+
}): boolean | Object;
|
|
19
92
|
/**
|
|
20
|
-
* Verifies
|
|
21
|
-
* Returns
|
|
93
|
+
* Verifies a BOM's top-level signature, as well as nested components, services,
|
|
94
|
+
* and annotations. Returns the root match only if the root signature is valid
|
|
95
|
+
* AND every signed nested element is valid for the same key.
|
|
22
96
|
*
|
|
23
97
|
* @param {Object} bom - CycloneDX BOM Object
|
|
24
|
-
* @param {string|crypto.KeyObject} publicKey -
|
|
25
|
-
* @
|
|
98
|
+
* @param {string|Buffer|Object|crypto.KeyObject} publicKey - Verification key (see verifyNode)
|
|
99
|
+
* @param {Object} [options] - Same options as verifyNode
|
|
100
|
+
* @returns {boolean|Object} - Signature object if valid. False otherwise.
|
|
101
|
+
*/
|
|
102
|
+
export declare function verifyBom(bom: Object, publicKey: string | Buffer | Object | crypto.KeyObject, options?: Object): boolean | Object;
|
|
103
|
+
/**
|
|
104
|
+
* Checks every signature entry of a node against a set of trusted keys. An
|
|
105
|
+
* entry is verified when one of the keys verifies that entry.
|
|
106
|
+
*
|
|
107
|
+
* `cdx-sign` uses this before appending to a signature chain, because the new
|
|
108
|
+
* chain entry vouches for every earlier entry.
|
|
109
|
+
*
|
|
110
|
+
* @param {Object} node - The BOM or granular object whose signature is checked
|
|
111
|
+
* @param {Array<string|Buffer|Object|crypto.KeyObject>} [keys] - Trusted verification keys (see verifyNode)
|
|
112
|
+
* @returns {Array<{ index: number, algorithm: any, keyId: any, verified: boolean, reasons: string[] }>} - One result per signature entry; empty for an unsigned node
|
|
26
113
|
*/
|
|
27
|
-
export declare function
|
|
114
|
+
export declare function checkSignatureEntries(node: Object, keys?: Array<string | Buffer | Object | crypto.KeyObject>): Array<{
|
|
115
|
+
index: number;
|
|
116
|
+
algorithm: any;
|
|
117
|
+
keyId: any;
|
|
118
|
+
verified: boolean;
|
|
119
|
+
reasons: string[];
|
|
120
|
+
}>;
|
|
28
121
|
//# sourceMappingURL=bomSigner.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bomSigner.d.ts","sourceRoot":"","sources":["../../../lib/helpers/bomSigner.js"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"bomSigner.d.ts","sourceRoot":"","sources":["../../../lib/helpers/bomSigner.js"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,aAAa,CAAC;AAuCjC;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAHvB,GAGuB,GAFrB,MAAM,CAWlB;AAgID;;;;;;;;;;GAUG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAH9B,MAAM,GAAC,MAAM,GAAC,MAAM,CAAC,SAGS,GAF5B,MAAM,CAAC,SAAS,CA2B5B;AAED;;;;;;;;;GASG;AACH,wBAAgB,mBAAmB,CAAC,GAAG,EAH5B,MAAM,GAAC,MAAM,GAAC,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