@misconfig/cli 1.3.0 → 1.3.1
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/CHANGELOG.md +34 -0
- package/README.md +26 -26
- package/bin/misconfig.js +2 -1
- package/engine/catalog.js +6 -0
- package/engine/explain.js +2 -3
- package/engine/flags.js +0 -3
- package/engine/index.js +93 -593
- package/engine/known.js +264 -1
- package/engine/locations.js +0 -2
- package/engine/named.js +1 -2
- package/engine/paths.js +4 -5
- package/lib/discover.js +63 -23
- package/lib/findings.js +109 -0
- package/lib/html.js +201 -0
- package/lib/lookup.js +42 -11
- package/lib/main.js +63 -124
- package/lib/print.js +27 -74
- package/package.json +2 -1
- package/report/fonts/OFL.txt +93 -0
- package/report/fonts/recursive-mono.woff2 +0 -0
- package/report/fonts/recursive-sans.woff2 +0 -0
- package/report/mark-black.svg +1 -0
- package/report/mark.svg +1 -0
- package/report/styles.css +2656 -0
- package/lib/private.js +0 -47
package/lib/private.js
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
// Private reports: the whole report, encrypted on this computer before it's
|
|
2
|
-
// sent. misconfig.ai keeps the encrypted bytes for 7 days and never gets the
|
|
3
|
-
// key, which only travels in the link after "#", the part of a link browsers
|
|
4
|
-
// don't send to servers.
|
|
5
|
-
|
|
6
|
-
import { gzipSync } from "node:zlib";
|
|
7
|
-
import { webcrypto } from "node:crypto";
|
|
8
|
-
import { spawn } from "node:child_process";
|
|
9
|
-
|
|
10
|
-
// Format 1: [1][12-byte nonce][AES-256-GCM ciphertext of the gzipped JSON,
|
|
11
|
-
// with its 16-byte tag]. The page at misconfig.ai/p/ reads the same format.
|
|
12
|
-
const FORMAT = 1;
|
|
13
|
-
const AAD = new TextEncoder().encode("misconfig private report v1");
|
|
14
|
-
export const MAX_BYTES = 512 * 1024;
|
|
15
|
-
// The page won't unpack a report larger than this, so one that is isn't sent.
|
|
16
|
-
export const MAX_PLAIN_BYTES = 16 * 1024 * 1024;
|
|
17
|
-
|
|
18
|
-
export async function seal(report) {
|
|
19
|
-
const json = Buffer.from(JSON.stringify(report), "utf8");
|
|
20
|
-
if (json.length > MAX_PLAIN_BYTES) return { body: null, key: null };
|
|
21
|
-
const plain = gzipSync(json);
|
|
22
|
-
const raw = webcrypto.getRandomValues(new Uint8Array(32));
|
|
23
|
-
const iv = webcrypto.getRandomValues(new Uint8Array(12));
|
|
24
|
-
const key = await webcrypto.subtle.importKey("raw", raw, "AES-GCM", false, ["encrypt"]);
|
|
25
|
-
const sealed = new Uint8Array(await webcrypto.subtle.encrypt({ name: "AES-GCM", iv, additionalData: AAD }, key, plain));
|
|
26
|
-
const body = new Uint8Array(1 + iv.length + sealed.length);
|
|
27
|
-
body[0] = FORMAT;
|
|
28
|
-
body.set(iv, 1);
|
|
29
|
-
body.set(sealed, 1 + iv.length);
|
|
30
|
-
return { body, key: Buffer.from(raw).toString("base64url") };
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
// Opens a link in the default browser. If that doesn't work, nothing is
|
|
34
|
-
// lost: the link is printed too.
|
|
35
|
-
export function openInBrowser(link) {
|
|
36
|
-
const [command, args] =
|
|
37
|
-
process.platform === "win32"
|
|
38
|
-
? ["rundll32", ["url.dll,FileProtocolHandler", link]]
|
|
39
|
-
: process.platform === "darwin"
|
|
40
|
-
? ["open", [link]]
|
|
41
|
-
: ["xdg-open", [link]];
|
|
42
|
-
try {
|
|
43
|
-
const child = spawn(command, args, { stdio: "ignore", detached: true });
|
|
44
|
-
child.on("error", () => {});
|
|
45
|
-
child.unref();
|
|
46
|
-
} catch {}
|
|
47
|
-
}
|