compliancecode of compliancerequiredWhether the device meets what is asked of it
Becomes the column compliance of device_posture.
How a device was doing when it last reported; after its time is up it reads as unknown, never as compliant
Model identityDevice. Written in commons/data/models/identity-device/mod.ts:69. Identified by devicePostureId.
compliancecode of compliancerequiredWhether the device meets what is asked of it
Becomes the column compliance of device_posture.
detailsstructuredoptionalWhat else was reported
Becomes the column details of device_posture.
devicePostureIdidentifierrequiredWhat identifies the report, made by the application
Becomes the column device_posture_id of device_posture.
diskEncryptedbooleanoptionalWhether its storage is encrypted
Becomes the column disk_encrypted of device_posture.
edrActivebooleanoptionalWhether endpoint detection is running
Becomes the column edr_active of device_posture.
firewallbooleanoptionalWhether its firewall is on
Becomes the column firewall of device_posture.
jailbrokenbooleanoptionalWhether it has been broken out of its platform's protections
Becomes the column jailbroken of device_posture.
osVersiontextoptionalThe version of what it runs
Becomes the column os_version of device_posture.
patchAgeDaysintegeroptionalHow many days old its latest patch is
Becomes the column patch_age_days of device_posture.
reportedAtinstantrequiredWhen it was reported
Becomes the column reported_at of device_posture.
riskScoreintegeroptionalA score from its reporter
Becomes the column risk_score of device_posture.
screenLockbooleanoptionalWhether it locks its screen
Becomes the column screen_lock of device_posture.
sourcecode of postureSourcerequiredWhat reported it
Becomes the column source of device_posture.
validUntilinstantrequiredWhen the report stops counting
Becomes the column valid_until of device_posture.
deviceoneThe device To device. Written at commons/data/models/identity-device/mod.ts:69
Projects to the table device_posture with the primary key device_posture_id.
| Column | Type | Null | Role | From |
|---|---|---|---|---|
compliance | text | false | attribute | devicePosture.compliance |
details | json | true | attribute | devicePosture.details |
device_posture_id | text | false | attribute | devicePosture.devicePostureId |
device_principal_id | text | false | reference | devicePosture.device |
disk_encrypted | boolean | true | attribute | devicePosture.diskEncrypted |
edr_active | boolean | true | attribute | devicePosture.edrActive |
firewall | boolean | true | attribute | devicePosture.firewall |
jailbroken | boolean | true | attribute | devicePosture.jailbroken |
os_version | text | true | attribute | devicePosture.osVersion |
patch_age_days | integer | true | attribute | devicePosture.patchAgeDays |
reported_at | timestamp | false | attribute | devicePosture.reportedAt |
risk_score | integer | true | attribute | devicePosture.riskScore |
screen_lock | boolean | true | attribute | devicePosture.screenLock |
source | text | false | attribute | devicePosture.source |
valid_until | timestamp | false | attribute | devicePosture.validUntil |
CREATE TABLE IF NOT EXISTS "device_posture" (
"device_posture_id" VARCHAR NOT NULL PRIMARY KEY,
"source" VARCHAR NOT NULL,
"compliance" VARCHAR NOT NULL,
"os_version" VARCHAR,
"disk_encrypted" BOOLEAN,
"screen_lock" BOOLEAN,
"firewall" BOOLEAN,
"jailbroken" BOOLEAN,
"edr_active" BOOLEAN,
"patch_age_days" INTEGER,
"risk_score" INTEGER,
"details" JSON,
"reported_at" TIMESTAMPTZ NOT NULL,
"valid_until" TIMESTAMPTZ NOT NULL,
"device_principal_id" VARCHAR NOT NULL,
CONSTRAINT "device_posture_device_principal_id_fk" FOREIGN KEY ("device_principal_id") REFERENCES "device" ("principal_id"),
CONSTRAINT "device_posture_source_ck" CHECK ("source" IN ('mdm', 'edr', 'agent', 'manual')),
CONSTRAINT "device_posture_compliance_ck" CHECK ("compliance" IN ('compliant', 'noncompliant', 'unknown'))
);CREATE TABLE IF NOT EXISTS "device_posture" (
"device_posture_id" TEXT NOT NULL PRIMARY KEY,
"source" TEXT NOT NULL,
"compliance" TEXT NOT NULL,
"os_version" TEXT,
"disk_encrypted" BOOLEAN,
"screen_lock" BOOLEAN,
"firewall" BOOLEAN,
"jailbroken" BOOLEAN,
"edr_active" BOOLEAN,
"patch_age_days" INTEGER,
"risk_score" INTEGER,
"details" JSONB,
"reported_at" TIMESTAMPTZ NOT NULL,
"valid_until" TIMESTAMPTZ NOT NULL,
"device_principal_id" TEXT NOT NULL,
CONSTRAINT "device_posture_device_principal_id_fk" FOREIGN KEY ("device_principal_id") REFERENCES "device" ("principal_id"),
CONSTRAINT "device_posture_source_ck" CHECK ("source" IN ('mdm', 'edr', 'agent', 'manual')),
CONSTRAINT "device_posture_compliance_ck" CHECK ("compliance" IN ('compliant', 'noncompliant', 'unknown'))
);CREATE TABLE IF NOT EXISTS "device_posture" (
"device_posture_id" TEXT NOT NULL PRIMARY KEY,
"source" TEXT NOT NULL,
"compliance" TEXT NOT NULL,
"os_version" TEXT,
"disk_encrypted" INTEGER,
"screen_lock" INTEGER,
"firewall" INTEGER,
"jailbroken" INTEGER,
"edr_active" INTEGER,
"patch_age_days" INTEGER,
"risk_score" INTEGER,
"details" TEXT,
"reported_at" TEXT NOT NULL,
"valid_until" TEXT NOT NULL,
"device_principal_id" TEXT NOT NULL,
CONSTRAINT "device_posture_device_principal_id_fk" FOREIGN KEY ("device_principal_id") REFERENCES "device" ("principal_id"),
CONSTRAINT "device_posture_source_ck" CHECK ("source" IN ('mdm', 'edr', 'agent', 'manual')),
CONSTRAINT "device_posture_compliance_ck" CHECK ("compliance" IN ('compliant', 'noncompliant', 'unknown'))
);Read and written from TypeScript with the types the model gives: import { devicePosture } from "@intellectual-frontiers/data/sql/typed/models". Generated in commons/data/sql/typed/models/identity-device.auto.ts: do not edit.
import { from } from "@intellectual-frontiers/data/sql/typed";
import { devicePosture } from "@intellectual-frontiers/data/sql/typed/models";
const rows = await from(devicePosture).select((s) => ({ devicePostureId: s.devicePosture.devicePostureId, source: s.devicePosture.source })).run(runner);