Commit 33a5ba7
feat: add npm audit signatures
Starting to implemenent [RFC: Improve signature verification](npm/rfcs#550)
Adds a new sub-command to `audit`: `npm audit signatures` (following [`npm audit licenses`](#3452))
This command will verify registry signatures stored in the packument against a public key on the registry.
It currently supports:
- Any registry that implements `host/-/npm/v1/keys` endpoint and provides `signatures` in the packument `dist` object
- Validates public keys are not expired, compared to the version created date
- Errors when encountering packages with missing signatures when the registry returns keys at `host/-/npm/v1/keys`
- Errors when encountering invalid signatures
- json/human format output
TODO
- [ ] Fix tests and implement test cases
- [ ] Expired public key
- [ ] No public keys
- [ ] Missing signatures with a public key on the registry
- [ ] Missing signatures without a public key on the registry
- [ ] Install with valid signatures
- [ ] Install with invalid signatures
- [ ] Third party registry with signatures and keys
- [ ] Tests for the different formats (json, human)
- [ ] Tests to omit type of dependency (e.g dev deps)
- [ ] Fetch signatures and integrity from `pacote.manifest`
- [ ] Caching story for public keys? Currently cached for one week, assumes we'll double sign for longer when rotating keys
- [ ] Validate early return conditionals for arb nodes, a lot of cases silently return, e.g. no version, are these correct?
- [ ] What other checks do we want?
- [ ] Strict mode to error if any signatures are missing when a registry does not return public keys?
- [ ] Do we want to explitly trust keys from third party registries and store in .npmrc?1 parent 40c823c commit 33a5ba7
File tree
4 files changed
+605
-2
lines changed- lib
- commands
- utils
- tap-snapshots/test/lib/commands
- test/lib/commands
4 files changed
+605
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
4 | | - | |
| 3 | + | |
5 | 4 | | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
6 | 8 | | |
7 | 9 | | |
8 | 10 | | |
| |||
37 | 39 | | |
38 | 40 | | |
39 | 41 | | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
40 | 50 | | |
41 | 51 | | |
42 | 52 | | |
| |||
59 | 69 | | |
60 | 70 | | |
61 | 71 | | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
62 | 103 | | |
63 | 104 | | |
64 | 105 | | |
0 commit comments