IF Commons GitHub

sql/extensions/osquery-atc/atc

Written to: 4 requirements: 4 proved, 0 partly, 0 failing, 0 with no test recorded. 0027-sql-osquery-atc FR-001, 0027-sql-osquery-atc FR-002, 0027-sql-osquery-atc FR-003, 0027-sql-osquery-atc FR-004

osquery Automatic Table Construction (commons data 0027-sql-osquery-atc): the configuration that makes tables of osquery from tables of a local SQLite database, made from a logical schema, with what osquery refuses refused first.

What osquery does, as read in its documentation of Automatic Table Construction (auto_table_construction in the configuration): query and path are required and columns is a list; every column is text to osquery; a column named path in any case is refused, because osquery adds a path column of its own; the platforms it names are darwin, linux, posix, windows, any and all; and a path may hold % for any one directory. The configuration made here was checked against that and by running each entry's query on a database built from the same source; it was not run in osquery.

Source: commons/data/sql/extensions/osquery-atc/atc.ts

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

atcfunction
function atc(schema: LogicalSchema, entries: readonly AtcEntry[], options: AtcOptions): Result<Atc, readonly AtcError[]>

The configuration of a set of entries.

ParameterWhat it is
schemathe logical schema of the database
entriesthe entries
optionsthe dialect (SQLite's), naming and schema

Returns: the configuration, or why not

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

Atcinterfaceno test imports it
interface Atc

The configuration.

MemberTypeWhat it is
config{ readonly auto_table_construction: Readonly<Record<string, AtcConfigEntry>>; }
jsonstringThe configuration as JSON, the same bytes every time.
AtcConfigEntryinterfaceno test imports it
interface AtcConfigEntry

An entry as osquery reads it.

MemberTypeWhat it is
querystring
pathstring
columnsreadonly string[]
platform?"all" | "any" | "darwin" | "linux" | "posix" | "windows"
AtcEntryinterface
interface AtcEntry

An osquery table made from a table of the database.

MemberTypeWhat it is
namestringThe name of the table in osquery.
tablestringThe table of the database, by the words of its name.
columnsreadonly string[]The columns, by the words of their names, in the order the query gives them.
pathstringThe path of the database on the host, % standing for any one directory.
platform?"all" | "any" | "darwin" | "linux" | "posix" | "windows"

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

AtcErrortypeno test imports it
type AtcError = | { readonly kind: "unsupported"; readonly why: string } | { readonly kind: "unknown-table"; readonl… (701 characters)
type AtcError =
  | { readonly kind: "unsupported"; readonly why: string }
  | { readonly kind: "unknown-table"; readonly entry: string; readonly table: string }
  | { readonly kind: "unknown-column"; readonly entry: string; readonly column: string }
  | { readonly kind: "name"; readonly entry: string }
  | { readonly kind: "duplicate"; readonly entry: string }
  | { readonly kind: "path-column"; readonly entry: string; readonly column: string }
  | { readonly kind: "no-columns"; readonly entry: string }
  | { readonly kind: "platform"; readonly entry: string; readonly platform: string }
  | { readonly kind: "path"; readonly entry: string; readonly path: string; readonly platform: Platform };

Why an automatic table construction cannot be made, as a value.

AtcOptionsinterfaceno test imports it
interface AtcOptions

What a configuration is made with.

MemberTypeWhat it is
dialectDialect
naming?Naming
schema?stringThe schema the tables are in, as the database was built with it.
POSIX_PATHconst
const POSIX_PATH: RegExp

A path on POSIX, and one on Windows (a drive or a share).

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

WINDOWS_PATHconst
const WINDOWS_PATH: RegExp

Matches a Windows path: a drive letter and a separator, or a UNC share.

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

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