You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Code to run on a VM interpreter or JIT compiled into bytecode by a third party. This includes packages which download Java `.jar` files from another source.
251
+
252
+
## Software identifiers {#sec-meta-identifiers}
253
+
254
+
Package's `meta.identifiers` attribute specifies information about software identifiers associated with this package. Software identifiers are used, for example:
255
+
* to generate Software Bill of Materials (SBOM) that lists all components used to build the software, which can later be used to perform vulnerability or license analysis of the resulting software;
256
+
* to lookup software in different vulnerability databases or report new vulnerabilities to them.
257
+
258
+
Overriding the default `meta.identifiers` attribute is optional, but it is recommended to fill in pieces to help tools mentioned above get precise data.
259
+
For example, we could get automatic notifications about potential vulnerabilities for users in the future.
260
+
All identifiers specified in `meta.identifiers` are expected to be unambiguous and valid.
261
+
262
+
`meta.identifiers` contains `v1` attribute which is an attribute set that guarantees backward compatibility of its constituents. Right now it contains copies of all other attributes in `meta.identifiers`.
263
+
264
+
### CPE {#sec-meta-identifiers-cpe}
265
+
266
+
Common Platform Enumeration (CPE) is a specification maintained by NIST as part of the Security Content Automation Protocol (SCAP). It is used to identify software in National Vulnerabilities Database (NVD, https://nvd.nist.gov) and other vulnerability databases.
**part* - usually in Nixpkgs `a` for "application", can also be `o` for "operating system" or `h` for "hardware"
278
+
**vendor* - can point to the source of the package, or to Nixpkgs itself
279
+
**product* - name of the package
280
+
**version* - version of the package
281
+
**update* - name of the latest update, can be a patch version for semantically versioned packages
282
+
**edition* - any additional specification about the version
283
+
284
+
You can find information about all of these attributes in the [official specification](https://csrc.nist.gov/projects/security-content-automation-protocol/specifications/cpe/naming) (heading 5.3.3, pages 11-13).
285
+
286
+
Any fields that don't have a value are set to either `-` if the value is not available or `*` when the field can match any value.
287
+
288
+
For example, for glibc 2.40.1 CPE would be `cpe:2.3:a:gnu:glibc:2.40:1:*:*:*:*:*:*`.
This attribute contains an attribute set of all parts of the CPE for this package. Most of the parts default to `*` (match any value), with some exceptions:
293
+
294
+
*`part` defaults to `a` (application), can also be set to `o` for operating systems, for example, Linux kernel, or to `h` for hardware
295
+
*`vendor` cannot be deduced from other sources, so it must be specified by the package author
296
+
*`product` defaults to provided derivation's `pname` attribute and must be provided explicitly if `pname` is missing
297
+
*`version` and `update` have no defaults and should be specified explicitly or using helper functions, when missing, `cpe` attribute will be empty, and all possible guesses using helper functions will be in `possibleCPEs` attribute.
298
+
299
+
It is up to the package author to make sure all parts are correct and match expected values in [NVD dictionary](https://nvd.nist.gov/products/cpe). Unknown values can be skipped, which would leave them with the default value of `*`.
300
+
301
+
Following functions help with filling out `version` and `update` fields:
A readonly attribute containing the list of guesses for what CPE for this package can look like. It includes all variants of version handling mentioned above. Each item is an attrset with attributes `cpeParts` and `cpe` for each guess.
error="version ${version} doesn't match regex `${regex}`";
615
+
}
616
+
else
617
+
{
618
+
success=true;
619
+
value={
620
+
inheritvendor;
621
+
version=elemAtversionMatch0;
622
+
update=elemAtversionMatch1;
623
+
};
624
+
};
625
+
626
+
/**
627
+
Generate [CPE parts](#var-meta-identifiers-cpeParts) from inputs. Copies `vendor` to the result. When `version` matches `X.Y.Z` where all parts are numerical, sets `version` and `update` fields to `X.Y` and `Z`. Throws an error if the version doesn't match the expected template.
0 commit comments