governance.ControlReftypeno test imports ittype ControlRef = { readonly framework: string; readonly version: string; readonly control: string };The parts of a control's URN.
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" } }governance.ControlReftypeno test imports ittype ControlRef = { readonly framework: string; readonly version: string; readonly control: string };The parts of a control's URN.
governance.controlUrnfunctionno test imports itfunction controlUrn(framework: string, version: string, control: string): stringThe stable URN of a control: urn:grc:<framework>:<version>:<control>.
governance.parseControlUrnfunctionno test imports itfunction parseControlUrn(urn: string): Result<ControlRef, string>The parts of a control's URN, or why the text is not one.
governance.controlUrnsfunctionno test imports itfunction 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 ittype Mapped = { readonly urn: string; readonly relationship: Relationship; readonly strength: number; readonly via: string };A control a crosswalk reaches.
governance.mappedControlsfunctionno test imports itfunction 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 itfunction 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 itfunction 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): booleanWhether an exception applies to a subject at an instant: after it is granted, before it expires, and covering the subject.
governance.EnforcementRowtypeno test imports ittype 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 itfunction 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 itfunction 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; })[]): stringThe register's TSV of the verification of requirements, in the order given.
governance.GovernanceSettypeno test imports ittype 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 ittype 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 ittype GovernanceProblem = { readonly rule: GovernanceRule; readonly id: string; readonly message: string };A problem of a set of governance documents.
governance.governanceProblemsfunctionno test imports itfunction governanceProblems(set: GovernanceSet): readonly GovernanceProblem[]Every problem of a set of governance documents, as data.
ControlReftypeno test imports ittype ControlRef = { readonly framework: string; readonly version: string; readonly control: string };The parts of a control's URN.
controlUrnfunctionfunction controlUrn(framework: string, version: string, control: string): stringThe stable URN of a control: urn:grc:<framework>:<version>:<control>.
parseControlUrnfunctionfunction parseControlUrn(urn: string): Result<ControlRef, string>The parts of a control's URN, or why the text is not one.
controlUrnsfunctionfunction 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.
Mappedtypeno test imports ittype Mapped = { readonly urn: string; readonly relationship: Relationship; readonly strength: number; readonly via: string };A control a crosswalk reaches.
mappedControlsfunctionfunction 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.
reviewDuefunctionfunction 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).
exceptionAppliesfunctionfunction 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): booleanWhether an exception applies to a subject at an instant: after it is granted, before it expires, and covering the subject.
EnforcementRowtypeno test imports ittype 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.
fromEnforcementRegisterfunctionfunction 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.
toEnforcementRegisterfunctionfunction 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; })[]): stringThe register's TSV of the verification of requirements, in the order given.
GovernanceSettypeno test imports ittype 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 ittype 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 ittype GovernanceProblem = { readonly rule: GovernanceRule; readonly id: string; readonly message: string };A problem of a set of governance documents.
governanceProblemsfunctionfunction governanceProblems(set: GovernanceSet): readonly GovernanceProblem[]Every problem of a set of governance documents, as data.