@hardkeel/benthic 0.0.0-stage → 1.0.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.
Files changed (71) hide show
  1. package/CHANGELOG.md +121 -0
  2. package/LICENSE +92 -0
  3. package/NOTICE +16 -0
  4. package/README.md +424 -2
  5. package/action.yml +54 -0
  6. package/dist/agility.js +80 -0
  7. package/dist/badge.js +62 -0
  8. package/dist/baseline.js +81 -0
  9. package/dist/cbom-diff.js +273 -0
  10. package/dist/cbom.js +418 -0
  11. package/dist/cli.js +834 -0
  12. package/dist/cloud-aws-services.js +375 -0
  13. package/dist/cloud-aws.js +354 -0
  14. package/dist/cloud-azure-services.js +73 -0
  15. package/dist/cloud-azure.js +144 -0
  16. package/dist/cloud-common.js +242 -0
  17. package/dist/cloud-gcp-services.js +90 -0
  18. package/dist/cloud-gcp.js +150 -0
  19. package/dist/comments.js +138 -0
  20. package/dist/community-rules.js +37 -0
  21. package/dist/community.js +30 -0
  22. package/dist/deps.js +406 -0
  23. package/dist/der.js +571 -0
  24. package/dist/evidence-cli.js +235 -0
  25. package/dist/evidence-live.js +109 -0
  26. package/dist/evidence.js +512 -0
  27. package/dist/ignore.js +90 -0
  28. package/dist/image.js +1224 -0
  29. package/dist/infra.js +635 -0
  30. package/dist/inventory.js +277 -0
  31. package/dist/map-activity.js +24 -0
  32. package/dist/map-areas.js +60 -0
  33. package/dist/map-cloud-keys.js +110 -0
  34. package/dist/map-cloud.js +34 -0
  35. package/dist/map-ct.js +107 -0
  36. package/dist/map-host.js +335 -0
  37. package/dist/map-network.js +520 -0
  38. package/dist/map-people.js +79 -0
  39. package/dist/map-rank.js +70 -0
  40. package/dist/map-report.js +304 -0
  41. package/dist/map-run.js +327 -0
  42. package/dist/map-sarif.js +61 -0
  43. package/dist/map-signin.js +247 -0
  44. package/dist/map-types.js +19 -0
  45. package/dist/map-web.js +666 -0
  46. package/dist/native.js +168 -0
  47. package/dist/policy.js +221 -0
  48. package/dist/pqc.js +46 -0
  49. package/dist/profile.js +65 -0
  50. package/dist/project.js +928 -0
  51. package/dist/prose.js +159 -0
  52. package/dist/protocols.js +207 -0
  53. package/dist/registry.js +326 -0
  54. package/dist/report.js +190 -0
  55. package/dist/rules.js +230 -0
  56. package/dist/sarif-common.js +30 -0
  57. package/dist/sarif.js +114 -0
  58. package/dist/scan.js +601 -0
  59. package/dist/score.js +124 -0
  60. package/dist/secrets.js +192 -0
  61. package/dist/share-config.js +129 -0
  62. package/dist/share-lists.js +19 -0
  63. package/dist/share.js +125 -0
  64. package/dist/sonar.js +83 -0
  65. package/dist/structure.js +218 -0
  66. package/dist/suites.js +402 -0
  67. package/dist/tls-check.js +122 -0
  68. package/dist/types.js +4 -0
  69. package/dist/walk.js +78 -0
  70. package/dist/yaml.js +173 -0
  71. package/package.json +73 -4
package/dist/yaml.js ADDED
@@ -0,0 +1,173 @@
1
+ // SPDX-License-Identifier: PolyForm-Shield-1.0.0
2
+ // Copyright 2026 Hard Keel (https://hardkeel.com)
3
+ // A small YAML reader for settings files: maps, lists, strings, numbers, true/false and null, with
4
+ // comments, quoted strings and short [a, b] lists. Enough for .benthic.yml, with no dependency.
5
+ // Anchors, tags, multi-document files and block strings (| and >) are not read; they get a clear error.
6
+ export class YamlError extends Error {
7
+ line;
8
+ constructor(message, line) {
9
+ super(`line ${line}: ${message}`);
10
+ this.line = line;
11
+ }
12
+ }
13
+ function stripComment(raw) {
14
+ let quote = null;
15
+ for (let i = 0; i < raw.length; i++) {
16
+ const c = raw[i];
17
+ if (quote) {
18
+ if (c === "\\" && quote === '"')
19
+ i++;
20
+ else if (c === quote)
21
+ quote = null;
22
+ continue;
23
+ }
24
+ // A quote opens a string only where a value starts: It's stays plain text.
25
+ if ((c === '"' || c === "'") && (i === 0 || /[\s:\-[,]/.test(raw[i - 1])))
26
+ quote = c;
27
+ else if (c === "#" && (i === 0 || /\s/.test(raw[i - 1])))
28
+ return raw.slice(0, i);
29
+ }
30
+ return raw;
31
+ }
32
+ function scalar(text, no) {
33
+ const t = text.trim();
34
+ if (t === "" || t === "~" || t === "null")
35
+ return null;
36
+ if (t === "true")
37
+ return true;
38
+ if (t === "false")
39
+ return false;
40
+ if (/^-?\d+(\.\d+)?$/.test(t))
41
+ return Number(t);
42
+ if (t.startsWith('"')) {
43
+ if (!/^"(?:[^"\\]|\\.)*"$/.test(t))
44
+ throw new YamlError("a quoted string isn't closed", no);
45
+ return JSON.parse(t);
46
+ }
47
+ if (t.startsWith("'")) {
48
+ if (!/^'(?:[^']|'')*'$/.test(t))
49
+ throw new YamlError("a quoted string isn't closed", no);
50
+ return t.slice(1, -1).replace(/''/g, "'");
51
+ }
52
+ if (t.startsWith("[")) {
53
+ if (!t.endsWith("]"))
54
+ throw new YamlError("a [ list isn't closed on its line", no);
55
+ const inner = t.slice(1, -1).trim();
56
+ return inner ? splitFlow(inner).map((p) => scalar(p, no)) : [];
57
+ }
58
+ if (t.startsWith("{"))
59
+ throw new YamlError("write a map on its own lines, not as { }", no);
60
+ if (/^[&*!|>]/.test(t))
61
+ throw new YamlError(`"${t[0]}" (anchors, tags and block strings) isn't supported here`, no);
62
+ return t;
63
+ }
64
+ function splitFlow(text) {
65
+ const out = [];
66
+ let quote = null;
67
+ let cur = "";
68
+ for (const c of text) {
69
+ if (quote) {
70
+ cur += c;
71
+ if (c === quote)
72
+ quote = null;
73
+ continue;
74
+ }
75
+ if (c === '"' || c === "'")
76
+ quote = c;
77
+ if (c === ",") {
78
+ out.push(cur.trim());
79
+ cur = "";
80
+ continue;
81
+ }
82
+ cur += c;
83
+ }
84
+ out.push(cur.trim());
85
+ return out;
86
+ }
87
+ const KEY = /^("(?:[^"\\]|\\.)*"|'(?:[^']|'')*'|[^\s"'#:][^:#]*?)\s*:(?:\s+(.*)|\s*)$/;
88
+ export function parseYaml(text) {
89
+ const lines = [];
90
+ text.split(/\r?\n/).forEach((raw, i) => {
91
+ if (/^\s*(---|\.\.\.)\s*$/.test(raw)) {
92
+ if (lines.length)
93
+ throw new YamlError("only one document per file", i + 1);
94
+ return;
95
+ }
96
+ if (/^\s*\t/.test(raw))
97
+ throw new YamlError("indent with spaces, not tabs", i + 1);
98
+ const t = stripComment(raw).replace(/\s+$/, "");
99
+ if (!t.trim())
100
+ return;
101
+ lines.push({ indent: t.length - t.trimStart().length, text: t.trim(), no: i + 1 });
102
+ });
103
+ if (!lines.length)
104
+ return null;
105
+ const [value, next] = block(lines, 0, lines[0].indent);
106
+ if (next < lines.length)
107
+ throw new YamlError("this line's indentation doesn't fit the lines above it", lines[next].no);
108
+ return value;
109
+ }
110
+ function block(lines, i, indent) {
111
+ return lines[i].text === "-" || lines[i].text.startsWith("- ") ? list(lines, i, indent) : map(lines, i, indent);
112
+ }
113
+ function list(lines, i, indent) {
114
+ const out = [];
115
+ while (i < lines.length && lines[i].indent === indent && (lines[i].text === "-" || lines[i].text.startsWith("- "))) {
116
+ const l = lines[i];
117
+ const rest = l.text.slice(1).trim();
118
+ if (!rest) {
119
+ if (i + 1 < lines.length && lines[i + 1].indent > indent) {
120
+ const [v, n] = block(lines, i + 1, lines[i + 1].indent);
121
+ out.push(v);
122
+ i = n;
123
+ }
124
+ else {
125
+ out.push(null);
126
+ i++;
127
+ }
128
+ continue;
129
+ }
130
+ if (KEY.test(rest) && !/^["'[]/.test(rest)) {
131
+ // - key: value, with more keys on the lines below at the same depth as "key".
132
+ const at = indent + l.text.indexOf(rest);
133
+ const copy = lines.slice();
134
+ copy[i] = { indent: at, text: rest, no: l.no };
135
+ const [v, n] = map(copy, i, at);
136
+ out.push(v);
137
+ i = n;
138
+ continue;
139
+ }
140
+ out.push(scalar(rest, l.no));
141
+ i++;
142
+ }
143
+ return [out, i];
144
+ }
145
+ function map(lines, i, indent) {
146
+ const out = {};
147
+ while (i < lines.length && lines[i].indent === indent) {
148
+ const l = lines[i];
149
+ if (l.text.startsWith("- "))
150
+ throw new YamlError("a list item where a key was expected", l.no);
151
+ const m = l.text.match(KEY);
152
+ if (!m)
153
+ throw new YamlError(`expected "key: value", found "${l.text}"`, l.no);
154
+ const key = String(scalar(m[1], l.no));
155
+ if (key in out)
156
+ throw new YamlError(`"${key}" is given twice`, l.no);
157
+ i++;
158
+ if (m[2] !== undefined && m[2].trim() !== "") {
159
+ out[key] = scalar(m[2], l.no);
160
+ continue;
161
+ }
162
+ if (i < lines.length && (lines[i].indent > indent || (lines[i].indent === indent && lines[i].text.startsWith("- ")))) {
163
+ const [v, n] = block(lines, i, lines[i].indent);
164
+ out[key] = v;
165
+ i = n;
166
+ }
167
+ else
168
+ out[key] = null;
169
+ }
170
+ if (i < lines.length && lines[i].indent > indent)
171
+ throw new YamlError("this line is indented more than the lines above it", lines[i].no);
172
+ return [out, i];
173
+ }
package/package.json CHANGED
@@ -1,6 +1,75 @@
1
1
  {
2
2
  "name": "@hardkeel/benthic",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "1.0.0",
4
+ "description": "Post-quantum readiness scanner: finds encryption quantum computers will break (RSA, ECC, DH), weak encryption, exposed infrastructure settings and leaked keys in code, config, websites, networks, servers and AWS, Azure and Google Cloud accounts. Writes a CycloneDX CBOM, SARIF and a NIST migration plan.",
5
+ "license": "PolyForm-Shield-1.0.0",
6
+ "author": "Hard Keel (https://hardkeel.com)",
7
+ "homepage": "https://hardkeel.com/quantum-scan/",
8
+ "keywords": [
9
+ "post-quantum",
10
+ "post-quantum-cryptography",
11
+ "pqc",
12
+ "quantum-safe",
13
+ "quantum-readiness",
14
+ "ml-kem",
15
+ "nist",
16
+ "cbom",
17
+ "cyclonedx",
18
+ "cryptography",
19
+ "encryption",
20
+ "tls",
21
+ "ssh",
22
+ "security",
23
+ "security-scanner",
24
+ "scanner",
25
+ "sast",
26
+ "devsecops",
27
+ "sarif",
28
+ "secrets",
29
+ "terraform",
30
+ "kubernetes",
31
+ "cloudformation",
32
+ "github-action",
33
+ "aws",
34
+ "azure",
35
+ "google-cloud",
36
+ "kms",
37
+ "cloud-security",
38
+ "cli"
39
+ ],
40
+ "type": "module",
41
+ "bin": {
42
+ "benthic": "dist/cli.js",
43
+ "quantum-scan": "dist/cli.js"
44
+ },
45
+ "files": [
46
+ "dist",
47
+ "action.yml",
48
+ "README.md",
49
+ "CHANGELOG.md",
50
+ "LICENSE",
51
+ "NOTICE"
52
+ ],
53
+ "engines": {
54
+ "node": ">=18"
55
+ },
56
+ "scripts": {
57
+ "build": "rm -rf dist && tsc -p tsconfig.json && chmod +x dist/cli.js",
58
+ "rules": "node scripts/build-rules.mjs",
59
+ "test": "node --test test/*.test.ts",
60
+ "typecheck": "tsc --noEmit -p tsconfig.json",
61
+ "bench": "node bench/run.ts --check",
62
+ "bench:real": "node bench/real.ts"
63
+ },
64
+ "repository": {
65
+ "type": "git",
66
+ "url": "git+https://github.com/Hard-Keel/benthic.git"
67
+ },
68
+ "bugs": {
69
+ "url": "https://github.com/Hard-Keel/benthic/issues"
70
+ },
71
+ "devDependencies": {
72
+ "@types/node": "22.20.5",
73
+ "typescript": "5.9.3"
74
+ }
75
+ }