sql/extensions/osquery/schema
Written to: 3 requirements: 3 proved, 0 partly, 0 failing, 0 with no test recorded. 0058-sql-osquery FR-003, 0058-sql-osquery FR-001, 0058-sql-osquery FR-002
The machine facts of osquery as a schema (commons data 0058-sql-osquery): the published schema of one version of osquery, read as a value and imported through the live-database path (0055) into a logical schema, so that it is never written by hand. Each table says on which platforms it exists and whether it is evented, each column says if it is hidden, required or an index and on which platforms it exists, the columns that hold personal data are marked (classify.ts), and the schema is stamped with the version of osquery it describes.
Source: commons/data/sql/extensions/osquery/schema.ts
3 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.
function importSchema(schema: OsquerySchema, platform?: Platform | undefined): Result<LogicalSchema, readonly AdoptError[]>
The logical schema of a version of osquery, made through adopt and not by hand: names and types come from the published schema, each table is annotated with its platforms and whether it is evented, each column with whether it is hidden, required or an index, and each column that holds personal data with its category and what it is held for; the schema is stamped with the version.
| Parameter | What it is |
|---|
schema | the published schema |
platform | leave out what does not exist on this platform; every platform where not given |
Imported by 7 tests of the run (7 passed, 0 failed): the library's results
osqueryconstno test imports itconst osquery: { readonly version: AnnotationKind<string>; readonly platforms: AnnotationKind<readonly Platform[]>; readonly evented: AnnotationKind<boolean>; readonly column: AnnotationKind<{ readonly hidden: boolean; readonly required: boolean; readonly index: boolean; }>; }
Where the library's own annotations of osquery are written: osquery.version on the schema, osquery.platforms and osquery.evented on a table, osquery.column on a column.
OsqueryColumninterfaceno test imports itinterface OsqueryColumn
A column as osquery publishes it.
| Member | Type | What it is |
|---|
name | string | |
description | string | |
type | OsqueryType | |
hidden | boolean | |
required | boolean | |
index | boolean | |
platforms? | readonly Platform[] | Where it exists, where that is fewer places than its table. |
interface OsquerySchema
The published schema of one version of osquery.
| Member | Type | What it is |
|---|
version | string | |
source | { readonly repository: string; readonly commit: string; readonly path: string; readonly sha256: string; readonly license: string; } | |
tables | readonly OsqueryTable[] | |
Imported by 7 tests of the run (7 passed, 0 failed): the library's results
OsqueryTableinterfaceno test imports itinterface OsqueryTable
A table as osquery publishes it.
| Member | Type | What it is |
|---|
name | string | |
description | string | |
platforms | readonly Platform[] | |
evented | boolean | |
cacheable | boolean | |
columns | readonly OsqueryColumn[] | |
OsqueryTypetypeno test imports ittype OsqueryType = "text" | "integer" | "bigint" | "unsigned_bigint" | "double" | "blob";
The types of an osquery column.
Platformtypeno test imports ittype Platform = "linux" | "darwin" | "windows";
The platforms osquery runs on, as this library names them.
PLATFORMSconstno test imports itconst PLATFORMS: readonly Platform[]
The platforms osquery tables are for: linux, darwin and windows.
function readSchema(json: unknown): Result<OsquerySchema, string>
Reads the published schema file (the trimmed JSON of tools/osquery-schema.ts) into a value, or says what is wrong with it.
| Parameter | What it is |
|---|
json | the parsed file |
Imported by 14 tests of the run (14 passed, 0 failed): the library's results
toObservedfunctionno test imports itfunction toObserved(schema: OsquerySchema, platform?: Platform | undefined): Observed
The schema as what a database holds (0055): the tables with their columns as osquery types them, and no key, since osquery has none. A table is left out where it does not exist on the platform asked for.