security_incidents Client SQLite table
Durable local evidence that an SDK trust-boundary verification failed.
Declared in packages/client-sdk/src/data/sqlite/schema/securityIncidentSchema.ts
Description
Error messages and decrypted values are deliberately excluded. Callers may attach only hashes that were already part of the verified protocol object. Repeated detections of the same evidence update only the occurrence count and last-detected timestamp. Remote-state resets do not include this table, so an API rollback cannot erase the client's record of having detected it.
Columns
idtext- primary key
- not null
incident_v1_and the hex SHA-256 of the incident's identity: every column fromtrustDomainthroughevidenceHashes. A repeat detection therefore lands on the same row.trust_domaintext- nullable
Identity trust domain of the SDK instance that recorded the incident: the API's canonical URL (origin and path, no trailing slash), or null when none resolved. Incidents are listed and retained per trust domain.
codetext- not null
The keying verification code that failed, or
unrecognized_verification_codewhen the error carried no known code.operationtext- not null
Name of the SDK operation that detected the failure, such as
session.login, at most 128 characters.object_kindtext- not null
Kind of object being verified:
blob,container,document,principal,user, orunknown.object_idtext- nullable
Id of that object, at most 256 characters, or null when none applies.
organization_idtext- nullable
Organization of the object, at most 256 characters, or null.
evidence_hashestext- not null
Canonical JSON object (keys in code-unit order) mapping a label to a hash taken from the verified protocol object, such as
stateHash; at most 32 entries, and{}when there are none.detected_attext- not null
ISO-8601 time of the first equivalent detection.
last_detected_attext- not null
ISO-8601 time of the most recent equivalent detection. Past 1,000 rows in a trust domain, the row detected least recently is deleted.
occurrence_countinteger- not null
- default 1
Number of equivalent detections the row records, starting at 1.
Indexes
security_incidents_trust_last_detected_idx(trust_domain, last_detected_at)
DDL
The statements the client runs to create this table and its indexes.
CREATE TABLE IF NOT EXISTS "security_incidents" (
"id" TEXT NOT NULL PRIMARY KEY,
"trust_domain" TEXT,
"code" TEXT NOT NULL,
"operation" TEXT NOT NULL,
"object_kind" TEXT NOT NULL,
"object_id" TEXT,
"organization_id" TEXT,
"evidence_hashes" TEXT NOT NULL,
"detected_at" TEXT NOT NULL,
"last_detected_at" TEXT NOT NULL,
"occurrence_count" INTEGER NOT NULL DEFAULT 1
);
CREATE INDEX IF NOT EXISTS "security_incidents_trust_last_detected_idx" ON "security_incidents" ("trust_domain", "last_detected_at");