IF Commons GitHub

conformance/mod

Written to: 1 requirement: 1 proved, 0 partly, 0 failing, 0 with no test recorded. 0001-grc-layers FR-009

The conformance suites of the ports (0001-grc-layers FR-009; 0004-grc-documents FR-011, 0005-grc-runners FR-010, 0006-grc-evidence FR-008, 0009-grc-groups FR-011, 0012-grc-subtenants FR-012): functions a third party runs against its own runner, store, signer or serializer, each returning every failed expectation as data (an empty list is a pass) and never throwing. This library runs them on every extension it ships.

import { storeConformance } from "@intellectual-frontiers/grc/conformance";
// const failures = await storeConformance(() => myStore());

Source: commons/grc/src/conformance/mod.ts

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

Failuretypeno test imports it
type Failure = { readonly suite: string; readonly name: string; readonly message: string };

One failed expectation.

RunnerCasetypeno test imports it
type RunnerCase = { readonly name: string; readonly check: Check; readonly subject: Subject; readonly expect: Json };

A fixture for a runner: a check, the subject, and the value the runner must observe.

runnerConformancefunction
function runnerConformance(runner: Runner, cases: readonly RunnerCase[], now?: () => string): Promise<readonly Failure[]>

A runner given the fixtures its author gives gives the value each expects, the same twice, and never throws.

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

storeConformancefunction
function storeConformance(make: () => EvidenceStore | Promise<EvidenceStore>, tamper?: ((store: EvidenceStore, digest: string) => Promise<void>) | undefined): Promise<readonly Failure[]>

A store: content addressing, an idempotent put, a missing digest, the list with its filter, and, where tamper is given, a tampered object.

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

SignerKeystypeno test imports it
type SignerKeys = { readonly signing: readonly unknown[]; readonly verifying: readonly unknown[]; readonly otherVerifying: readonly unknown[] };

The keys a signer is tried with: to sign, to verify, and a pair that is not the same.

signerConformancefunction
function signerConformance(signer: Signer, keys: SignerKeys): Promise<readonly Failure[]>

A signer: sign then verify, verify with a wrong key, and a tampered payload.

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

serializerConformancefunction
function serializerConformance(serializer: Serializer, sample: Document & { readonly title: string; readonly frameworks:… (11914 characters)
function serializerConformance(serializer: Serializer, sample: Document & { readonly title: string; readonly 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 results: readonly (Document & { readonly check: string; readonly controls: readonly string[]; readonly subject: string; readonly status: "accepted" | "error" | "fail" | "gap" | "not-applicable" | "pass" | "pending" | "warn"; readonly severity: "critical" | "high" | "info" | "low" | "medium"; readonly reason: string; readonly observedAt: string; } & { readonly value?: Json | undefined; readonly via?: string | undefined; readonly policy?: string | undefined; readonly exception?: string | undefined; readonly was?: "accepted" | "error" | "fail" | "gap" | "not-applicable" | "pass" | "pending" | "warn" | undefined; })[]; readonly findings: readonly (Document & { readonly result: string; readonly check: string; readonly controls: readonly string[]; readonly subject: string; readonly status: "accepted" | "error" | "fail" | "gap" | "not-applicable" | "pass" | "pending" | "warn"; readonly severity: "critical" | "high" | "info" | "low" | "medium"; readonly title: string; readonly detail: string; readonly evidence: readonly string[]; } & { readonly remediation?: string | undefined; readonly exception?: string | undefined; })[]; readonly evidence: readonly (Document & { readonly subject: string; readonly type: string; readonly digest: string; readonly mediaType: string; readonly size: number; readonly observedAt: string; } & { readonly store?: string | undefined; readonly producer?: string | undefined; })[]; readonly attestations: readonly (Document & { readonly subject: string; readonly check: string; readonly claim: "fail" | "pass"; readonly statement: string; readonly attester: string; readonly role: string; readonly evidence: readonly string[]; } & { readonly signature?: string | undefined; readonly signer?: string | undefined; })[]; readonly exceptions: readonly (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; })[]; readonly risks: readonly (Document & { readonly title: string; readonly description: string; readonly likelihood: "high" | "low" | "moderate" | "very-high" | "very-low"; readonly impact: "high" | "low" | "moderate" | "very-high" | "very-low"; readonly level: "high" | "low" | "moderate" | "very-high" | "very-low"; readonly treatment: "accept" | "avoid" | "mitigate" | "transfer"; readonly owner: string; readonly reviewBy: string; readonly controls: readonly string[]; } & {})[]; } & { readonly policies?: readonly (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; })[] | undefined; readonly checks?: readonly (Document & { readonly ask: string; readonly expect: import("/home/runner/work/.github/.github/commons/core/src/decode").ObjectOf<{ kind: import("/home/runner/work/.github/.github/commons/core/src/decode").Decoder<"empty">; }, Record<never, never>> | import("/home/runner/work/.github/.github/commons/core/src/decode").ObjectOf<{ kind: import("/home/runner/work/.github/.github/commons/core/src/decode").Decoder<"non-empty">; }, Record<never, never>> | import("/home/runner/work/.github/.github/commons/core/src/decode").ObjectOf<{ kind: import("/home/runner/work/.github/.github/commons/core/src/decode").Decoder<"equals">; value: import("/home/runner/work/.github/.github/commons/core/src/decode").Decoder<import("/home/runner/work/.github/.github/commons/grc/src/governance/kinds").Json>; }, Record<never, never>> | import("/home/runner/work/.github/.github/commons/core/src/decode").ObjectOf<{ kind: import("/home/runner/work/.github/.github/commons/core/src/decode").Decoder<"count">; }, { min: import("/home/runner/work/.github/.github/commons/core/src/decode").Decoder<number>; max: import("/home/runner/work/.github/.github/commons/core/src/decode").Decoder<number>; }> | import("/home/runner/work/.github/.github/commons/core/src/decode").ObjectOf<{ kind: import("/home/runner/work/.github/.github/commons/core/src/decode").Decoder<"every">; field: import("/home/runner/work/.github/.github/commons/core/src/decode").Decoder<string>; op: import("/home/runner/work/.github/.github/commons/core/src/decode").Decoder<"eq" | "ge" | "gt" | "in" | "le" | "lt" | "matches" | "ne">; value: import("/home/runner/work/.github/.github/commons/core/src/decode").Decoder<import("/home/runner/work/.github/.github/commons/grc/src/governance/kinds").Json>; }, Record<never, never>>; readonly platforms: readonly string[]; readonly freshness: string; readonly controls: readonly string[]; readonly runner: ObjectOf<{ kind: Decoder<string>; input: Decoder<Json>; }, Record<never, never>>; } & { readonly severity?: "critical" | "high" | "info" | "low" | "medium" | undefined; })[] | undefined; }, empty: Document & { readonly title: string; readonly 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 results: readonly (Document & { readonly check: string; readonly controls: readonly string[]; readonly subject: string; readonly status: "accepted" | "error" | "fail" | "gap" | "not-applicable" | "pass" | "pending" | "warn"; readonly severity: "critical" | "high" | "info" | "low" | "medium"; readonly reason: string; readonly observedAt: string; } & { readonly value?: Json | undefined; readonly via?: string | undefined; readonly policy?: string | undefined; readonly exception?: string | undefined; readonly was?: "accepted" | "error" | "fail" | "gap" | "not-applicable" | "pass" | "pending" | "warn" | undefined; })[]; readonly findings: readonly (Document & { readonly result: string; readonly check: string; readonly controls: readonly string[]; readonly subject: string; readonly status: "accepted" | "error" | "fail" | "gap" | "not-applicable" | "pass" | "pending" | "warn"; readonly severity: "critical" | "high" | "info" | "low" | "medium"; readonly title: string; readonly detail: string; readonly evidence: readonly string[]; } & { readonly remediation?: string | undefined; readonly exception?: string | undefined; })[]; readonly evidence: readonly (Document & { readonly subject: string; readonly type: string; readonly digest: string; readonly mediaType: string; readonly size: number; readonly observedAt: string; } & { readonly store?: string | undefined; readonly producer?: string | undefined; })[]; readonly attestations: readonly (Document & { readonly subject: string; readonly check: string; readonly claim: "fail" | "pass"; readonly statement: string; readonly attester: string; readonly role: string; readonly evidence: readonly string[]; } & { readonly signature?: string | undefined; readonly signer?: string | undefined; })[]; readonly exceptions: readonly (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; })[]; readonly risks: readonly (Document & { readonly title: string; readonly description: string; readonly likelihood: "high" | "low" | "moderate" | "very-high" | "very-low"; readonly impact: "high" | "low" | "moderate" | "very-high" | "very-low"; readonly level: "high" | "low" | "moderate" | "very-high" | "very-low"; readonly treatment: "accept" | "avoid" | "mitigate" | "transfer"; readonly owner: string; readonly reviewBy: string; readonly controls: readonly string[]; } & {})[]; } & { readonly policies?: readonly (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; })[] | undefined; readonly checks?: readonly (Document & { readonly ask: string; readonly expect: import("/home/runner/work/.github/.github/commons/core/src/decode").ObjectOf<{ kind: import("/home/runner/work/.github/.github/commons/core/src/decode").Decoder<"empty">; }, Record<never, never>> | import("/home/runner/work/.github/.github/commons/core/src/decode").ObjectOf<{ kind: import("/home/runner/work/.github/.github/commons/core/src/decode").Decoder<"non-empty">; }, Record<never, never>> | import("/home/runner/work/.github/.github/commons/core/src/decode").ObjectOf<{ kind: import("/home/runner/work/.github/.github/commons/core/src/decode").Decoder<"equals">; value: import("/home/runner/work/.github/.github/commons/core/src/decode").Decoder<import("/home/runner/work/.github/.github/commons/grc/src/governance/kinds").Json>; }, Record<never, never>> | import("/home/runner/work/.github/.github/commons/core/src/decode").ObjectOf<{ kind: import("/home/runner/work/.github/.github/commons/core/src/decode").Decoder<"count">; }, { min: import("/home/runner/work/.github/.github/commons/core/src/decode").Decoder<number>; max: import("/home/runner/work/.github/.github/commons/core/src/decode").Decoder<number>; }> | import("/home/runner/work/.github/.github/commons/core/src/decode").ObjectOf<{ kind: import("/home/runner/work/.github/.github/commons/core/src/decode").Decoder<"every">; field: import("/home/runner/work/.github/.github/commons/core/src/decode").Decoder<string>; op: import("/home/runner/work/.github/.github/commons/core/src/decode").Decoder<"eq" | "ge" | "gt" | "in" | "le" | "lt" | "matches" | "ne">; value: import("/home/runner/work/.github/.github/commons/core/src/decode").Decoder<import("/home/runner/work/.github/.github/commons/grc/src/governance/kinds").Json>; }, Record<never, never>>; readonly platforms: readonly string[]; readonly freshness: string; readonly controls: readonly string[]; readonly runner: ObjectOf<{ kind: Decoder<string>; input: Decoder<Json>; }, Record<never, never>>; } & { readonly severity?: "critical" | "high" | "info" | "low" | "medium" | undefined; })[] | undefined; }, context?: SerializeContext, accepts?: ((text: string) => string | undefined) | undefined): Promise<readonly Failure[]>

A serializer: it names its format and version, is deterministic, gives a value and not an exception for an assessment with no results, and, where accepts is given, its output is accepted.

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

EntityDatatype
type EntityData = {
  readonly ledger: readonly LedgerEntry[];
  readonly results: readonly Outcome[];
  readonly exceptions: readonly Exception[];
  readonly store: EvidenceStore;
};

What one entity holds, which only its own ports reach.

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

GroupCasetype
type GroupCase = {
  readonly group: EntityGroup;
  readonly scope: ControlScope;
  readonly material: GroupMaterial;
  readonly data: ReadonlyMap<EntityId, EntityData>;
  readonly exceptions: readonly Exception[];
  readonly at: string;
};

The case a group's way of making readers is tried with: the group, its scope and material, what each entity holds, and the instant.

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

groupConformancefunction
function groupConformance(c: GroupCase, make?: (ports: EntityPorts, material: GroupMaterial) => EntityReader): Promise<readonly Failure[]>

A group's readers over per-entity ports that cannot see each other: while an entity's reader runs, the ports of every other entity throw. It checks that every entity is read, that the view is the same as the one made from the snapshots alone, that an entity that cannot be read is pending and the others are unchanged, and that no reader touches another entity's ports.

// const failures = await groupConformance({ group, scope, material, data, exceptions: [], at }); // [] is a pass

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

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