@shieldaai/security-watch 0.1.0-alpha.0 → 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 (92) hide show
  1. package/CHANGELOG.md +170 -0
  2. package/CONTRIBUTING.md +4 -2
  3. package/README.md +173 -48
  4. package/SECURITY.md +24 -9
  5. package/dist/assessment.d.ts +12 -1
  6. package/dist/assessment.js +223 -52
  7. package/dist/cli.js +340 -27
  8. package/dist/config.d.ts +62 -2
  9. package/dist/config.js +88 -5
  10. package/dist/coverage.d.ts +4 -0
  11. package/dist/coverage.js +11 -0
  12. package/dist/cve-now.d.ts +32 -2
  13. package/dist/cve-now.js +715 -126
  14. package/dist/cvss4.d.ts +3 -0
  15. package/dist/cvss4.js +39 -0
  16. package/dist/delivery.d.ts +34 -2
  17. package/dist/delivery.js +391 -98
  18. package/dist/ecosystems.d.ts +23 -0
  19. package/dist/ecosystems.js +88 -10
  20. package/dist/engine.d.ts +55 -1
  21. package/dist/engine.js +101 -20
  22. package/dist/everyday-words.d.ts +11 -0
  23. package/dist/everyday-words.js +256 -0
  24. package/dist/health.d.ts +7 -0
  25. package/dist/health.js +55 -3
  26. package/dist/http.d.ts +7 -0
  27. package/dist/http.js +31 -2
  28. package/dist/index.d.ts +22 -4
  29. package/dist/index.js +12 -4
  30. package/dist/inventory-evidence.d.ts +10 -0
  31. package/dist/inventory-evidence.js +206 -0
  32. package/dist/inventory.d.ts +273 -0
  33. package/dist/inventory.js +210 -17
  34. package/dist/maintenance.d.ts +5 -0
  35. package/dist/maintenance.js +73 -5
  36. package/dist/matching.d.ts +29 -0
  37. package/dist/matching.js +537 -0
  38. package/dist/models.d.ts +17 -4
  39. package/dist/models.js +359 -29
  40. package/dist/pilot-cases.d.ts +171 -0
  41. package/dist/pilot-cases.js +330 -0
  42. package/dist/pilot-input.d.ts +16 -0
  43. package/dist/pilot-input.js +125 -0
  44. package/dist/pilot-recall.d.ts +166 -0
  45. package/dist/pilot-recall.js +231 -0
  46. package/dist/pilot-report.d.ts +113 -0
  47. package/dist/pilot-report.js +279 -0
  48. package/dist/pilot-responses.d.ts +111 -0
  49. package/dist/pilot-responses.js +159 -0
  50. package/dist/python-version.d.ts +3 -0
  51. package/dist/python-version.js +30 -0
  52. package/dist/rehearsal.d.ts +440 -0
  53. package/dist/rehearsal.js +372 -0
  54. package/dist/sbom.d.ts +13 -0
  55. package/dist/sbom.js +193 -0
  56. package/dist/source-error.d.ts +17 -1
  57. package/dist/source-error.js +18 -3
  58. package/dist/sources.d.ts +2 -2
  59. package/dist/sources.js +699 -45
  60. package/dist/store.d.ts +38 -13
  61. package/dist/store.js +325 -23
  62. package/dist/types.d.ts +159 -2
  63. package/dist/util.d.ts +23 -0
  64. package/dist/util.js +81 -1
  65. package/dist/vendor/cvss4-reference.d.ts +2 -0
  66. package/dist/vendor/cvss4-reference.js +789 -0
  67. package/dist/word-filter.d.ts +3 -0
  68. package/dist/word-filter.js +3291 -0
  69. package/docs/alert-outcome-evaluation.md +150 -0
  70. package/docs/compatibility.md +35 -0
  71. package/docs/configuration.md +289 -29
  72. package/docs/cvss-v4-support.md +41 -0
  73. package/docs/offline-advisory-preview.md +114 -0
  74. package/docs/offline-rehearsal.md +44 -0
  75. package/docs/pilot-cases.md +58 -0
  76. package/docs/pilot-recall.md +124 -0
  77. package/docs/pilot-report.md +52 -0
  78. package/docs/validation/alert-outcome-evaluation-2026-11-05.json +2935 -0
  79. package/docs/validation/cvss-v4-reference-parity-2026-11-05.json +93 -0
  80. package/docs/validation/rehearsal-accepted-2026-11-05.json +175 -0
  81. package/docs/validation/rehearsal-unknown-2026-11-05.json +175 -0
  82. package/docs/vendor/cvss-v4-LICENSE.txt +22 -0
  83. package/docs/vendor/cvss-v4-provenance.json +38 -0
  84. package/examples/agent-advisories-2026.json +145 -0
  85. package/examples/agent-advisory-cases-2026.json +397 -0
  86. package/examples/libraries.example.txt +4 -2
  87. package/examples/libraries.example.yaml +2 -0
  88. package/examples/offline-advisory-preview.mjs +42 -0
  89. package/examples/rehearsal.json +75 -0
  90. package/examples/systems.example.yaml +4 -0
  91. package/package.json +23 -7
  92. package/docs/quality-review.md +0 -104
@@ -0,0 +1,3 @@
1
+ import type { CvssV4BaseScore } from './types.js';
2
+ /** Validate the complete supplied vector, then explicitly project CVSS-B only. */
3
+ export declare function cvssV4BaseScore(vector: unknown): CvssV4BaseScore | undefined;
package/dist/cvss4.js ADDED
@@ -0,0 +1,39 @@
1
+ import { referenceBaseScore, referenceMetrics } from './vendor/cvss4-reference.js';
2
+ const metricOrder = Object.keys(referenceMetrics);
3
+ const baseMetrics = metricOrder.slice(0, 11);
4
+ /** Validate the complete supplied vector, then explicitly project CVSS-B only. */
5
+ export function cvssV4BaseScore(vector) {
6
+ if (typeof vector !== 'string' || vector.length > 1024 || !vector.startsWith('CVSS:4.0/'))
7
+ return undefined;
8
+ const parts = vector.split('/');
9
+ if (parts.length < 12 || parts.length > 33)
10
+ return undefined;
11
+ const selected = Object.fromEntries(metricOrder.map((metric) => [metric, 'X']));
12
+ let previous = -1;
13
+ for (const part of parts.slice(1)) {
14
+ const pair = part.split(':');
15
+ if (pair.length !== 2)
16
+ return undefined;
17
+ const [metric, value] = pair;
18
+ const index = metricOrder.indexOf(metric);
19
+ if (index <= previous || !referenceMetrics[metric]?.includes(value))
20
+ return undefined;
21
+ selected[metric] = value;
22
+ previous = index;
23
+ }
24
+ if (baseMetrics.some((metric) => selected[metric] === 'X'))
25
+ return undefined;
26
+ const baseVector = `CVSS:4.0/${baseMetrics.map((metric) => `${metric}:${selected[metric]}`).join('/')}`;
27
+ // Source-supplied threat/environment/supplemental values are not local deployment facts.
28
+ for (const metric of metricOrder.slice(11))
29
+ selected[metric] = 'X';
30
+ try {
31
+ const score = referenceBaseScore(selected);
32
+ if (!Number.isFinite(score) || score < 0 || score > 10)
33
+ return undefined;
34
+ return { vector, base_vector: baseVector, score, context_removed: vector !== baseVector };
35
+ }
36
+ catch {
37
+ return undefined;
38
+ }
39
+ }
@@ -13,13 +13,45 @@ export interface EmailReceipt {
13
13
  rejected: string[];
14
14
  }
15
15
  export type EmailSender = (message: EmailMessage) => Promise<EmailReceipt>;
16
+ /**
17
+ * What the mail transport's transaction log shows about one SMTP session. "No MAIL FROM was logged"
18
+ * proves that none was written only if the log reports what the client writes. That is shown by a
19
+ * logged client command (its EHLO comes before anything else), or by a session that ended before
20
+ * the server said anything (a refused connection, a failed TLS handshake), where there was nothing
21
+ * to write. Server replies without any client command mean the log cannot be relied on.
22
+ */
23
+ export declare function smtpTranscript(): {
24
+ observe: (entry: unknown, line: unknown) => void;
25
+ envelopeStarted: () => boolean;
26
+ nothingHandedOver: () => boolean;
27
+ };
16
28
  export declare const sendEmail: EmailSender;
17
29
  export declare function notificationText(job: Notification): {
18
30
  subject: string;
19
31
  text: string;
20
32
  };
21
- /** Sends due jobs; "accepted" means the destination accepted the request, not that a human read it. */
22
- export declare function deliverPending(store: Store, config: Config, http: HttpClient, now?: number, emailSender?: EmailSender, signal?: AbortSignal): Promise<{
33
+ /**
34
+ * A reason the SMTP address cannot be used, found without connecting. A user name or password
35
+ * containing %, @, : or / must be percent-encoded (a literal % is written %25).
36
+ */
37
+ /** Why a Slack webhook address cannot be used, or nothing. The text never repeats the address. */
38
+ export declare function slackProblem(address: string): string | undefined;
39
+ export declare function smtpProblem(address: string): string | undefined;
40
+ export interface DeliveryOptions {
41
+ /** The time treated as "now", in milliseconds. Defaults to the system clock. */
42
+ now?: number;
43
+ /** Replaces the built-in SMTP sender, for tests or a different transport. */
44
+ emailSender?: EmailSender;
45
+ /** Stops in-flight sends when aborted; queued jobs are left untouched. */
46
+ signal?: AbortSignal;
47
+ /** Where destination secrets are read from. Defaults to the process environment. */
48
+ credentials?: Readonly<Record<string, string | undefined>>;
49
+ }
50
+ /**
51
+ * Sends due jobs; "accepted" means the destination accepted the request, not that a human read it.
52
+ * Pass the optional settings as one object. The positional form is kept for existing callers.
53
+ */
54
+ export declare function deliverPending(store: Store, config: Config, http: HttpClient, options?: DeliveryOptions | number, positionalSender?: EmailSender, positionalSignal?: AbortSignal, positionalCredentials?: Readonly<Record<string, string | undefined>>): Promise<{
23
55
  accepted: number;
24
56
  failed: number;
25
57
  unknown: number;