IF Commons GitHub

auditEvent

conceptpersonal data

Something that was done, or tried, kept in a chain of hashes so that it cannot be changed without showing

Model identity. Written in commons/data/models/identity/concepts.ts:438. Identified by auditEventId.

Governance: attributes

actiontextrequired

What was done, named `subject.verb`; each module adds its own

Becomes the column action of audit_event.

Written at commons/data/models/identity/concepts.ts:451

actorKindcode of actorKindrequired

What did it: a person, a machine, a device, an agent, the platform or someone acting as another

Becomes the column actor_kind of audit_event.

Written at commons/data/models/identity/concepts.ts:444

auditEventIdidentifierrequired

What identifies the event, made by the application

Becomes the column audit_event_id of audit_event.

Written at commons/data/models/identity/concepts.ts:441

chainstructuredoptional

The principals between the person accountable and the actor, root first

Becomes the column chain of audit_event.

Written at commons/data/models/identity/concepts.ts:449

decisioncode of decisionoptional

What the decision was, for an event that records one

Becomes the column decision of audit_event.

Written at commons/data/models/identity/concepts.ts:445

delegationKeytextoptional

The delegation it was done under; not a reference, so that the trail outlives it

Becomes the column delegation_key of audit_event.

Written at commons/data/models/identity/concepts.ts:446

detailstructuredoptional

What else matters, with no secret in it

Becomes the column detail of audit_event.

Written at commons/data/models/identity/concepts.ts:460

eventHashtextrequired

The hash of this event and the one before

Becomes the column event_hash of audit_event.

Written at commons/data/models/identity/concepts.ts:462

iptextoptionalpersonal data

Where it came from

Becomes the column ip of audit_event.

Annotations: privacy.personal={"category":"IPAddress","purposes":["investigate what happened"]}

Written at commons/data/models/identity/concepts.ts:457

occurredAtinstantrequired

When it happened

Becomes the column occurred_at of audit_event.

Written at commons/data/models/identity/concepts.ts:443

outcomecode of auditOutcomerequired

How it ended

Becomes the column outcome of audit_event.

Written at commons/data/models/identity/concepts.ts:452

policyRefsstructuredoptional

The roles, policies and grants that decided

Becomes the column policy_refs of audit_event.

Written at commons/data/models/identity/concepts.ts:450

previousHashtextrequired

The hash of the event before it in the chain

Becomes the column previous_hash of audit_event.

Written at commons/data/models/identity/concepts.ts:461

reasontextoptional

Why, where a reason was given

Becomes the column reason of audit_event.

Written at commons/data/models/identity/concepts.ts:459

requestIdtextoptional

The request it was part of

Becomes the column request_id of audit_event.

Written at commons/data/models/identity/concepts.ts:456

runKeytextoptional

The run of an agent it was done in; not a reference, so that the trail outlives it

Becomes the column run_key of audit_event.

Written at commons/data/models/identity/concepts.ts:447

sequenceintegerrequired

Which event of the trail it is, counted from one: each follows the one before it, so that none is left out and none is put between

Becomes the column sequence of audit_event.

Written at commons/data/models/identity/concepts.ts:442

sessionKeytextoptional

The session it was done in; not a reference, because sessions are purged

Becomes the column session_key of audit_event.

Written at commons/data/models/identity/concepts.ts:455

targetConcepttextoptional

The kind of thing it was done to

Becomes the column target_concept of audit_event.

Written at commons/data/models/identity/concepts.ts:453

targetKeytextoptional

The thing it was done to; a loose reference, so that the trail outlives what it names

Becomes the column target_key of audit_event.

Written at commons/data/models/identity/concepts.ts:454

traceIdtextoptional

The trace it is part of

Becomes the column trace_id of audit_event.

Written at commons/data/models/identity/concepts.ts:448

userAgenttextoptionalpersonal data

What the client says it is

Becomes the column user_agent of audit_event.

Annotations: privacy.personal={"category":"UserAgent","purposes":["investigate what happened"]}

Written at commons/data/models/identity/concepts.ts:458

Governance: relationships

actoroptional

Who did it, where a principal did To principal. Written at commons/data/models/identity/concepts.ts:467

onBehalfOfoptional

The person or group accountable at the root of the chain the actor acted in To principal. Written at commons/data/models/identity/concepts.ts:468

tenantoptional

The tenant it was in To tenant. Written at commons/data/models/identity/concepts.ts:466

Logical: the table

Projects to the table audit_event with the primary key audit_event_id.

ColumnTypeNullRoleFrom
actiontextfalseattributeauditEvent.action
actor_kindtextfalseattributeauditEvent.actorKind
actor_principal_idtexttruereferenceauditEvent.actor
audit_event_idtextfalseattributeauditEvent.auditEventId
chainjsontrueattributeauditEvent.chain
decisiontexttrueattributeauditEvent.decision
delegation_keytexttrueattributeauditEvent.delegationKey
detailjsontrueattributeauditEvent.detail
event_hashtextfalseattributeauditEvent.eventHash
iptexttrueattributeauditEvent.ip
occurred_attimestampfalseattributeauditEvent.occurredAt
on_behalf_of_principal_idtexttruereferenceauditEvent.onBehalfOf
outcometextfalseattributeauditEvent.outcome
policy_refsjsontrueattributeauditEvent.policyRefs
previous_hashtextfalseattributeauditEvent.previousHash
reasontexttrueattributeauditEvent.reason
request_idtexttrueattributeauditEvent.requestId
run_keytexttrueattributeauditEvent.runKey
sequenceintegerfalseattributeauditEvent.sequence
session_keytexttrueattributeauditEvent.sessionKey
target_concepttexttrueattributeauditEvent.targetConcept
target_keytexttrueattributeauditEvent.targetKey
tenant_idtexttruereferenceauditEvent.tenant
trace_idtexttrueattributeauditEvent.traceId
user_agenttexttrueattributeauditEvent.userAgent

Physical: SQL

CREATE TABLE IF NOT EXISTS "audit_event" (
    "audit_event_id" VARCHAR NOT NULL PRIMARY KEY,
    "sequence" INTEGER NOT NULL,
    "occurred_at" TIMESTAMPTZ NOT NULL,
    "actor_kind" VARCHAR NOT NULL,
    "decision" VARCHAR,
    "delegation_key" VARCHAR,
    "run_key" VARCHAR,
    "trace_id" VARCHAR,
    "chain" JSON,
    "policy_refs" JSON,
    "action" VARCHAR NOT NULL,
    "outcome" VARCHAR NOT NULL,
    "target_concept" VARCHAR,
    "target_key" VARCHAR,
    "session_key" VARCHAR,
    "request_id" VARCHAR,
    "ip" VARCHAR,
    "user_agent" VARCHAR,
    "reason" VARCHAR,
    "detail" JSON,
    "previous_hash" VARCHAR NOT NULL,
    "event_hash" VARCHAR NOT NULL,
    "tenant_id" VARCHAR,
    "actor_principal_id" VARCHAR,
    "on_behalf_of_principal_id" VARCHAR,
    CONSTRAINT "audit_event_tenant_id_fk" FOREIGN KEY ("tenant_id") REFERENCES "tenant" ("tenant_id"),
    CONSTRAINT "audit_event_actor_principal_id_fk" FOREIGN KEY ("actor_principal_id") REFERENCES "principal" ("principal_id"),
    CONSTRAINT "audit_event_on_behalf_of_principal_id_fk" FOREIGN KEY ("on_behalf_of_principal_id") REFERENCES "principal" ("principal_id"),
    CONSTRAINT "audit_event_event_hash_uq" UNIQUE ("event_hash"),
    CONSTRAINT "audit_event_sequence_uq" UNIQUE ("sequence"),
    CONSTRAINT "audit_event_actor_kind_ck" CHECK ("actor_kind" IN ('user', 'machine', 'device', 'agent', 'system', 'impersonator')),
    CONSTRAINT "audit_event_decision_ck" CHECK ("decision" IN ('allow', 'deny')),
    CONSTRAINT "audit_event_outcome_ck" CHECK ("outcome" IN ('success', 'failure', 'denied'))
);

Physical: the typed table

Read and written from TypeScript with the types the model gives: import { auditEvent } from "@intellectual-frontiers/data/sql/typed/models". Generated in commons/data/sql/typed/models/identity.auto.ts: do not edit.

import { from } from "@intellectual-frontiers/data/sql/typed";
import { auditEvent } from "@intellectual-frontiers/data/sql/typed/models";

const rows = await from(auditEvent).select((s) => ({ auditEventId: s.auditEvent.auditEventId, sequence: s.auditEvent.sequence })).run(runner);

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