IF Commons GitHub

logical/policies

Written to: 4 requirements: 4 proved, 0 partly, 0 failing, 0 with no test recorded. 0004-machine-probe-policies FR-001, 0004-machine-probe-policies FR-002, 0004-machine-probe-policies FR-003, 0004-machine-probe-policies FR-004

The policy pack for a machine that is observed and not managed (Stolos 067-adopt): each policy reads an observation and says pass, fail, warn or unknown, with the fix in words for the machine's operating system, and names the controls of NIST SP 800-53 Rev 5 (the public anchor, by identifier) it gives evidence for, so that no result is without a control. A policy that does not apply to what was observed gives no result.

import { POLICIES } from "./policies.ts";
POLICIES.find((p) => p.id === "disk-encryption")?.controls; // ["CRY-07"]

Source: commons/machine-probe/src/logical/policies.ts

3 of 12 exports are imported by a test of the run. A test that imports an export may not call it or check what it returns.

logical.Verdicttypeno test imports it
type Verdict = { readonly status: "pass" | "fail" | "warn" | "unknown"; readonly detail: string };

What a policy found: the finding and what was found.

logical.Policytypeno test imports it
type Policy = {
  readonly id: string;
  readonly title: string;
  readonly controls: readonly string[];
  /** The verdict, or nothing where the policy does not apply to what was observed. */
  readonly assert: (o: Observed, now: string) => Verdict | undefined;
  readonly fix: (o: Observed) => string;
};

One policy: its id, what it requires, the SP 800-53 Rev 5 controls it gives evidence for, how it judges an observation and how to make it pass on that machine.

logical.supportedOsfunctionno test imports it
function supportedOs(o: Observed): boolean | undefined

Whether the version of the operating system is still supported by its maker (a starter table), or nothing where it is not known.

logical.POLICIESconstno test imports it
const POLICIES: readonly Policy[]

The policy pack, in the order its results are shown.

logical.PolicyResulttypeno test imports it
type PolicyResult = PolicyOutcome & { readonly title: string; readonly detail: string; readonly fix: string };

A policy's result for one observation, with how to make it pass.

logical.evaluatefunctionno test imports it
function evaluate(o: Observed, now: string): readonly PolicyResult[]

Every policy that applies to an observation, in order, with its verdict, the controls it gives evidence for and how to make it pass; the instant now says how old the observation may be.

Verdicttypeno test imports it
type Verdict = { readonly status: "pass" | "fail" | "warn" | "unknown"; readonly detail: string };

What a policy found: the finding and what was found.

Policytypeno test imports it
type Policy = {
  readonly id: string;
  readonly title: string;
  readonly controls: readonly string[];
  /** The verdict, or nothing where the policy does not apply to what was observed. */
  readonly assert: (o: Observed, now: string) => Verdict | undefined;
  readonly fix: (o: Observed) => string;
};

One policy: its id, what it requires, the SP 800-53 Rev 5 controls it gives evidence for, how it judges an observation and how to make it pass on that machine.

supportedOsfunction
function supportedOs(o: Observed): boolean | undefined

Whether the version of the operating system is still supported by its maker (a starter table), or nothing where it is not known.

Imported by 4 tests of the run (4 passed, 0 failed): the library's results

POLICIESconst
const POLICIES: readonly Policy[]

The policy pack, in the order its results are shown.

Imported by 7 tests of the run (7 passed, 0 failed): the library's results

PolicyResulttypeno test imports it
type PolicyResult = PolicyOutcome & { readonly title: string; readonly detail: string; readonly fix: string };

A policy's result for one observation, with how to make it pass.

evaluatefunction
function evaluate(o: Observed, now: string): readonly PolicyResult[]

Every policy that applies to an observation, in order, with its verdict, the controls it gives evidence for and how to make it pass; the instant now says how old the observation may be.

Imported by 8 tests of the run (8 passed, 0 failed): the library's results

Titles, headings, exports, tables, columns and requirements. Esc closes.