IF Commons GitHub

governance/rules

Written to: 6 requirements: 6 proved, 0 partly, 0 failing, 0 with no test recorded. 0002-grc-governance FR-007, 0002-grc-governance FR-001, 0002-grc-governance FR-003, 0002-grc-governance FR-005, 0002-grc-governance FR-002, 0002-grc-governance FR-008

What governance says about its documents, as pure functions: the URN of a control, the controls a crosswalk reaches, when a policy is next reviewed, whether an exception applies, the enforcement register a requirement's verification is a row of, and the problems of a set of documents (a control no framework holds, a check nothing names).

import { controlUrn, parseControlUrn } from "./rules.ts";
controlUrn("nist-800-53", "5.2.0", "AC-2"); // "urn:grc:nist-800-53:5.2.0:AC-2"
parseControlUrn("urn:grc:a:1:B-1"); // { kind: "ok", value: { framework: "a", version: "1", control: "B-1" } }

Source: commons/grc/src/governance/rules.ts

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

governance.ControlReftypeno test imports it
type ControlRef = { readonly framework: string; readonly version: string; readonly control: string };

The parts of a control's URN.

governance.controlUrnfunctionno test imports it
function controlUrn(framework: string, version: string, control: string): string

The stable URN of a control: urn:grc:<framework>:<version>:<control>.

governance.parseControlUrnfunctionno test imports it
function parseControlUrn(urn: string): Result<ControlRef, string>

The parts of a control's URN, or why the text is not one.

governance.controlUrnsfunctionno test imports it
function controlUrns(frameworks: readonly (Document & { readonly version: string; readonly title: string; readonly controls: readonly ObjectOf<{ id: Decoder<string>; title: Decoder<string>; statement: Decoder<string>; }, { family: Decoder<string>; }>[]; } & { readonly publisher?: string | undefined; readonly source?: string | undefined; })[]): readonly string[]

The URNs of every control of the frameworks.

governance.Mappedtypeno test imports it
type Mapped = { readonly urn: string; readonly relationship: Relationship; readonly strength: number; readonly via: string };

A control a crosswalk reaches.

governance.mappedControlsfunctionno test imports it
function mappedControls(crosswalks: readonly (Document & { readonly mappings: readonly ObjectOf<{ from: Decoder<string>; to: Decoder<string>; relationship: Decoder<"equal" | "intersects-with" | "no-relationship" | "subset-of" | "superset-of">; strength: Decoder<number>; }, { note: Decoder<string>; }>[]; } & {})[], urn: string): readonly Mapped[]

The controls reached from urn through the crosswalks, in both directions (a reverse mapping reads the relationship the other way), in the order of their URNs.

governance.reviewDuefunctionno test imports it
function reviewDue(p: Document & { readonly title: string; readonly scope: ObjectOf<{ platforms: Decoder<readonly string… (558 characters)
function reviewDue(p: Document & { readonly title: string; readonly scope: ObjectOf<{ platforms: Decoder<readonly string[]>; tags: Decoder<readonly string[]>; }, Record<never, never>>; readonly severity: "critical" | "high" | "info" | "low" | "medium"; readonly rationale: string; readonly controls: readonly string[]; readonly checks: readonly string[]; readonly owner: string; readonly review: ObjectOf<{ cadence: Decoder<string>; }, { lastReviewed: Decoder<string>; }>; } & { readonly exceptions?: readonly string[] | undefined; }): Result<string, string>

When a policy's review falls due: its cadence after the last review (or after it was created).

governance.exceptionAppliesfunctionno test imports it
function exceptionApplies(e: Document & { readonly excuses: ObjectOf<{ type: Decoder<"check" | "control" | "policy">; re… (600 characters)
function exceptionApplies(e: Document & { readonly excuses: ObjectOf<{ type: Decoder<"check" | "control" | "policy">; ref: Decoder<string>; }, Record<never, never>>; readonly subjects: readonly string[]; readonly reason: string; readonly approvedBy: string; readonly grantedAt: string; readonly expiresAt: string; } & { readonly acceptedRisk?: ObjectOf<{ owner: Decoder<string>; level: Decoder<"high" | "low" | "moderate" | "very-high" | "very-low">; reviewBy: Decoder<string>; }, Record<never, never>> | undefined; readonly inheritable?: boolean | undefined; }, subject: string, at: string): boolean

Whether an exception applies to a subject at an instant: after it is granted, before it expires, and covering the subject.

governance.EnforcementRowtypeno test imports it
type EnforcementRow = { readonly requirement: string; readonly mechanism: Mechanism; readonly by: string; readonly note: string };

A row of the enforcement register of Mizan (enforcement.tsv): a requirement, how it is enforced, by what.

governance.fromEnforcementRegisterfunctionno test imports it
function fromEnforcementRegister(tsv: string): Result<readonly EnforcementRow[], string>

The rows of an enforcement register's TSV (comment lines and the header skipped), or why a line is not a row.

governance.toEnforcementRegisterfunctionno test imports it
function toEnforcementRegister(requirements: readonly (Document & { readonly statement: string; readonly level: "MAY" | … (522 characters)
function toEnforcementRegister(requirements: readonly (Document & { readonly statement: string; readonly level: "MAY" | "MUST" | "SHOULD"; readonly controls: readonly string[]; readonly verification: ObjectOf<{ mechanism: Decoder<"check" | "gate" | "none" | "review">; by: Decoder<string>; }, { note: Decoder<string>; }>; } & { readonly validation?: ObjectOf<{ method: Decoder<"measure" | "review" | "scenario" | "stakeholder">; by: Decoder<string>; at: Decoder<string>; }, Record<never, never>> | undefined; })[]): string

The register's TSV of the verification of requirements, in the order given.

governance.GovernanceSettypeno test imports it
type GovernanceSet = {
  readonly frameworks: readonly Framework[];
  readonly crosswalks?: readonly Crosswalk[];
  readonly policies?: readonly Policy[];
  readonly checks?: readonly Check[];
  readonly requirements?: readonly Requirement[];
  readonly exceptions?: readonly Exception[];
};

What governanceProblems reads.

governance.GovernanceRuletypeno test imports it
type GovernanceRule =
  | "framework/duplicate-control"
  | "control/unknown"
  | "policy/unknown-check"
  | "policy/no-control"
  | "id/duplicate"
  | "duration/invalid"
  | "runner/unstable-kind"
  | "exception/excuses-nothing";

The rules of governanceProblems.

governance.GovernanceProblemtypeno test imports it
type GovernanceProblem = { readonly rule: GovernanceRule; readonly id: string; readonly message: string };

A problem of a set of governance documents.

governance.governanceProblemsfunctionno test imports it
function governanceProblems(set: GovernanceSet): readonly GovernanceProblem[]

Every problem of a set of governance documents, as data.

ControlReftypeno test imports it
type ControlRef = { readonly framework: string; readonly version: string; readonly control: string };

The parts of a control's URN.

controlUrnfunction
function controlUrn(framework: string, version: string, control: string): string

The stable URN of a control: urn:grc:<framework>:<version>:<control>.

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

parseControlUrnfunction
function parseControlUrn(urn: string): Result<ControlRef, string>

The parts of a control's URN, or why the text is not one.

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

controlUrnsfunction
function controlUrns(frameworks: readonly (Document & { readonly version: string; readonly title: string; readonly controls: readonly ObjectOf<{ id: Decoder<string>; title: Decoder<string>; statement: Decoder<string>; }, { family: Decoder<string>; }>[]; } & { readonly publisher?: string | undefined; readonly source?: string | undefined; })[]): readonly string[]

The URNs of every control of the frameworks.

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

Mappedtypeno test imports it
type Mapped = { readonly urn: string; readonly relationship: Relationship; readonly strength: number; readonly via: string };

A control a crosswalk reaches.

mappedControlsfunction
function mappedControls(crosswalks: readonly (Document & { readonly mappings: readonly ObjectOf<{ from: Decoder<string>; to: Decoder<string>; relationship: Decoder<"equal" | "intersects-with" | "no-relationship" | "subset-of" | "superset-of">; strength: Decoder<number>; }, { note: Decoder<string>; }>[]; } & {})[], urn: string): readonly Mapped[]

The controls reached from urn through the crosswalks, in both directions (a reverse mapping reads the relationship the other way), in the order of their URNs.

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

reviewDuefunction
function reviewDue(p: Document & { readonly title: string; readonly scope: ObjectOf<{ platforms: Decoder<readonly string… (558 characters)
function reviewDue(p: Document & { readonly title: string; readonly scope: ObjectOf<{ platforms: Decoder<readonly string[]>; tags: Decoder<readonly string[]>; }, Record<never, never>>; readonly severity: "critical" | "high" | "info" | "low" | "medium"; readonly rationale: string; readonly controls: readonly string[]; readonly checks: readonly string[]; readonly owner: string; readonly review: ObjectOf<{ cadence: Decoder<string>; }, { lastReviewed: Decoder<string>; }>; } & { readonly exceptions?: readonly string[] | undefined; }): Result<string, string>

When a policy's review falls due: its cadence after the last review (or after it was created).

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

exceptionAppliesfunction
function exceptionApplies(e: Document & { readonly excuses: ObjectOf<{ type: Decoder<"check" | "control" | "policy">; re… (600 characters)
function exceptionApplies(e: Document & { readonly excuses: ObjectOf<{ type: Decoder<"check" | "control" | "policy">; ref: Decoder<string>; }, Record<never, never>>; readonly subjects: readonly string[]; readonly reason: string; readonly approvedBy: string; readonly grantedAt: string; readonly expiresAt: string; } & { readonly acceptedRisk?: ObjectOf<{ owner: Decoder<string>; level: Decoder<"high" | "low" | "moderate" | "very-high" | "very-low">; reviewBy: Decoder<string>; }, Record<never, never>> | undefined; readonly inheritable?: boolean | undefined; }, subject: string, at: string): boolean

Whether an exception applies to a subject at an instant: after it is granted, before it expires, and covering the subject.

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

EnforcementRowtypeno test imports it
type EnforcementRow = { readonly requirement: string; readonly mechanism: Mechanism; readonly by: string; readonly note: string };

A row of the enforcement register of Mizan (enforcement.tsv): a requirement, how it is enforced, by what.

fromEnforcementRegisterfunction
function fromEnforcementRegister(tsv: string): Result<readonly EnforcementRow[], string>

The rows of an enforcement register's TSV (comment lines and the header skipped), or why a line is not a row.

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

toEnforcementRegisterfunction
function toEnforcementRegister(requirements: readonly (Document & { readonly statement: string; readonly level: "MAY" | … (522 characters)
function toEnforcementRegister(requirements: readonly (Document & { readonly statement: string; readonly level: "MAY" | "MUST" | "SHOULD"; readonly controls: readonly string[]; readonly verification: ObjectOf<{ mechanism: Decoder<"check" | "gate" | "none" | "review">; by: Decoder<string>; }, { note: Decoder<string>; }>; } & { readonly validation?: ObjectOf<{ method: Decoder<"measure" | "review" | "scenario" | "stakeholder">; by: Decoder<string>; at: Decoder<string>; }, Record<never, never>> | undefined; })[]): string

The register's TSV of the verification of requirements, in the order given.

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

GovernanceSettypeno test imports it
type GovernanceSet = {
  readonly frameworks: readonly Framework[];
  readonly crosswalks?: readonly Crosswalk[];
  readonly policies?: readonly Policy[];
  readonly checks?: readonly Check[];
  readonly requirements?: readonly Requirement[];
  readonly exceptions?: readonly Exception[];
};

What governanceProblems reads.

GovernanceRuletypeno test imports it
type GovernanceRule =
  | "framework/duplicate-control"
  | "control/unknown"
  | "policy/unknown-check"
  | "policy/no-control"
  | "id/duplicate"
  | "duration/invalid"
  | "runner/unstable-kind"
  | "exception/excuses-nothing";

The rules of governanceProblems.

GovernanceProblemtypeno test imports it
type GovernanceProblem = { readonly rule: GovernanceRule; readonly id: string; readonly message: string };

A problem of a set of governance documents.

governanceProblemsfunction
function governanceProblems(set: GovernanceSet): readonly GovernanceProblem[]

Every problem of a set of governance documents, as data.

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

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