IF Commons GitHub

logical/scope

Written to: 1 requirement: 1 proved, 0 partly, 0 failing, 0 with no test recorded. 0004-pentest-authorization FR-003

The scope of an engagement: the assets its two questions select. The questions are asked of the estate by the caller (this library asks nothing and reaches nothing); what is given back is checked here: each answer must have a column named asset, and what is left out is taken from what is included. An empty scope is a problem, because a test of nothing is not authorized, and so is an asset in scope that the estate does not have.

import { resolveScope } from "./scope.ts";
resolveScope({ include: "select id as asset from asset" }, () => ({ columns: ["asset"], rows: [["athens"]] }), ["athens"]).inScope; // ["athens"]

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

2 of 6 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.Answeredtypeno test imports it
type Answered = { readonly columns: readonly string[]; readonly rows: readonly (readonly unknown[])[] } | { readonly error: string };

The answer to a question asked of the estate.

logical.Scopetypeno test imports it
type Scope = { readonly inScope: readonly string[]; readonly excluded: readonly string[]; readonly problems: readonly string[] };

The scope of an engagement.

logical.resolveScopefunctionno test imports it
function resolveScope(scope: Pick<{ readonly include: string; readonly exclude?: string | undefined; }, "exclude" | "include">, ask: (sql: string) => Answered, known: readonly string[]): Scope

The assets in scope, from the two questions of the engagement asked through ask; known are the assets the estate has.

Answeredtype
type Answered = { readonly columns: readonly string[]; readonly rows: readonly (readonly unknown[])[] } | { readonly error: string };

The answer to a question asked of the estate.

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

Scopetypeno test imports it
type Scope = { readonly inScope: readonly string[]; readonly excluded: readonly string[]; readonly problems: readonly string[] };

The scope of an engagement.

resolveScopefunction
function resolveScope(scope: Pick<{ readonly include: string; readonly exclude?: string | undefined; }, "exclude" | "include">, ask: (sql: string) => Answered, known: readonly string[]): Scope

The assets in scope, from the two questions of the engagement asked through ask; known are the assets the estate has.

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

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