IF Commons GitHub

targets/ssh/ban

Written to: 1 requirement: 1 proved, 0 partly, 0 failing, 0 with no test recorded. 0005-reach-and-targets FR-010

The ban on hand-built ssh arguments (commons headless 0005-reach-and-targets FR-010): a program that reaches a machine over ssh does it through the executor, so that the options, the quoting and the host-key policy are in one place. This finds, in the text of a program's sources, an ssh argument vector that sets the options only the executor sets (BatchMode, ConnectTimeout, ServerAliveInterval, StrictHostKeyChecking, UserKnownHostsFile, ControlMaster, -T) or an option of the host-key policy turned off, and gives a finding for each, to be held by a consumer's own check.

import { sshArgumentFindings } from "./ban.ts";
sshArgumentFindings([{ path: "a.ts", text: 'run(["ssh", "-o", "BatchMode=yes", host, cmd]);' }]).length; // 1

Source: commons/headless/src/targets/ssh/ban.ts

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

Sourcetypeno test imports it
type Source = { readonly path: string; readonly text: string };

A file's path and text.

SshFindingtypeno test imports it
type SshFinding = { readonly file: string; readonly line: number; readonly rule: "ssh/hand-built"; readonly message: string };

A hand-built ssh argument.

sshArgumentFindingsfunction
function sshArgumentFindings(files: readonly Source[]): readonly SshFinding[]

Every hand-built ssh argument in the sources given, by file and line. A source of the executor itself is not given to it.

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

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