@intellectual-frontiers/ergonex 0.2.6 → 0.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.
Files changed (83) hide show
  1. package/README.md +2 -0
  2. package/dist/desired.d.ts +27 -0
  3. package/dist/diff.d.ts +12 -0
  4. package/dist/doctor.d.ts +79 -0
  5. package/dist/findings.d.ts +85 -0
  6. package/dist/layout.d.ts +83 -0
  7. package/dist/manifest.d.ts +84 -0
  8. package/dist/mod.d.ts +29 -0
  9. package/dist/mod.js +3927 -0
  10. package/dist/modules/external.d.ts +31 -0
  11. package/dist/modules/mod.d.ts +10 -0
  12. package/dist/modules/name.d.ts +32 -0
  13. package/dist/modules/registry.d.ts +51 -0
  14. package/dist/modules/types.d.ts +178 -0
  15. package/dist/places.d.ts +35 -0
  16. package/dist/plan.d.ts +176 -0
  17. package/dist/platform/k-args.d.ts +7 -0
  18. package/dist/policy.d.ts +39 -0
  19. package/dist/portable.d.ts +111 -0
  20. package/dist/render.d.ts +95 -0
  21. package/dist/setup/evidence.d.ts +58 -0
  22. package/dist/shell/block.d.ts +45 -0
  23. package/dist/shell/mod.d.ts +8 -0
  24. package/dist/shell/snippet.d.ts +43 -0
  25. package/dist/state-record.d.ts +59 -0
  26. package/dist/state.d.ts +64 -0
  27. package/dist/templates/data.d.ts +25 -0
  28. package/dist/templates/hooks.d.ts +13 -0
  29. package/dist/templates/mod.d.ts +16 -0
  30. package/dist/tools/catalog.d.ts +70 -0
  31. package/dist/types.d.ts +51 -0
  32. package/dist/vendor/ts/githost/capabilities.d.ts +18 -0
  33. package/dist/vendor/ts/githost/git.d.ts +16 -0
  34. package/dist/vendor/ts/githost/github.d.ts +15 -0
  35. package/dist/vendor/ts/githost/gitlab.d.ts +15 -0
  36. package/dist/vendor/ts/githost/mod.d.ts +29 -0
  37. package/dist/vendor/ts/githost/remote.d.ts +59 -0
  38. package/dist/vendor/ts/githost/types.d.ts +101 -0
  39. package/dist/vendor/ts/kernel/archive.d.ts +147 -0
  40. package/dist/vendor/ts/kernel/assess.d.ts +247 -0
  41. package/dist/vendor/ts/kernel/attest.d.ts +164 -0
  42. package/dist/vendor/ts/kernel/base64.d.ts +24 -0
  43. package/dist/vendor/ts/kernel/cbor.d.ts +39 -0
  44. package/dist/vendor/ts/kernel/cms.d.ts +106 -0
  45. package/dist/vendor/ts/kernel/cose.d.ts +34 -0
  46. package/dist/vendor/ts/kernel/crypt.d.ts +30 -0
  47. package/dist/vendor/ts/kernel/csv.d.ts +38 -0
  48. package/dist/vendor/ts/kernel/der.d.ts +67 -0
  49. package/dist/vendor/ts/kernel/documentation.d.ts +118 -0
  50. package/dist/vendor/ts/kernel/dsse.d.ts +137 -0
  51. package/dist/vendor/ts/kernel/evidence.d.ts +212 -0
  52. package/dist/vendor/ts/kernel/glob.d.ts +64 -0
  53. package/dist/vendor/ts/kernel/grc.d.ts +356 -0
  54. package/dist/vendor/ts/kernel/http.d.ts +46 -0
  55. package/dist/vendor/ts/kernel/json5.d.ts +46 -0
  56. package/dist/vendor/ts/kernel/layers.d.ts +35 -0
  57. package/dist/vendor/ts/kernel/md5.d.ts +19 -0
  58. package/dist/vendor/ts/kernel/media-types.d.ts +28 -0
  59. package/dist/vendor/ts/kernel/mod.d.ts +89 -0
  60. package/dist/vendor/ts/kernel/ocsf-types.auto.d.ts +4374 -0
  61. package/dist/vendor/ts/kernel/ocsf.d.ts +160 -0
  62. package/dist/vendor/ts/kernel/oscal.d.ts +356 -0
  63. package/dist/vendor/ts/kernel/otel.d.ts +365 -0
  64. package/dist/vendor/ts/kernel/otlp.d.ts +83 -0
  65. package/dist/vendor/ts/kernel/png.d.ts +124 -0
  66. package/dist/vendor/ts/kernel/render.d.ts +111 -0
  67. package/dist/vendor/ts/kernel/schedule.d.ts +207 -0
  68. package/dist/vendor/ts/kernel/semver.d.ts +94 -0
  69. package/dist/vendor/ts/kernel/sha256.d.ts +29 -0
  70. package/dist/vendor/ts/kernel/signals.d.ts +371 -0
  71. package/dist/vendor/ts/kernel/sigv4.d.ts +67 -0
  72. package/dist/vendor/ts/kernel/test-record.d.ts +222 -0
  73. package/dist/vendor/ts/kernel/test-report.d.ts +294 -0
  74. package/dist/vendor/ts/kernel/toml.d.ts +51 -0
  75. package/dist/vendor/ts/kernel/trace.d.ts +169 -0
  76. package/dist/vendor/ts/kernel/ts-literal.d.ts +62 -0
  77. package/dist/vendor/ts/kernel/uuid.d.ts +53 -0
  78. package/dist/vendor/ts/kernel/webauthn.d.ts +212 -0
  79. package/dist/vendor/ts/kernel/xml.d.ts +73 -0
  80. package/dist/vendor/ts/kernel/yaml.d.ts +44 -0
  81. package/dist/vendor/ts/runtime/http-client.d.ts +149 -0
  82. package/ergonex.mjs +3480 -3765
  83. package/package.json +19 -5
@@ -0,0 +1,160 @@
1
+ import { type Assessment, type Finding, type Instant, type Outcome, type Severity, type SubjectRef } from "./grc.js";
2
+ import { type OcsfCloudResourcesInventoryInfo, type OcsfCompliance, type OcsfComplianceFinding, type OcsfDevice, type OcsfDeviceInventoryInfo, type OcsfFindingInfo, type OcsfMetadata, type OcsfOpenObject, type OcsfProduct, type OcsfResourceDetails, type OcsfUser, type OcsfUserInventoryInfo, type OcsfVulnerability, type OcsfVulnerabilityFinding } from "./ocsf-types.auto.js";
3
+ export * from "./ocsf-types.auto.js";
4
+ /** `T` with the members `K` present: what this module always writes of an attribute OCSF leaves optional. */
5
+ export type Present<T, K extends keyof T> = T & {
6
+ readonly [P in K]-?: Exclude<T[P], undefined>;
7
+ };
8
+ /** The metadata an event carries beyond the schema version and the product: an event id, the tenant, a correlation id, labels, ... */
9
+ export type MetadataExtra = Partial<Omit<OcsfMetadata, "version" | "product">>;
10
+ /** OCSF's `severity_id` (every class here has the same): 0 Unknown, 1 Informational, 2 Low, 3 Medium, 4 High, 5 Critical, 6 Fatal, 99 Other. */
11
+ export type OcsfSeverityId = OcsfComplianceFinding["severity_id"];
12
+ /** The captions of the severities this module writes. */
13
+ export type OcsfSeverity = "Unknown" | "Informational" | "Low" | "Medium" | "High" | "Critical";
14
+ /** A severity as OCSF's `severity_id` and its caption. */
15
+ export declare const OCSF_SEVERITY: Readonly<Record<Severity, {
16
+ readonly id: OcsfSeverityId;
17
+ readonly caption: OcsfSeverity;
18
+ }>>;
19
+ /** The activities of a finding (classes 2002 and 2003): 1 Create, 2 Update, 3 Close. */
20
+ export type FindingActivity = "create" | "update" | "close";
21
+ /** The activities of an inventory (classes 5001, 5003 and 5023): 1 Log, 2 Collect. */
22
+ export type InventoryActivity = "log" | "collect";
23
+ /** The members every event of a class has here: its class, category, activity and type, with their captions. */
24
+ type Envelope<C extends number, Cat extends number, A extends number, T extends number, Name extends string, CatName extends string> = {
25
+ readonly class_uid: C;
26
+ readonly class_name: Name;
27
+ readonly category_uid: Cat;
28
+ readonly category_name: CatName;
29
+ readonly activity_id: A;
30
+ readonly activity_name: string;
31
+ readonly type_uid: T;
32
+ readonly type_name: `${Name}: ${string}`;
33
+ readonly severity: OcsfSeverity;
34
+ readonly metadata: OcsfMetadata;
35
+ };
36
+ /** OCSF's compliance `status_id`: 0 Unknown, 1 Pass, 2 Warning, 3 Fail, 99 Other. */
37
+ export type OcsfComplianceStatusId = Exclude<OcsfCompliance["status_id"], undefined>;
38
+ /** The captions of the compliance statuses this module writes. */
39
+ export type OcsfComplianceStatus = "Unknown" | "Pass" | "Warning" | "Fail" | "Not Applicable";
40
+ /** A finding's `status_id` (OCSF Findings): 0 Unknown, 1 New, 2 In Progress, 3 Suppressed, 4 Resolved, 5 Archived, 6 Deleted, 99 Other. */
41
+ export type OcsfFindingStatusId = Exclude<OcsfComplianceFinding["status_id"], undefined>;
42
+ /** The captions of the finding statuses this module writes. */
43
+ export type OcsfFindingStatus = "Unknown" | "New" | "In Progress" | "Suppressed" | "Resolved";
44
+ /** A resource as this module writes it: its uid, name and type always there. */
45
+ export type ResourceEvent = Present<OcsfResourceDetails, "uid" | "name" | "type">;
46
+ /** An OCSF 1.9.0 Compliance Finding (class 2003) as this module writes it. */
47
+ export type ComplianceFindingEvent = OcsfComplianceFinding & Envelope<2003, 2, 1 | 2 | 3, 200301 | 200302 | 200303, "Compliance Finding", "Findings"> & {
48
+ readonly status_id: OcsfFindingStatusId;
49
+ readonly status: OcsfFindingStatus;
50
+ readonly message: string;
51
+ readonly finding_info: Present<OcsfFindingInfo, "title" | "created_time" | "types">;
52
+ readonly compliance: Present<OcsfCompliance, "control" | "standards" | "status_id" | "status" | "status_code"> & {
53
+ readonly status_id: OcsfComplianceStatusId;
54
+ readonly status: OcsfComplianceStatus;
55
+ };
56
+ readonly resources: readonly ResourceEvent[];
57
+ };
58
+ /** What a Compliance Finding needs beyond the finding: the product, and optionally the activity, the standards and more metadata. */
59
+ export type ComplianceFindingOptions = {
60
+ readonly product: OcsfProduct;
61
+ /** `create` (the default) for a finding first reported, `update` for one reported again, `close` for one resolved. */
62
+ readonly activity?: FindingActivity;
63
+ /** The standards the control is checked against; by default the catalogs the control implements, or its own id where it implements none. */
64
+ readonly standards?: (f: Finding) => readonly string[];
65
+ readonly metadata?: MetadataExtra;
66
+ };
67
+ /** How an outcome maps to the compliance status and to the finding's status (the table in the module's documentation). */
68
+ export declare function ocsfStatus(outcome: Outcome, status: Outcome): {
69
+ readonly compliance: {
70
+ readonly id: OcsfComplianceStatusId;
71
+ readonly caption: OcsfComplianceStatus;
72
+ };
73
+ readonly finding: {
74
+ readonly id: OcsfFindingStatusId;
75
+ readonly caption: OcsfFindingStatus;
76
+ };
77
+ };
78
+ /** A finding as an OCSF 1.9.0 Compliance Finding. */
79
+ export declare function complianceFinding(f: Finding, options: ComplianceFindingOptions): ComplianceFindingEvent;
80
+ /** Every finding of an assessment as Compliance Findings, in the assessment's order. */
81
+ export declare function complianceFindings(a: Assessment, options: ComplianceFindingOptions): readonly ComplianceFindingEvent[];
82
+ /** Where a vulnerability finding stands: 1 New, 2 In Progress, 3 Suppressed (dismissed), 4 Resolved (fixed); unknown where not said. */
83
+ export type VulnerabilityStatus = "new" | "in-progress" | "suppressed" | "resolved";
84
+ /** A scanner's finding: its stable id and title, its severity and status where known, its vulnerabilities and what they affect. */
85
+ export type VulnerabilityInput = {
86
+ /** The finding's id at its source, the same in every report of it (`finding_info.uid`). */
87
+ readonly uid: string;
88
+ readonly title: string;
89
+ /** Its severity; 0 Unknown where not given. */
90
+ readonly severity?: Severity;
91
+ /** Its status; 0 Unknown where not given. */
92
+ readonly status?: VulnerabilityStatus;
93
+ /** The vulnerabilities (OCSF asks each for a CVE, a CWE or an advisory). */
94
+ readonly vulnerabilities: readonly [OcsfVulnerability, ...OcsfVulnerability[]];
95
+ /** The resources affected. */
96
+ readonly resources?: readonly OcsfResourceDetails[];
97
+ /** More of `finding_info`: `first_seen_time`, `data_sources`, `src_url`, ... */
98
+ readonly findingInfo?: Partial<Omit<OcsfFindingInfo, "uid" | "title">>;
99
+ };
100
+ /** What a Vulnerability Finding needs beyond the finding: the product, the instant it is reported, and optionally the activity and metadata. */
101
+ export type VulnerabilityOptions = {
102
+ readonly product: OcsfProduct;
103
+ readonly at: Instant;
104
+ readonly activity?: FindingActivity;
105
+ readonly metadata?: MetadataExtra;
106
+ };
107
+ /** An OCSF 1.9.0 Vulnerability Finding (class 2002) as this module writes it. */
108
+ export type VulnerabilityFindingEvent = OcsfVulnerabilityFinding & Envelope<2002, 2, 1 | 2 | 3, 200201 | 200202 | 200203, "Vulnerability Finding", "Findings"> & {
109
+ readonly status_id: OcsfFindingStatusId;
110
+ readonly status: OcsfFindingStatus;
111
+ readonly message: string;
112
+ readonly finding_info: Present<OcsfFindingInfo, "title">;
113
+ };
114
+ /** A scanner's finding as an OCSF 1.9.0 Vulnerability Finding. */
115
+ export declare function vulnerabilityFinding(v: VulnerabilityInput, options: VulnerabilityOptions): VulnerabilityFindingEvent;
116
+ /** What an inventory event needs: the product, the instant it was taken, whether it was collected (the default) or logged, more metadata. */
117
+ export type InventoryOptions = {
118
+ readonly product: OcsfProduct;
119
+ readonly at: Instant;
120
+ readonly activity?: InventoryActivity;
121
+ readonly metadata?: MetadataExtra;
122
+ /** What the source said that OCSF has no attribute for (`unmapped`). */
123
+ readonly unmapped?: OcsfOpenObject;
124
+ };
125
+ /** An OCSF 1.9.0 Device Inventory Info event (class 5001) as this module writes it. */
126
+ export type DeviceInventoryEvent = OcsfDeviceInventoryInfo & Envelope<5001, 5, 1 | 2, 500101 | 500102, "Device Inventory Info", "Discovery"> & {
127
+ readonly severity_id: 1;
128
+ };
129
+ /** An OCSF 1.9.0 User Inventory Info event (class 5003) as this module writes it. */
130
+ export type UserInventoryEvent = OcsfUserInventoryInfo & Envelope<5003, 5, 1 | 2, 500301 | 500302, "User Inventory Info", "Discovery"> & {
131
+ readonly severity_id: 1;
132
+ };
133
+ /** An OCSF 1.9.0 Cloud Resources Inventory Info event (class 5023) as this module writes it. */
134
+ export type CloudResourcesInventoryEvent = OcsfCloudResourcesInventoryInfo & Envelope<5023, 5, 1 | 2, 502301 | 502302, "Cloud Resources Inventory Info", "Discovery"> & {
135
+ readonly severity_id: 1;
136
+ readonly resources: readonly OcsfResourceDetails[];
137
+ };
138
+ /** Any event this module writes. */
139
+ export type OcsfEvent = ComplianceFindingEvent | VulnerabilityFindingEvent | DeviceInventoryEvent | UserInventoryEvent | CloudResourcesInventoryEvent;
140
+ /** A device as an OCSF 1.9.0 Device Inventory Info event. */
141
+ export declare function deviceInventoryInfo(device: OcsfDevice, options: InventoryOptions): DeviceInventoryEvent;
142
+ /** A user (a person, or an account in some system) as an OCSF 1.9.0 User Inventory Info event. */
143
+ export declare function userInventoryInfo(user: OcsfUser, options: InventoryOptions): UserInventoryEvent;
144
+ /** Resources of a cloud or a service (a repository, a bucket, a tenant, ...) as an OCSF 1.9.0 Cloud Resources Inventory Info event. */
145
+ export declare function cloudResourcesInventoryInfo(resources: readonly OcsfResourceDetails[], options: InventoryOptions): CloudResourcesInventoryEvent;
146
+ /** OCSF 1.9.0's device `type_id`. */
147
+ export type OcsfDeviceTypeId = OcsfDevice["type_id"];
148
+ /** The device type captions, by `type_id`. */
149
+ export declare const OCSF_DEVICE_TYPE: Readonly<Record<OcsfDeviceTypeId, string>>;
150
+ /** A subject of an assessment, with what is known of it beyond its kind and id. */
151
+ export type InventoryItem = {
152
+ readonly subject: SubjectRef;
153
+ readonly name?: string;
154
+ readonly hostname?: string;
155
+ readonly type?: OcsfDeviceTypeId;
156
+ };
157
+ /** A subject of an assessment as a Device Inventory Info event: the device's uid is `kind:id`, and the subject's kind is its group. */
158
+ export declare function inventoryInfo(item: InventoryItem, options: InventoryOptions): DeviceInventoryEvent;
159
+ /** The subjects of an assessment as Device Inventory Info events, in the order of their kinds and then ids, each subject once. */
160
+ export declare function inventory(items: readonly InventoryItem[], options: InventoryOptions): readonly DeviceInventoryEvent[];
@@ -0,0 +1,356 @@
1
+ import { type Risk } from "./assess.js";
2
+ import { type Assessment, type ControlRef, type ControlSummary, type Instant } from "./grc.js";
3
+ import { type Uuid } from "./uuid.js";
4
+ /** The OSCAL version written. */
5
+ export declare const OSCAL_VERSION = "1.2.3";
6
+ /** NIST SP 800-30 Rev. 1, the system a risk's likelihood, impact and level facets are named in. */
7
+ export declare const SP800_30 = "https://doi.org/10.6028/NIST.SP.800-30r1";
8
+ /** The `identifier-type` of a system id that is a UUID. */
9
+ export declare const RFC4122 = "https://ietf.org/rfc/rfc4122";
10
+ /** An OSCAL property: a name, a value, and the namespace the name is defined in where it is not OSCAL's. */
11
+ export type OscalProp = {
12
+ readonly name: string;
13
+ readonly value: string;
14
+ readonly ns?: string;
15
+ };
16
+ /** An OSCAL party: the organization a document is by. */
17
+ export type OscalParty = {
18
+ readonly uuid: Uuid;
19
+ readonly type: "organization" | "person";
20
+ readonly name: string;
21
+ };
22
+ /** An OSCAL document's metadata. */
23
+ export type OscalMetadata = {
24
+ readonly title: string;
25
+ readonly "last-modified": Instant;
26
+ readonly version: string;
27
+ readonly "oscal-version": typeof OSCAL_VERSION;
28
+ readonly parties?: readonly OscalParty[];
29
+ };
30
+ /** A back-matter resource. */
31
+ export type OscalResource = {
32
+ readonly uuid: Uuid;
33
+ readonly title: string;
34
+ readonly description?: string;
35
+ readonly props?: readonly OscalProp[];
36
+ readonly rlinks?: readonly {
37
+ readonly href: string;
38
+ }[];
39
+ };
40
+ /** A document's back matter. */
41
+ export type OscalBackMatter = {
42
+ readonly resources: readonly OscalResource[];
43
+ };
44
+ /** An inventory item: a subject of an assessment. */
45
+ export type OscalInventoryItem = {
46
+ readonly uuid: Uuid;
47
+ readonly description: string;
48
+ readonly props: readonly OscalProp[];
49
+ };
50
+ /** A reference from an observation to the subject it observed. */
51
+ export type OscalSubjectReference = {
52
+ readonly "subject-uuid": Uuid;
53
+ readonly type: "inventory-item";
54
+ readonly title: string;
55
+ };
56
+ /** Evidence an observation relied on, here the SHA-256 of a piece of evidence. */
57
+ export type OscalRelevantEvidence = {
58
+ readonly description: string;
59
+ readonly props: readonly OscalProp[];
60
+ };
61
+ /** An observation: one finding of one control on one subject. */
62
+ export type OscalObservation = {
63
+ readonly uuid: Uuid;
64
+ readonly title: string;
65
+ readonly description: string;
66
+ readonly props: readonly OscalProp[];
67
+ readonly methods: readonly ("EXAMINE" | "INTERVIEW" | "TEST" | "UNKNOWN")[];
68
+ readonly types: readonly string[];
69
+ readonly subjects: readonly OscalSubjectReference[];
70
+ readonly "relevant-evidence"?: readonly OscalRelevantEvidence[];
71
+ readonly collected: Instant;
72
+ readonly remarks?: string;
73
+ };
74
+ /** The status of an OSCAL finding's target. */
75
+ export type OscalTargetStatus = {
76
+ readonly state: "satisfied" | "not-satisfied";
77
+ readonly reason?: "pass" | "fail" | "other";
78
+ };
79
+ /** An OSCAL finding: what the observations say of one control. */
80
+ export type OscalFinding = {
81
+ readonly uuid: Uuid;
82
+ readonly title: string;
83
+ readonly description: string;
84
+ readonly props: readonly OscalProp[];
85
+ readonly target: {
86
+ readonly type: "objective-id";
87
+ readonly "target-id": string;
88
+ readonly status: OscalTargetStatus;
89
+ };
90
+ readonly "related-observations"?: readonly {
91
+ readonly "observation-uuid": Uuid;
92
+ }[];
93
+ };
94
+ /** The controls a result reviewed. */
95
+ export type OscalReviewedControls = {
96
+ readonly "control-selections": readonly ({
97
+ readonly "include-controls": readonly {
98
+ readonly "control-id": string;
99
+ }[];
100
+ } | {
101
+ readonly "include-all": Readonly<Record<string, never>>;
102
+ })[];
103
+ };
104
+ /** One result of an assessment. */
105
+ export type OscalResult = {
106
+ readonly uuid: Uuid;
107
+ readonly title: string;
108
+ readonly description: string;
109
+ readonly start: Instant;
110
+ readonly "local-definitions"?: {
111
+ readonly "inventory-items": readonly OscalInventoryItem[];
112
+ };
113
+ readonly "reviewed-controls": OscalReviewedControls;
114
+ readonly observations?: readonly OscalObservation[];
115
+ readonly findings?: readonly OscalFinding[];
116
+ };
117
+ /** An OSCAL assessment-results document. */
118
+ export type OscalAssessmentResults = {
119
+ readonly "assessment-results": {
120
+ readonly uuid: Uuid;
121
+ readonly metadata: OscalMetadata;
122
+ readonly "import-ap": {
123
+ readonly href: string;
124
+ };
125
+ readonly results: readonly OscalResult[];
126
+ readonly "back-matter"?: OscalBackMatter;
127
+ };
128
+ };
129
+ /** The status of an OSCAL risk. */
130
+ export type OscalRiskStatus = "open" | "investigating" | "remediating" | "deviation-requested" | "deviation-approved" | "closed";
131
+ /** A characterization of a risk: who made it, and its facets. */
132
+ export type OscalCharacterization = {
133
+ readonly origin: {
134
+ readonly actors: readonly {
135
+ readonly type: "party";
136
+ readonly "actor-uuid": Uuid;
137
+ }[];
138
+ };
139
+ readonly facets: readonly {
140
+ readonly name: string;
141
+ readonly system: string;
142
+ readonly value: string;
143
+ }[];
144
+ };
145
+ /** An OSCAL risk. */
146
+ export type OscalRisk = {
147
+ readonly uuid: Uuid;
148
+ readonly title: string;
149
+ readonly description: string;
150
+ readonly statement: string;
151
+ readonly props?: readonly OscalProp[];
152
+ readonly status: OscalRiskStatus;
153
+ readonly characterizations?: readonly OscalCharacterization[];
154
+ readonly "related-observations"?: readonly {
155
+ readonly "observation-uuid": Uuid;
156
+ }[];
157
+ };
158
+ /** An item of a plan of action and milestones. */
159
+ export type OscalPoamItem = {
160
+ readonly uuid: Uuid;
161
+ readonly title: string;
162
+ readonly description: string;
163
+ readonly props?: readonly OscalProp[];
164
+ readonly "related-observations"?: readonly {
165
+ readonly "observation-uuid": Uuid;
166
+ }[];
167
+ readonly "related-risks": readonly {
168
+ readonly "risk-uuid": Uuid;
169
+ }[];
170
+ };
171
+ /** An OSCAL plan-of-action-and-milestones document. */
172
+ export type OscalPoam = {
173
+ readonly "plan-of-action-and-milestones": {
174
+ readonly uuid: Uuid;
175
+ readonly metadata: OscalMetadata;
176
+ readonly "local-definitions"?: {
177
+ readonly "inventory-items": readonly OscalInventoryItem[];
178
+ };
179
+ readonly observations?: readonly OscalObservation[];
180
+ readonly risks?: readonly OscalRisk[];
181
+ readonly "poam-items": readonly OscalPoamItem[];
182
+ };
183
+ };
184
+ /** A catalog control a component implements, and how. */
185
+ export type OscalImplementedRequirement = {
186
+ readonly uuid: Uuid;
187
+ readonly "control-id": string;
188
+ readonly description: string;
189
+ readonly props: readonly OscalProp[];
190
+ };
191
+ /** A component's implementation of the controls of one catalog. */
192
+ export type OscalControlImplementation = {
193
+ readonly uuid: Uuid;
194
+ readonly source: string;
195
+ readonly description: string;
196
+ readonly "implemented-requirements": readonly OscalImplementedRequirement[];
197
+ };
198
+ /** The types of a defined component (OSCAL 1.2.3 `defined-component/type`; 1.2 added `region`, `zone`, `resource-container` and `network`). */
199
+ export declare const OSCAL_COMPONENT_TYPES: readonly ["interconnection", "software", "hardware", "service", "policy", "physical", "process-procedure", "plan", "guidance", "standard", "validation", "region", "zone", "resource-container", "network"];
200
+ /** The type of a component. */
201
+ export type OscalComponentType = (typeof OSCAL_COMPONENT_TYPES)[number];
202
+ /** A component of a component definition. */
203
+ export type OscalDefinedComponent = {
204
+ readonly uuid: Uuid;
205
+ readonly type: OscalComponentType;
206
+ readonly title: string;
207
+ readonly description: string;
208
+ readonly props?: readonly OscalProp[];
209
+ readonly "control-implementations"?: readonly OscalControlImplementation[];
210
+ };
211
+ /** An OSCAL component-definition document. */
212
+ export type OscalComponentDefinition = {
213
+ readonly "component-definition": {
214
+ readonly uuid: Uuid;
215
+ readonly metadata: OscalMetadata;
216
+ readonly components: readonly OscalDefinedComponent[];
217
+ readonly "back-matter"?: OscalBackMatter;
218
+ };
219
+ };
220
+ /** How far a control is implemented. */
221
+ export type OscalImplementationState = "implemented" | "partial" | "planned" | "alternative" | "not-applicable";
222
+ /** An SSP's statement of one catalog control. */
223
+ export type OscalSspRequirement = {
224
+ readonly uuid: Uuid;
225
+ readonly "control-id": string;
226
+ readonly props: readonly OscalProp[];
227
+ readonly "by-components": readonly {
228
+ readonly "component-uuid": Uuid;
229
+ readonly uuid: Uuid;
230
+ readonly description: string;
231
+ readonly "implementation-status": {
232
+ readonly state: OscalImplementationState;
233
+ };
234
+ }[];
235
+ };
236
+ /** An OSCAL system-security-plan document, minimal: the system, its users and components, and how far each control is implemented. */
237
+ export type OscalSsp = {
238
+ readonly "system-security-plan": {
239
+ readonly uuid: Uuid;
240
+ readonly metadata: OscalMetadata;
241
+ readonly "import-profile": {
242
+ readonly href: string;
243
+ };
244
+ readonly "system-characteristics": {
245
+ readonly "system-ids": readonly {
246
+ readonly "identifier-type": string;
247
+ readonly id: string;
248
+ }[];
249
+ readonly "system-name": string;
250
+ readonly description: string;
251
+ readonly "system-information": {
252
+ readonly "information-types": readonly {
253
+ readonly uuid: Uuid;
254
+ readonly title: string;
255
+ readonly description: string;
256
+ }[];
257
+ };
258
+ readonly status: {
259
+ readonly state: "operational" | "under-development" | "under-major-modification" | "disposition" | "other";
260
+ };
261
+ readonly "authorization-boundary": {
262
+ readonly description: string;
263
+ };
264
+ };
265
+ readonly "system-implementation": {
266
+ readonly users: readonly {
267
+ readonly uuid: Uuid;
268
+ readonly title: string;
269
+ }[];
270
+ readonly components: readonly {
271
+ readonly uuid: Uuid;
272
+ readonly type: "this-system";
273
+ readonly title: string;
274
+ readonly description: string;
275
+ readonly status: {
276
+ readonly state: "operational";
277
+ };
278
+ }[];
279
+ readonly "inventory-items"?: readonly OscalInventoryItem[];
280
+ };
281
+ readonly "control-implementation": {
282
+ readonly description: string;
283
+ readonly "implemented-requirements": readonly OscalSspRequirement[];
284
+ };
285
+ };
286
+ };
287
+ /** Any document this module writes. */
288
+ export type OscalDocument = OscalAssessmentResults | OscalPoam | OscalComponentDefinition | OscalSsp;
289
+ /** What every document needs: the namespace of its UUIDs, its metadata, and the namespace of the properties this module names. */
290
+ export type OscalOptions = {
291
+ /** The namespace every `uuid` is a version 5 UUID in. */
292
+ readonly namespace: Uuid;
293
+ readonly lastModified: Instant;
294
+ readonly version: string;
295
+ /** The namespace (a URI) of the properties this module defines: `outcome`, `status`, `severity`, `control`, `sha256`, ... */
296
+ readonly propNamespace: string;
297
+ /** The document's title; each function has a default. */
298
+ readonly title?: string;
299
+ /** The organization the document is by, as a party. */
300
+ readonly organization?: string;
301
+ /** The OSCAL `control-id` of a catalog control; by default its id as the catalog has it. */
302
+ readonly controlId?: (ref: ControlRef) => string;
303
+ /** The `href` of a catalog (a control implementation's `source`); by default a back-matter resource of the document. */
304
+ readonly catalogHref?: (catalog: string) => string;
305
+ };
306
+ /**
307
+ * An assessment as OSCAL assessment results: one result, its subjects as inventory items, each finding an observation, and each control
308
+ * reviewed (each catalog control the assessment's controls implement, or a control that implements none) an OSCAL finding whose target is
309
+ * satisfied or not by the join of the outcomes of the newest findings of its controls. `assessmentPlan` is the `import-ap` href; by default
310
+ * a back-matter resource that stands for the plan.
311
+ */
312
+ export declare function assessmentResults(a: Assessment, o: OscalOptions & {
313
+ readonly assessmentPlan?: string;
314
+ }): Promise<OscalAssessmentResults>;
315
+ /**
316
+ * A plan of action and milestones: for each finding whose outcome is `fail`, `warn`, `gap`, `error` or `accepted`, an observation, a risk
317
+ * (`open`, or `deviation-approved` where a waiver accepted it) and a POA&M item; and for each risk of a register given, a risk with its
318
+ * NIST SP 800-30 likelihood, impact and level as facets and a POA&M item. A finding's risk and item are named by its control and subject
319
+ * (not its time), so the same open finding keeps its UUIDs from one assessment to the next.
320
+ */
321
+ export declare function poam(a: Assessment, risks: readonly Risk[], o: OscalOptions): Promise<OscalPoam>;
322
+ /** The component a component definition describes. */
323
+ export type ComponentInput = {
324
+ readonly id: string;
325
+ readonly title: string;
326
+ readonly description: string;
327
+ readonly type?: OscalComponentType;
328
+ readonly version?: string;
329
+ };
330
+ /**
331
+ * A component definition of one component: for each catalog its controls implement (in the catalogs' order), a control implementation
332
+ * whose implemented requirements are those catalog controls, each saying which controls implement it. A catalog's `source` is
333
+ * `catalogHref`'s, or a back-matter resource that stands for it.
334
+ */
335
+ export declare function componentDefinition(controls: readonly ControlSummary[], component: ComponentInput, o: OscalOptions): Promise<OscalComponentDefinition>;
336
+ /** The system a security plan describes, and the profile (baseline) it imports. */
337
+ export type SystemInput = {
338
+ readonly id: string;
339
+ readonly name: string;
340
+ readonly description: string;
341
+ readonly profile: string;
342
+ readonly boundary?: string;
343
+ readonly informationType?: {
344
+ readonly title: string;
345
+ readonly description: string;
346
+ };
347
+ readonly user?: string;
348
+ };
349
+ /**
350
+ * A minimal system security plan of what is implemented: the system as one `this-system` component, the assessment's subjects as its
351
+ * inventory, and each catalog control its controls implement (or control that implements none) with its implementation status from the
352
+ * coverage of the newest findings of its controls.
353
+ */
354
+ export declare function systemSecurityPlan(a: Assessment, system: SystemInput, o: OscalOptions): Promise<OscalSsp>;
355
+ /** A document as OSCAL JSON text: two-space indents and a final newline, its members in the order this module writes them. */
356
+ export declare function renderOscal(doc: OscalDocument): string;