-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b3f115d
commit 0189a73
Showing
10 changed files
with
111 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -661,6 +661,19 @@ Default plugin to filter packages by their fields. May be used directly or via s | |
} | ||
``` | ||
|
||
### Checks | ||
To check the specified package version against the applied registry rules trigger its `_check` entrypoint. | ||
For one package: | ||
```bash | ||
curl -X GET -k https://localhost:3000/registry/_check/eventsource/1.1.0 | ||
# {"[email protected]":"deny"} | ||
``` | ||
To inspect a bulk on entries at once: | ||
```bash | ||
curl -X POST -k https://localhost:3000/registry/_check/bulk -d '["[email protected]"]' | ||
# {"[email protected]":"deny"} | ||
``` | ||
|
||
### Monitoring | ||
#### /healthcheck | ||
```json | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
export { firewall } from '../firewall/index.js' | ||
export { firewall, advisory } from '../firewall/index.js' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,6 +23,11 @@ const cfg = { | |
"name": "colors", | ||
"version": ">= v1.3.0" | ||
}, | ||
{ | ||
"plugin": [["npm-registry-firewall/audit", { | ||
"critical": "deny" | ||
}]] | ||
} | ||
] | ||
}, | ||
'/block-all': { | ||
|
@@ -109,6 +114,11 @@ test('is runnable', async () => { | |
}, | ||
{ statusCode: 304 } | ||
], | ||
[ | ||
'provides check API', | ||
{ url: 'http://localhost:3001/registry/_check/bulk', method: 'POST', body: '["[email protected]"]'}, | ||
{ statusCode: 200, body: '{"[email protected]":"deny"}' } | ||
], | ||
[ | ||
'works as proxy', | ||
{ url: 'http://localhost:3001/npm-proxy/d', method: 'GET'}, | ||
|
@@ -119,13 +129,13 @@ test('is runnable', async () => { | |
{ url: 'http://localhost:3001/unknown/d', method: 'GET'}, | ||
{ statusCode: 200 } | ||
], | ||
].forEach(([name, {url, method, headers: _headers = {}}, expected]) => { | ||
].forEach(([name, {url, method, body, headers: _headers = {}}, expected]) => { | ||
test(name, async () => { | ||
let result | ||
const headers = typeof _headers === 'function' ? await _headers() : _headers | ||
|
||
try { | ||
const res = await request({url, method, headers}) | ||
const res = await request({url, method, body, headers, test: 'true'}) | ||
const hash = crypto | ||
.createHash('sha512') | ||
.update(res.buffer) | ||
|