IF Commons GitHub

logical/authorize

Written to: 2 requirements: 2 proved, 0 partly, 0 failing, 0 with no test recorded. 0004-pentest-authorization FR-001, 0004-pentest-authorization FR-002

Whether an engagement is in force and whether one action is allowed. An engagement is in force when the commit that holds it was accepted by the signers of the fleet (with the approval its controlled path asks for), the file is the one committed, and the instant now is inside its window. An action is one technique on one asset: allowed when the engagement is in force, the technique is one it grants (and is no technique that is never granted), and the asset is in its scope. A passive action sends nothing to a target, so it is allowed without an engagement in force, and is said so.

Everything is decided from what is given: the signature verdict (made by change-control from Git), the instant and the scope (made by asking the estate). Nothing is read or run here.

import { authorize } from "./authorize.ts";
authorize({ engagement: undefined, signature: { state: "unsigned", reasons: [] }, now: "2026-12-01T00:00:00Z", inScope: [] }, "athens", "passive").allowed; // true

Source: commons/pentest/src/logical/authorize.ts

3 of 14 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.Signaturetypeno test imports it
type Signature = { /** `accepted`: signed by a signer of the fleet, with the approval its path needs. `refused` or `bl… (429 characters)
type Signature = {
  /** `accepted`: signed by a signer of the fleet, with the approval its path needs. `refused` or `blocked`: it was judged and not accepted. `unsigned`: no commit holds the file. `modified`: the file is not the one committed. */
  readonly state: "accepted" | "refused" | "blocked" | "unsigned" | "modified";
  readonly signer?: string;
  readonly approvedBy?: string;
  readonly reasons: readonly string[];
};

What change-control found of the commit that holds the engagement.

logical.Phasetypeno test imports it
type Phase = "before" | "open" | "ended";

Where the instant is against the window.

logical.Standingtypeno test imports it
type Standing = { readonly inForce: boolean; readonly phase: Phase; readonly reasons: readonly string[] };

Whether an engagement is in force.

logical.Basistypeno test imports it
type Basis = { readonly engagement: Engagement | undefined; readonly signature: Signature; readonly now: string; readonly inScope: readonly string[] };

What is given to judge an action.

logical.standingfunctionno test imports it
function standing(e: Engagement, signature: Signature, now: string): Standing

Whether an engagement is in force at the instant, from the signature and the window.

logical.Answertypeno test imports it
type Answer = { readonly allowed: boolean; readonly reason: string };

The answer to one action: allowed or not, and the reason in a sentence.

logical.authorizefunctionno test imports it
function authorize(b: Basis, asset: string, technique: string): Answer

Whether one technique on one asset is allowed.

Signaturetype
type Signature = { /** `accepted`: signed by a signer of the fleet, with the approval its path needs. `refused` or `bl… (429 characters)
type Signature = {
  /** `accepted`: signed by a signer of the fleet, with the approval its path needs. `refused` or `blocked`: it was judged and not accepted. `unsigned`: no commit holds the file. `modified`: the file is not the one committed. */
  readonly state: "accepted" | "refused" | "blocked" | "unsigned" | "modified";
  readonly signer?: string;
  readonly approvedBy?: string;
  readonly reasons: readonly string[];
};

What change-control found of the commit that holds the engagement.

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

Phasetypeno test imports it
type Phase = "before" | "open" | "ended";

Where the instant is against the window.

Standingtypeno test imports it
type Standing = { readonly inForce: boolean; readonly phase: Phase; readonly reasons: readonly string[] };

Whether an engagement is in force.

Basistypeno test imports it
type Basis = { readonly engagement: Engagement | undefined; readonly signature: Signature; readonly now: string; readonly inScope: readonly string[] };

What is given to judge an action.

standingfunction
function standing(e: Engagement, signature: Signature, now: string): Standing

Whether an engagement is in force at the instant, from the signature and the window.

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

Answertypeno test imports it
type Answer = { readonly allowed: boolean; readonly reason: string };

The answer to one action: allowed or not, and the reason in a sentence.

authorizefunction
function authorize(b: Basis, asset: string, technique: string): Answer

Whether one technique on one asset is allowed.

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

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