1. compliance
prorm
  • prorm documentation
  • Known test gaps
  • Architecture
  • Core concepts
  • Database types & coverage
  • Getting started
  • Going further
  • compliance
    • Compliance
    • The security toolkit: `prorm audit`
    • Checklists by regulation
    • Declaring personal data
    • Evidence bundles
    • Evidence
    • Frameworks: `@Security`
    • Jurisdictions
    • Platform policies
    • Protecting data
    • The regulation dataset
    • Residency and cross-border transfers
    • Retention & integrity
    • Status
    • Subject rights
  • decorators
    • prorm with decorators
    • Models with decorators
    • Querying a decorated model
    • Relations with decorators
  • diagrams
    • Diagram generators
    • Chen diagram
    • Class diagram
    • Dependency diagram
    • ER diagram
    • Flow diagram
    • From your models to a diagram
    • Gantt diagram
    • Index diagram
    • Migration diagram
    • Model diagram
    • Package diagram
    • Crow’s-foot diagram
    • Schema documentation
    • Sequence diagram
    • State diagram
    • Tree diagram
  • dialects
    • SQL dialects
    • AlloyDB Dialect
    • AlloyDB Omni Dialect
    • Amazon Athena Dialect
    • Aurora DSQL Dialect
    • Amazon Aurora MySQL Dialect
    • Amazon Aurora PostgreSQL Dialect
    • Azure Database for MySQL Dialect
    • Azure Database for PostgreSQL Dialect
    • Azure SQL Database Dialect
    • Azure SQL Managed Instance Dialect
    • Google BigQuery Dialect
    • Citus Dialect
    • ClickHouse dialect
    • Cloud Authentication (`cloud-auth`)
    • Cloud SQL for SQL Server Dialect
    • Cloud SQL for MySQL Dialect
    • Cloud SQL for PostgreSQL Dialect
    • CockroachDB Dialect
    • Azure Cosmos DB for PostgreSQL Dialect
    • CrateDB Dialect
    • Cloudflare D1 Dialect
    • Databricks dialect
    • IBM Db2 Dialect
    • Dolt Dialect
    • Apache Doris Dialect
    • Druid Dialect
    • DuckDB Dialect
    • Exasol dialect
    • Microsoft Fabric Data Warehouse Dialect
    • Firebird Dialect
    • Greenplum Dialect
    • SAP HANA Dialect
    • MySQL HeatWave Dialect
    • Azure Data Explorer (Kusto) Dialect — T-SQL
    • MariaDB Dialect
    • Materialize Dialect
    • MonetDB Dialect
    • MotherDuck Dialect
    • Microsoft SQL Server Dialect
    • MySQL Dialect
    • Neon Dialect
    • OceanBase Dialect
    • openGauss Dialect
    • Oracle Dialect
    • Oracle Autonomous Database Dialect
    • ParadeDB Dialect
    • PolarDB Dialect
    • PostgreSQL Dialect
    • Presto Dialect
    • QuestDB Dialect
    • Aurora RDS Data API Dialect (`rdsdata`)
    • Amazon RDS for Db2 Dialect
    • Amazon RDS for MariaDB Dialect
    • Amazon RDS for SQL Server Dialect
    • Amazon RDS for MySQL Dialect
    • Amazon RDS for Oracle Dialect
    • Amazon RDS for PostgreSQL Dialect
    • Amazon Redshift
    • Amazon Redshift Data API Dialect
    • RisingWave Dialect
    • rqlite Dialect
    • SingleStore Dialect
    • Snowflake Dialect
    • Google Cloud Spanner Dialect
    • Spanner (PostgreSQL interface) Dialect
    • SQLite Dialect
    • StarRocks Dialect
    • Supabase Dialect
    • Azure Synapse Analytics (dedicated SQL pool)
    • Teradata Dialect
    • TiDB Dialect
    • TimescaleDB Dialect
    • Trino Dialect
    • Turso / libSQL Dialect
    • Vertica dialect
    • Vitess Dialect
    • Yellowbrick Dialect
    • YugabyteDB Dialect
  • guides
    • Access rules and behaviour profiles
    • ArangoDB (AQL)
    • Associations
    • Audit levels and escalation
    • Audit logging
    • In the browser
    • Bulk operations
    • Caching
    • Capabilities, tiers and team roles
    • CLI
    • Cloudflare
    • Compliance & data protection
    • Connection Pooling & Performance
    • Security in the console
    • Couchbase: structured N1QL queries
    • Data types
    • Decorators
    • Eager loading
    • Enums and constants
    • Error handling & error types
    • Extensions
    • External fields
    • Foreign data wrappers
    • Graph databases
    • Hooks & lifecycle events
    • Indexes & constraints
    • InfluxDB: structured Flux pipelines
    • klock-errors
    • klock — the `.klock` file
    • Local databases (`prorm db up`)
    • Structured log search — Splunk, Graylog, Papertrail, Sumo Logic
    • Logging
    • Grafana Loki: structured LogQL queries
    • MCP server
    • Migrate — the data transfer subsystem
    • Migrations & Schema Sync
    • Models from an existing database
    • Defining models
    • Multiple databases
    • OrientDB, Neptune and TigerGraph
    • Passwords
    • Importing a Prisma schema
    • Structured PromQL and MetricsQL
    • Query firewall
    • QueryInterface
    • Query operators reference
    • Query optimization
    • Composing find options with `pipe()` and `Q`
    • Query safety: the fail-closed WHERE guard
    • Querying
    • Raw Queries & Query Building
    • Read replicas
    • Schema diffing & migration generation
    • Views, triggers & other schema objects
    • Scopes & default scopes
    • Seeders
    • SPARQL / RDF triplestores
    • SQL constants
    • SQL features
    • SQL function builders
    • SQLite advanced features
    • StoreKey — a prod-orm database as the storage
    • Streaming results
    • Terraform
    • Transactions & Isolation Levels
    • Type mapping: legacy and modern
    • TypeScript types
    • Database users, roles & privileges
    • Validation & constraints
    • Virtual & Computed Fields
    • Writing docs
  • javascript
    • prorm in JavaScript
    • Models in JavaScript
    • Querying in JavaScript
    • Relations in JavaScript
  • runbooks
    • Operational runbooks
    • Connection failures
    • Credential rotation
    • Failover
    • Incident checklist
    • Deploying klock v2
    • Migration rollback
  • running-databases
    • Running databases in Docker
    • Running prorm under Bun in Docker
    • Running Cassandra in Docker with prorm
    • Running ClickHouse in Docker with prorm
    • Running CockroachDB in Docker with prorm
    • Running prorm under Deno in Docker
    • Running Elasticsearch in Docker with prorm
    • Running MariaDB in Docker with prorm
    • Running MongoDB in Docker with prorm
  • prorm control plane
    • Introduction
    • Authentication
    • Errors
    • Getting started
      • Service
        • Is it up
        • This description
    • Account
      • Sign-up and verification
        • Create an account
        • Exchange credentials for a token
        • Verify with the emailed code
        • Verify by clicking the emailed link
        • Name the parent or guardian
        • What a consent link is about
        • Give consent for a child's account
        • Ask the parent or guardian again
        • Send a new code and link
      • Family
        • Everyone this account is responsible for
        • One child, in detail
        • Turn a limit on or off
      • Profile
        • Who am I
        • Change the account
        • Every address on the account
        • Add an address
        • Confirm an address with the code mailed to it
        • Mail a fresh code to an unconfirmed address
        • Make an address primary
        • Remove an address
        • What this caller may do
    • Security
      • Sessions
        • Everywhere this account is signed in
        • Sign out everywhere else
        • Sign one out
        • A token for the CLI on a named machine
        • A token for the customer console, from the staff one
        • Park a sign-in for the CLI to collect
        • The CLI collecting its sign-in
        • The team's members' live sessions
        • Sign a member's session out
        • Sign an account out everywhere
        • Everywhere the account is signed in
        • Sign an account's session out
      • Single sign-on
        • Begin a single sign-on
        • The provider's return
        • Link the signed-in account to a team's provider
        • Which team an address signs in to
        • The team's single sign-on, as a member sees it
        • Set the team's OpenID Connect provider up, or change it
        • Remove the provider
        • The team's domain claims and the DNS record each needs
        • Prove a claimed domain
      • MFA and passwords
        • Start enrolling a second factor
        • Prove the app has it
        • Remove the second factor
        • Ask for a reset link
        • Set a new password with the emailed token
      • Klock
        • Open a device-bound klock session
        • Check in, for the next grant
        • Step up the session asking
        • Rotate the device key
        • Freeze a session
        • Unfreeze a session
        • A guest grant
        • The revocation feed
        • The published keyset
        • What this control plane supports
      • Devices
        • Your devices, or a team's
        • Approve a new device's pairing code
        • One device
        • Rename a device
        • Revoke a device
        • Suspend a device
        • Reinstate a suspended device
        • Wipe a device
        • Ask a device to rotate its key
        • The team's members' devices
        • Revoke a member's device
        • An account's devices
        • Revoke an account's device
        • Wipe an account's device
        • The device fleet
      • Access rules and behaviour
        • The access rules that bear on you
        • Add an access rule
        • This request, as the rules see it
        • One access rule
        • Remove an access rule
        • The behaviour profiles that bear on you
        • Add or change a behaviour profile
        • The profile presets
        • Your behaviour findings
        • Acknowledge a finding
        • One behaviour profile
        • Remove a behaviour profile
        • The team's access rules
        • Add a team access rule
        • Remove a team access rule
        • The team's behaviour profiles
        • Add or change a team behaviour profile
        • Remove a team behaviour profile
        • What the team's profiles caught
        • Acknowledge a team finding
      • Recovery and lockdown
        • Ask for a recovery link
        • Recover access with the emailed code
        • Is the account locked down
        • Lock the account down
        • Release a lockdown
        • Lock a member down
        • Release a member's lockdown
      • MCP tokens
        • Make a delegated token for one MCP client
        • The account's delegated tokens
        • Revoke a delegated token
        • What a delegated token may do now
        • Run one MCP tool with a delegated token
        • Run a device-signed MCP tool call relayed by the MCP Worker
      • Kerberos
        • Give the team its own Kerberos realm
        • The team's realm
        • Remove the team's realm
    • Logging and monitoring
      • Audit log
        • What has been done to the account
        • What has happened to this account
        • The account's audit trail
      • Operations
        • Everything that has been asked of this database
        • One, with its steps
        • Stop it
        • Put a failed one back in the queue
        • Every operation, across all accounts
      • Metrics and events
        • Every measurement, for a graph
        • Who did what to it
    • Billing
      • Plans and pricing
        • What the plans allow
        • The rate card
        • What one database would cost
        • What this account is paying for, itemised
      • Subscriptions and invoices
        • What this month's invoice will say
        • What this account is on
        • What it has been charged
        • Start a Stripe Checkout session
        • Open the customer portal
        • Stripe's events
        • Buy more connection pools
      • Team billing
        • The team's billing account
        • What the team has been charged
        • What this month's invoice will say
        • The team's cards
        • Add a card, through a Stripe-hosted setup session
        • Make a card the team's default
        • Remove a card
        • Start the team paying
        • Open the Stripe portal on the team's customer
        • Change the team's plan
        • Who receives the team's bills
        • How the team pays for transfers
    • Support
      • Support chat
        • My conversations
        • Start a conversation
        • Every support conversation, open first
        • A ticket for the socket
        • One conversation, with who is in it and who is connected
        • Rename a group; open or close a support conversation
        • The lines, oldest first
        • Say something
        • Add somebody
        • Mark read
    • Administration
      • Users
        • Every account
        • One account, with everything hanging off it
        • Grant or revoke admin
        • Verify an account by hand
        • Lock or unlock sign-in
        • Allow or hold provisioning
        • Send the verification mail again
        • Set the plan by hand
      • Platform
        • Every database and store, across all accounts
        • The counts worth putting on a dashboard
      • Staff and permissions
        • What kind of admin the caller is, and which scopes they hold
        • The admin presets
        • Every admin, and the scopes each resolves to
        • Make an account an admin of a kind
        • Change an admin's kind, or a custom admin's scopes
        • Revoke admin
      • Team administration
        • Every team, with its owner and size
        • One team in full — members with their accounts, and projects
        • Hand the team to another member
        • Put an account in the team, active at once
        • Change a member's role
        • Remove a member
      • Assumed identities
        • Assume an identity — act as a customer account
        • The identities the caller holds open
        • End an assumed identity
      • Support inbox
        • The platform's addresses
        • Add a platform address
        • One address, with its counts
        • Change an address's label, routing, or whether it accepts mail
        • Remove an address that holds no mail
        • Make, adopt or repair the address's routing rule
        • Every admin's personal address, made where missing
        • File a raw message, as if it had arrived
        • The inbox
        • One message, whole
        • Mark a message
        • Hand a message to an admin, or take it back
        • Leave an internal note
        • Reply, from the address the message came to
        • What is waiting
    • Databases
      • Databases
        • Data stores
          • Every data store on the account
          • Provision a data store
          • Change a data store that is already running
          • One data store
          • Deprovision it
          • Report what it is using
          • How to reach a data store
        • Connections and credentials
          • The api keys on a database
          • Issue a key
          • Revoke a key
          • The engine users we created
          • Create a user inside the database
          • Give a user a new password
          • Drop a user
          • How the database is reached
          • Set how it is reached
          • Revoke every api key on it
          • How to connect to it
          • The ssh keys that open its bastion
          • Add a key, or have one made
          • The private half of a generated key, once
          • Revoke an ssh key
        • Schema and objects
          • The SQL objects we put in it
          • Create one, and apply it
          • What is in the database, as the engine reports it
          • One table
          • What it would run, without running it
          • Redefine an object in place
          • Drop it
          • The extensions installed in it
        • Migrations
          • A plan compiled to statements, recording nothing
          • The migrations recorded for it
          • Record one
          • Apply everything recorded and not yet run
          • Apply everything pending, oldest version first
        • Lifecycle
          • Grow or shrink it
          • Stop it accepting connections
          • Start it again
          • Move it to another region
        • Backups and replicas
          • Take a backup
          • The backups it has
          • Restore one into it
          • What has been restored into it, and from where
          • Its read copies
          • Add one
        • Policies
          • The catalog
          • One policy
          • What this database is held to
          • Switch a policy on, or change its knobs
          • Switch it off
          • Mark the policies reviewed
          • Evaluate the periodic policies now
          • Who is behind a credential
        • Passwordless
          • The database's passwordless sessions
          • Issue a passwordless session (v1)
          • Revoke a passwordless session
          • Bind a session to a device key
          • Issue a v2 session for a host to bind
          • Redeem an enrolment ticket on the host
          • Check a passwordless credential
          • Run one described query under a passwordless credential
        • Database roles
          • The database's roles
          • Define a role
          • One role
          • Change what a role permits
          • Delete a role, and revoke every key granted it
          • Grant a role, which mints a key
          • Who holds a role
          • The api keys bound to a role
        • Pools
          • A database's connection pools, and how busy each is
          • Open another pool
          • Rename a pool or change its size
          • Close a pool
        • Data plane
          • Run a query against a database
          • Several statements, in order, over one connection
          • Is this database answering
          • What the proxy itself is holding
        • Transfers
          • The strategies this account's tier may use
          • Price a transfer without creating it
          • The account's transfer jobs, newest first
          • Create a transfer job
          • One job, and whether its certificate holds
          • Cancel an unfinished job
          • Start a created job, confirming its price
          • Report a job's status (the runner, or the owner's side of a local run)
        • Every database on the account
        • Provision a database
        • Change a database that is already running
        • One database
        • Deprovision it
        • Read or write it
        • Report what it is using
        • The engines this API will provision
        • Where a managed database can be put
    • Teams
      • Teams
        • Members
          • Who is on it
          • Invite somebody
          • Accept an invitation
          • Change somebody's role
          • Remove somebody
        • Projects
          • The projects a team runs
          • Start one
          • Rename a project, or move its environment
          • Delete a project
          • One project, and what is in it
          • Put a database or store in it
          • What is in a project
          • Take one out
        • The teams this account is on
        • Start one
        • The twelve roles, and what each may do
        • Rename a team
        • Close a team
        • One team
        • Hand the team to somebody else
        • Leave a team
    • Schemas
      • Error
      • ValidationErrors
      • Token
      • PolicyCategory
      • PolicySeverity
      • PolicyAction
      • PolicyTrigger
      • PolicyParam
      • Policy
      • PolicyCatalog
      • PolicyAssignment
      • PolicyOutcome
      • PolicyFiring
      • CredentialTrace
      • Relation
      • Restrictions
      • ChildSummary
      • SignupRequest
      • SigninRequest
      • UpdateMeRequest
      • User
      • Address
      • GeoPoint
      • D1Region
      • Usage
      • UsageReport
      • Resource
      • Database
      • DataStore
      • NewDatabase
      • NewDataStore
      • QueryRequest
      • DatabasePrivilege
      • ApiKey
      • DbUser
      • Access
      • AccessRequest
      • DatabaseObject
      • NewDatabaseObject
      • NewMigration
      • SchemaOperation
      • Migration
      • Operation
      • Session
      • AdminPowers
      • Admin
      • AuditEntry
      • TeamRole
      • Conversation
      • ChatMessage
      • TeamSso
      • Team
      • TeamMember
      • SshKey
      • ConnectionInfo
      • InboxAddress
      • InboxMailbox
      • InboxMessageSummary
      • InboxMessage
      • InboxNote
      • Page
      • Quote
      • Plan
      • ApiError
      • CapabilityRefusal
      • KlockErrorCode
      • PageWindow
      • SessionView
      • KlockStepUpRequest
      • KlockOpenRequest
      • KlockOpenedSession
      • UpdateMeResult
      • CapabilitiesView
      • SessionLimits
      • Device
      • DeviceListed
      • DeviceTeamRef
      • DeviceCommand
      • DeviceAuditLine
      • DeviceActionRequest
      • StaffActionRequest
      • ManagedSession
      • SessionRevoked
      • AccessRule
      • AccessRuleRequest
      • BehaviourProfile
      • BehaviourProfileRequest
      • BehaviourProfileSaved
      • BehaviourFinding
      • BehaviourFindingAck
      • StepUpProof
      • Removed
      • MemberLockdownRequest
      • McpClient
      • McpDelegatedView
      • McpToolCall
      • McpForwardRequest
      • PasswordlessScope
      • RoleScope
      • PasswordlessSession
      • PasswordlessTlsMaterial
      • PasswordlessKerberosMaterial
      • ServiceDeviceKeys
      • ServiceSession
      • DatabaseRole
      • TransferEndpoint
      • TransferJobRequest
      • TransferQuote
      • TransferStrategy
      • TransferJob
      • TransferJobAccess
      • Pool
      • PoolAllowance
      • BillingSubscription
      • Invoice
      • BillingContact
      • PaymentMethod
      • UpcomingCharges
      • TeamBilling
      • TeamKerberosRealm
      • TeamSsoDomain
      • TeamSsoResponse
      • StoreConnection
      • BatchFailure
      • ProxyStatus
  1. compliance

The security toolkit: `prorm audit`

prorm audit looks at a project and records what it finds: patterns in the
code that weaken security, what a live database says about its own
configuration, and which checklist items people have attested to. It writes
that down as SARIF, as JSON, and as an evidence bundle that can be verified
later.

This report records technical evidence mapped to control references. It is
not an audit, attestation, or certification, and it does not determine
compliance.

Every report the toolkit writes opens with that sentence, and the toolkit is
held to it. A clean scan means the specific patterns it looks for were not seen
in the files it scanned. It does not mean a control operates, and it says
nothing about the people, paperwork and processes most frameworks are about.

CommandWhat it does
prorm audit code [path]Static rules over TypeScript and JavaScript, committed .env / .klock files, every .klock the scan finds, and production deployment configs. Table, JSON or SARIF.
prorm audit checklist [framework]The checklists: SOC 2, ISO/IEC 27001:2022, the HIPAA Security Rule, PCI DSS v4.0.1, GDPR.
prorm audit attest <item-id>Record a person's attestation for an item.
prorm audit dbRead-only probes of a live database.
prorm audit klock [path]The klock checks: .klock files in the project and your own, production configs, and (signed in) read-only probes of your account.
prorm audit run [path]All of the above, evaluated per checklist, written to an evidence bundle. The account probes run only with --account.
prorm audit verify <bundle>Recompute every hash in a bundle and check its signature.
prorm audit export <bundle>Item statuses as evidence-json or evidence-csv, for a GRC tool or a compliance automation platform.
prorm audit logThe account audit log (what prorm audit used to be; see below).

src/compliance/audit/ holds the implementation. It is unrelated to
src/audit/, which is the ORM's change logger.

A first audit, end to end

The project below is two files: an Express route that builds SQL from
req.params, and a connection that switches off certificate checks. The output
is what the commands print for it.

Scan the code

$ prorm audit code .
rule     severity  confidence  location                    message
TLS-002  high      high        src/db/connection.ts:9:28   rejectUnauthorized: false accepts any server certificate.
SQL-001  critical  high        src/routes/reports.ts:7:34  SQL passed to query() is built from request input in the same function (1 interpolated value(s)). Bind the values as parameters instead.
2 file(s), 19 rule(s): 2 finding(s), 0 suppressed.
$ echo $?
6

SQL-001 is critical because the interpolated value is traced to
req.params in the same function. Exit code 6 means an unsuppressed finding at
or above --fail-on (default high).

Fix it, or suppress it with a reason

 reports.get('/reports/:id', async (req, res) => {
-  const rows = await prorm.query(`SELECT * FROM reports WHERE id = ${req.params.id}`);
+  const rows = await prorm.query('SELECT * FROM reports WHERE id = ?', {
+    replacements: [req.params.id],
+  });
   res.json(rows);
 });

A suppression without a reason does not suppress anything. It adds a finding:

$ prorm audit code .
rule     severity  confidence  location                    message
TLS-002  high      high        src/db/connection.ts:9:28   rejectUnauthorized: false accepts any server certificate.
AUD-001  medium    high        src/routes/reports.ts:7:1   prorm-audit-ignore SQL-001 has no reason, so it suppresses nothing. Add ": <reason>".
SQL-001  critical  high        src/routes/reports.ts:8:34  SQL passed to query() is built from request input in the same function (1 interpolated value(s)). Bind the values as parameters instead.
2 file(s), 19 rule(s): 3 finding(s), 0 suppressed.

Evaluate the checklists and write a bundle

$ prorm audit run . --framework soc2,hipaa --out evidence --sign-key ~/.prorm/evidence-ed25519.pem
This report records technical evidence mapped to control references. It is not an audit, attestation, or certification, and it does not determine compliance.
checklist       evidence-supports  evidence-contradicts  inconclusive  not-run  attested  attestation-missing  attestation-expired  not-applicable
soc2-tsc        6                  2                     5             4        0         16                   0                    0
hipaa-security  3                  2                     6             4        0         19                   0                    0
✓ Evidence bundle: evidence/prorm-evidence-shop-20260926T221349Z
Check it later with: prorm audit verify evidence/prorm-evidence-shop-20260926T221349Z

Most of each checklist is attestation-missing. That is expected. Those items
are about people and paperwork, and they move only when someone runs
prorm audit attest. The klock behaviour-monitoring items
are not-run here because the account probes need --account.

Verify it, and hand it over

$ prorm audit verify evidence/prorm-evidence-shop-20260926T221349Z --public-key evidence.pub.pem
✓ 7 file(s) match SHA256SUMS; signature valid.

See Evidence bundles for what is inside and how
tampering shows up.

How audit run fits together

flowchart TD
  A["prorm audit run [path]"] --> B["scanPath: 19 rules over TS/JS, .env / .klock files and production configs"]
  A --> C["--db: runDbProbes, a fixed list of read-only statements"]
  A --> CK["--account: runKlockAccountProbes, read-only GETs as the signed-in account"]
  B --> D["findings"]
  C --> E["probesToFindings"]
  E --> D
  CK --> EK["accountProbesToFindings"]
  EK --> D
  F[".prorm/checklists/*.yaml: not-applicable overrides"] --> G
  H[".prorm/attestations/item-id.yaml"] --> G
  D --> G["evaluateChecklist, one status per item, per framework"]
  G --> I["results.json, findings.sarif, evidence/*.json, report.md, report.html"]
  I --> J["writeBundle: manifest.json and SHA256SUMS"]
  J --> K{"--sign-key given?"}
  K -- yes --> L["SHA256SUMS.sig and signature.json, ed25519"]
  K -- no --> M["unsigned bundle"]
  L --> N["prorm audit verify, prorm audit export"]
  M --> N

The diagram follows runAudit() in src/compliance/audit/run.ts: the code
scan, the optional database probes and the optional klock account probes all
become findings, the findings,
overrides and attestations are evaluated against each chosen checklist, and
everything is written as one hashed, optionally signed, directory.

What it needs

The rules parse source with the TypeScript compiler API. typescript is an
optional peer dependency, loaded only when audit code or audit run
runs. A plain JavaScript project installs it as a dev dependency:

npm install --save-dev typescript

Nothing else is needed. The built-in checklists ship as compiled data, so
nothing parses YAML at runtime. Your own overrides and attestations under
.prorm/ are read with the yaml package if it is installed, and with a small
built-in reader otherwise.

The rules

Rules are syntax visitors with no type information, so each one looks at one
file, and within a function at most. Every rule has at least five fixtures
that must be flagged and five that must not
(tests/audit/fixtures/<RULE>/{bad,good}/).

IdSeverityWhat it looks for
SQL-001high; critical when tracedA template literal or string concatenation passed to .query() (also $queryRawUnsafe, $executeRawUnsafe, .unsafe()). Critical when an interpolated value comes from req.body / req.query / req.params, ctx.request, event.body or process.argv in the same function. Constants, ? placeholder lists, numeric coercions and calls to quoting or escaping helpers are not counted.
SQL-002high; critical when tracedliteral(x) with anything but a constant string.
TLS-001highA connection object for a network dialect, or a connection URL, with no ssl / encrypt / sslmode, or with TLS switched off. Local hosts are ignored.
TLS-002highrejectUnauthorized: false, trustServerCertificate: true, sslmode of disable/allow/prefer/require, ssl: 'require', or NODE_TLS_REJECT_UNAUTHORIZED=0.
SEC-001high (low for a local host)A URL literal with a password in it. The password is never repeated in output.
SEC-002high; critical when weakconfigureFieldEncryption('<literal>'), a hard-coded fallback (process.env.KEY || '…'), a key built from a literal, or a literal key in a keyring.
SEC-003critical; medium for a keyless v2 .klockA committed .env* file with DB_PASSWORD (and similar) or a credentialed DATABASE_URL, or a committed *.klock file (see klock). A .klock holding a bearer secret or private key material, and any v1 file, is critical. A v2 file whose device key is in the key store is medium: it holds no secret, but it names the device and its session. The message says which kinds of material the file holds, never their values. "Committed" means git ls-files lists it. Outside a repository, any file present counts, with medium confidence. .env.example, .env.sample and .env.template are skipped.
GRANT-001highGRANT ALL, PRIVILEGE_LEVELS.ALL, or privileges: 'ALL'.
GRANT-002highA grant TO PUBLIC, ON *.*, or to 'user'@'%'.
GRANT-003highSUPERUSER, CREATEROLE, BYPASSRLS or sysadmin membership granted in a migration or seeder.
PII-001mediumA @Personal column of a sensitive category on a model under HIPAA, PCI DSS or GDPR (by @Security frameworks, or an EU/UK @Jurisdiction) that nothing marks for field encryption.
PII-003criticalA model column named like a card verification code or magnetic-stripe track data (cvv, cvc2, track2Data, …). These must not be stored after authorisation, encrypted or not.
CFG-001mediumQueryFirewall.create() in allowlist or strict mode with no allow rules in the file. It fails closed and denies every query.
CFG-002lowA @Security option that only records a flag (dsar, pia, backupVerification, queryFirewall, breachDetection, crossBorderLog, consentVersioning, sensitiveDataDiscovery). securityWiring(Model) tells a wired control from a flag, and a flag is never counted as evidence.
AUD-001mediumA suppression with no reason.

The klock checks (KLOCK-001 to
KLOCK-008) have their own section below.

How many checks there are

Counted from ALL_RULES, KLOCK_LOCAL_RULE_IDS and CHECKS in
src/compliance/audit/ with a scratch script (ALL_RULES.length, grouped by
the id prefix; CHECKS grouped by kind; the scan's own rulesRun):

CategoryChecksIds
SQL (dynamic SQL)2SQL-001, SQL-002
TLS (transport)2TLS-001, TLS-002
SEC (secrets)3SEC-001, SEC-002, SEC-003
GRANT (privileges in migrations)3GRANT-001, GRANT-002, GRANT-003
PII (regulated columns)2PII-001, PII-003
CFG (configuration)2CFG-001, CFG-002
AUD (the toolkit itself)1AUD-001
KLOCK, local (klock files and configs)4KLOCK-001, KLOCK-003, KLOCK-007, KLOCK-008
Code rules19run by audit code, audit run and audit klock
Database probes (DB-*)8run by audit db and audit run --db
KLOCK, account probes2KLOCK-005, KLOCK-006, run by audit klock and audit run --account. KLOCK-001 is also probed there, and counted once, as a code rule.
Runtime (RT-TLS)1TLSEnforcer.verifyRuntime() from application code
Every check30the ids a checklist item may name in checks[]

Each finding carries ruleId, severity, confidence, message,
location, controls (the common control keys in
regulations), checklistItems (every item whose checks
include the rule) and fingerprint. The fingerprint is built from the rule, the
file, the enclosing function and the finding's position among its siblings, so
it survives lines being added above it.

Suppressing a finding

Inline, on the line or the line above:

// prorm-audit-ignore SQL-001: `column` is checked against COLUMNS above
const rows = await prorm.query(`SELECT ${column} FROM reports`);

Or in a baseline, .prorm/audit-baseline.json, keyed by fingerprint. You can
write one for the current findings:

prorm audit code --write-baseline --reason "pre-existing; tracked in SEC-142"

A suppression needs a reason. Without one it suppresses nothing, and it becomes
an AUD-001 finding itself. Suppressed findings stay in the JSON, in SARIF (as
suppressions with the justification) and in the report.

SARIF

--format sarif writes SARIF 2.1.0. It includes rules[] with helpUri and
security-severity, per-result partialFingerprints, and levels mapped from
severity (critical/high → error, medium → warning, low/info → note).
Code-scanning dashboards read it as it is:

prorm audit code --format sarif --out prorm.sarif

In GitHub Actions, upload it with the code-scanning action. The if: always()
matters: the audit step exits 6 when it finds something, and that is exactly
when you want the upload to run.

name: prorm audit
on: [push, pull_request]
permissions:
  contents: read
  security-events: write
jobs:
  audit:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with:
          node-version: 22
      - run: npm ci
      - run: npx prorm audit code --format sarif --out prorm.sarif --fail-on critical
      - uses: github/codeql-action/upload-sarif@v3
        if: always()
        with:
          sarif_file: prorm.sarif
One SARIF result, from the scan above
{
  "level": "error",
  "locations": [
    {
      "physicalLocation": {
        "artifactLocation": { "uri": "src/routes/reports.ts", "uriBaseId": "%SRCROOT%" },
        "region": { "startLine": 7, "startColumn": 34, "endLine": 7, "endColumn": 85 }
      }
    }
  ],
  "message": {
    "text": "SQL passed to query() is built from request input in the same function (1 interpolated value(s)). Bind the values as parameters instead."
  },
  "partialFingerprints": { "prormFingerprint/v1": "e0eb5a9bbfb4cb021cce639d01a93536" },
  "properties": {
    "checklistItems": [
      "gdpr.art25-secure-by-design",
      "hipaa.164-312-c-injection-integrity",
      "iso.a8-28-secure-coding",
      "pci.6-2-4-injection-prevention",
      "soc2.cc7-1-injection-prevention"
    ],
    "confidence": "high",
    "controls": [],
    "security-severity": "9.5",
    "severity": "critical"
  },
  "ruleId": "SQL-001",
  "ruleIndex": 15
}

The rule itself sits in runs[0].tool.driver.rules[] with its helpUri
(…/docs/compliance/audit#sql-001) and a default security-severity of
8.0. The result carries 9.5 because tracing to request input made it
critical.

Checklists

Five checklists, each with 25 to 40 items, live in
compliance/checklists/*.yaml and are compiled by
scripts/build-checklists.mjs:

  • soc2-tsc
  • iso27001-2022
  • hipaa-security
  • pci-dss-4.0.1
  • gdpr

Counted from checklists() in src/compliance/checklists.ts with the same
scratch script (items.length, then grouped by automation and by
responsibility); every checklist is at checklistVersion 1.0.0:

ChecklistSource editionItemsautomatedpartialmanualcustomershared
soc2-tscTSC 2017, points of focus revised 2022331210111914
iso27001-2022ISO/IEC 27001:2022 Annex A36916111917
hipaa-security45 CFR Part 164 Subpart C34712152113
pci-dss-4.0.1PCI DSS v4.0.1351211122114
gdprRegulation (EU) 2016/67933813121815
All1714862619873

No item has responsibility: library: every one is the project's to act on,
alone (customer) or with the library's controls as part of the answer
(shared).

xychart-beta
    title "Items a check can show on its own (automation: automated)"
    x-axis ["soc2-tsc", "iso27001-2022", "hipaa-security", "pci-dss-4.0.1", "gdpr"]
    y-axis "items" 0 --> 15
    bar [12, 9, 7, 12, 8]

The bars are the automated column of the table above; the rest of every
checklist, 123 of the 171 items, needs a person's attestation before it can
leave inconclusive or attestation-missing.

SOC 2, ISO and PCI control text is copyrighted. The checklists store only the
reference id and a title written for this project. HIPAA and GDPR are public
law. Read the published standard for the authoritative wording.

Each item says how much of it a tool can show:

  • automated: a rule or probe covers it, such as TLS configuration, embedded
    credentials, dynamic SQL, grants or card-data columns.
  • partial: a check covers part of it, but the item is about operation over
    a period, such as logging retained and reviewed, backups tested or keys
    rotated. Clean checks alone leave it inconclusive.
  • manual: people and paperwork, such as policies, BAAs and DPAs,
    training, penetration tests, risk assessments and access reviews. Only an
    attestation moves it.
prorm audit checklist                 # the five, with counts
prorm audit checklist hipaa --automation manual
prorm audit checklist --item pci.3-3-1-no-sad

The automated half of GDPR, with the checks behind each item:

$ prorm audit checklist gdpr --automation automated
GDPR - technical evidence map — References only; titles are paraphrased in our own words. Read the published source for the authoritative text.
id                                   control        title                                                                    automation  checks
gdpr.art25-secure-by-design          Art. 25(1)     Data protection by design                                                automated   SQL-001 SQL-002 AUD-001
gdpr.art25-default-restriction       Art. 25(2)     Data protection by default                                               automated   GRANT-002 DB-GRANTS DB-RLS
gdpr.art32-encryption-transit        Art. 32(1)(a)  Encryption of personal data in transit                                   automated   TLS-001 DB-TLS RT-TLS
gdpr.art32-cert-verification         Art. 32(1)(b)  Confidentiality of connections                                           automated   TLS-002 DB-SECTRANSPORT
gdpr.art32-encryption-at-rest        Art. 32(1)(a)  Encryption of stored personal data                                       automated   PII-001 SEC-002
gdpr.art32-no-embedded-credentials   Art. 32(1)(b)  Credentials kept out of source                                           automated   SEC-001 SEC-003
gdpr.art32-access-restriction        Art. 32(4)     Access limited to those instructed                                       automated   GRANT-001 GRANT-003 DB-PRIV
gdpr.art32-klock-credential-custody  Art. 32(1)(b)  Machine credentials stay in the key store, readable only by their owner  automated   KLOCK-001 KLOCK-003 KLOCK-007

Statuses

StatusMeaning
evidence-supportsAutomated checks ran and found nothing contradicting the item.
evidence-contradictsAt least one automated check produced a finding against the item.
inconclusiveChecks ran, but they cannot show the item on their own.
not-runThe checks this item relies on were not run.
attestedA person has attested to the item, and the attestation is in date.
attestation-missingThe item needs a person to attest to it, and nobody has.
attestation-expiredThe item was attested to, but the attestation has expired.
not-applicableMarked not applicable, with a recorded justification.

The toolkit uses these statuses and nothing else. There is no score and no
pass mark.

flowchart TD
  S["checklist item"] --> NA{"marked not applicable?"}
  NA -- yes --> R1["not-applicable"]
  NA -- no --> C{"an active finding from one of its checks?"}
  C -- yes --> R2["evidence-contradicts"]
  C -- no --> AUT{"automation level"}
  AUT -- automated --> ALL{"how many of its checks ran?"}
  ALL -- all --> R3["evidence-supports"]
  ALL -- some --> R4["inconclusive"]
  ALL -- none --> R5["not-run"]
  AUT -- "partial or manual" --> ATT{"attestation on file?"}
  ATT -- "in date" --> R6["attested"]
  ATT -- "expired, or older than the freshness window" --> R7["attestation-expired"]
  ATT -- none --> P{"partial, and a check ran?"}
  P -- yes --> R4
  P -- "partial, none ran" --> R5
  P -- manual --> R8["attestation-missing"]

This is evaluateItem() in src/compliance/audit/evaluate.ts, in the order
it tests: an override wins over everything, a finding wins over an
attestation, and a partial item with clean checks is still inconclusive
until someone attests to how the control operates over time.

Not applicable

.prorm/checklists/*.yaml:

notApplicable:
  - item: soc2.cc6-6-query-firewall
    justification: Queries are restricted by database roles and network policy; no application query firewall is used.

An entry without a justification is reported and not applied.

Attestations

prorm audit attest <item-id> asks for each field, or takes them as flags:

prorm audit attest hipaa.164-308-b-baa \
  --by ana@example.com --role "Privacy officer" \
  --statement "BAAs signed with every processor on the register" \
  --evidence CONTRACT-2026-014,CONTRACT-2026-022

This writes .prorm/attestations/<item-id>.yaml:

item: hipaa.164-308-b-baa
attestedBy: ana@example.com
role: Privacy officer
date: 2026-09-25
expires: 2027-09-25
statement: BAAs signed with every processor on the register
evidenceRefs:
  - CONTRACT-2026-014
  - CONTRACT-2026-022

An attestation expires on its expires date, or when it is older than the
item's freshness window, whichever comes first.

Database probes

prorm audit db connects with the usual connection flags (--url,
$DATABASE_URL, --dialect and so on) and runs a fixed list of read-only
statements. The executor refuses anything not on that list. It keeps counts and
flags, never row values.

CheckPostgreSQLMySQL / MariaDBSQL Server
DB-TLSpg_stat_ssl for this backendSsl_versionencrypt_option for this session
DB-PRIVsuperuser or rolbypassrlsALL on *.* or SUPERsysadmin membership
DB-PWENCpassword_encryption is scram-sha-256
DB-RLSRLS on each table in --rls-tables
DB-AUDITLOGpgaudit installed
DB-GRANTSgrants on *.* or to '%'
DB-SECTRANSPORTrequire_secure_transport
DB-READONLYwarns when the probing role can writesamesame

SQLite, D1 and DuckDB have no session or server role, so the probes report
not-applicable. TLSEnforcer.verifyRuntime(prorm) runs the same TLS query
from application code.

klock checks: prorm audit klock

The klock checks look at how klock credentials are kept.
They come in two kinds, like the rest of the toolkit:

  • Local checks run inside every code scan (audit code, audit run,
    audit klock), with no network. They read every .klock file the scan
    finds, committed or not, and production deployment configs for the prorm
    API.
  • Account probes are read-only GETs as the signed-in account:
    /me/capabilities, /security/devices, /security/behaviour (admins
    only) and /security/access-rules. They run only from prorm audit klock
    (when signed in and not --offline) and prorm audit run --account. A
    route the API does not offer (404, 405, 501 or 503) makes the probe
    unknown, never a pass.
IdKindSeverityWhat it finds
KLOCK-001code and accountmediumA v2 .klock that keeps private key material in the file: device.sign or device.seal private keys, keyStore: "file", a file-held TLS key or a file-held keytab. As a probe: a live enrolled device with keyStore: "file".
KLOCK-003codemediumA v1 .klock holding a bearer secret (not a local klock) where the API offers v2. The fix is prorm klock upgrade <file> --drop-secret. When the API says it offers no v2, the check says nothing.
KLOCK-005accountmediumAn account with admin scopes and no account-scope behaviour profile. Not an admin: not-applicable.
KLOCK-006accountlowAccess rules in report mode for more than --report-days days (default 30). Legacy blockedIps mirrors, disabled rules and a new rule's trial period are excluded.
KLOCK-007codehigh (world-readable); medium (group only)A .klock with group or other permission bits. Not checked on Windows.
KLOCK-008codemediumA production deployment config for the prorm API (one that mentions CAPABILITY_ENFORCEMENT*, CAPABILITY_E3 or KLOCK_GRANT_KEY outside comments) whose production vars do not turn CAPABILITY_E3 on. It reads wrangler*.json, wrangler*.jsonc and wrangler*.toml (env.production.vars when present, because wrangler does not inherit vars), .env.production, .env.prod, production.env and .dev.vars.production.

KLOCK-002 (an admin without MFA) and KLOCK-004 (a service session without
rotateBy) are not implemented, because the API does not show either fact to
the account. The ids are kept free for them.

When E3 is set somewhere the scan cannot see, such as the Cloudflare
dashboard, suppress KLOCK-008 with the reason:

{
  // prorm-audit-ignore KLOCK-008: CAPABILITY_E3 is set in the dashboard
  "vars": { "CAPABILITY_ENFORCEMENT": "enforce" }
}

prorm audit klock [path] runs the klock subset of the scan over the project,
then your own klock files (~/.prorm/klock/*.klock and the configured klock,
unless --no-home), then the account probes. It asks the public
/.well-known/klock-configuration whether v2 is offered; a 404 there turns
KLOCK-003 off. A project with a v1 klock left readable, and an API config
without E3:

$ prorm audit klock --offline --no-home
check      severity  where               message
KLOCK-008  medium    api/wrangler.jsonc  This production config sets up klock v2 for the prorm API but does not set CAPABILITY_E3, so the E3 stage (admin step-up and MFA, no new v1 CLI tokens) is off unless it is set elsewhere.
KLOCK-003  medium    ops/.klock          A v1 .klock holds a bearer secret that works from any machine. v2 binds it to a device key: prorm klock upgrade <file> --drop-secret.
KLOCK-007  high      ops/.klock          The .klock is mode 0644: every user on this machine can read it. It must be 0600.
Account checks skipped (--offline).
$ echo $?
6
FlagDoes
--offlineOnly the local checks. The account is not probed and the API is not asked about v2.
--no-homeSkip your own klock files outside the project.
--report-days NKLOCK-006's window (default 30).
--fail-onAs for audit code (default high).

It exits 6 on a finding at or above --fail-on, and 7 when an account probe
could not run.

prorm audit run --account [--report-days N] adds the account probes to an
evidence bundle: evidence/klock-account.json, manifest.klockAccount
({ account, probes }), and findings located at account:<username>.
Without a signed-in CLI it is a usage error.

The klock checklist items

Thirteen items across the five checklists name the klock checks:

ThemeChecksAutomationItems
Credential custodyKLOCK-001, KLOCK-003, KLOCK-007automatedsoc2.cc6-1-klock-credential-custody (CC6.1), iso.a5-17-klock-credential-custody (A.5.17), pci.8-6-3-klock-credential-custody (8.6.3), hipaa.164-312-d-klock-credential-custody (164.312(d)), gdpr.art32-klock-credential-custody (Art. 32(1)(b))
Access policyKLOCK-006, KLOCK-008partialsoc2.cc6-1-klock-access-policy (CC6.1), iso.a8-3-klock-access-policy (A.8.3), pci.7-2-1-klock-access-policy (7.2.1), hipaa.164-312-a-1-klock-access-policy (164.312(a)(1)), gdpr.art32-klock-access-policy (Art. 32(4))
Behaviour monitoringKLOCK-005partialsoc2.cc7-2-klock-behaviour-monitoring (CC7.2), iso.a8-16-klock-behaviour-monitoring (A.8.16), hipaa.164-308-a-1-klock-activity-review (164.308(a)(1)(ii)(D))

Without --account, the behaviour items are not-run, which claims nothing
either way, and the access-policy items rest on KLOCK-008 alone, so they stay
inconclusive.

From code

The same pieces are importable, without the CLI:

import { scanPath, toSarif, runAudit, verifyBundle } from 'ts-prorm-orm/compliance/audit';
import { checklist, itemsForCheck, crosswalk } from 'ts-prorm-orm/compliance/checklists';

const scan = scanPath('src', { rules: ['SQL-001', 'TLS-002'] });
const sarif = toSarif(scan.findings, { toolVersion: '1.0.0' });

A release gate that writes a signed bundle, checks it, and fails on anything
critical, as a script your CI can call:

import fs from 'node:fs';
import { runAudit, verifyBundle, activeFindings, summarize } from 'ts-prorm-orm/compliance/audit';

const run = runAudit({
  path: '.',
  frameworks: ['soc2', 'hipaa'],
  outDir: 'evidence',
  signKeyPem: fs.readFileSync(process.env.EVIDENCE_KEY_FILE ?? '', 'utf8'),
});

const check = verifyBundle(run.dir, {
  publicKeyPem: fs.readFileSync('evidence.pub.pem', 'utf8'),
});
if (!check.ok) throw new Error(check.problems.join('\n'));

console.log(summarize(run.results));
// for the project above: { 'evidence-supports': 9, 'evidence-contradicts': 4, inconclusive: 11,
//   'not-run': 8, attested: 0, 'attestation-missing': 35, … }
const critical = activeFindings(run.findings).filter((f) => f.severity === 'critical');
if (critical.length > 0 || run.incomplete) process.exit(6);

Neither subpath is re-exported from the main entry point, so importing the
ORM does not load them.

Exit codes

CodeWhen
0Nothing at or above --fail-on (default high).
1An error, or audit verify found a problem.
2Usage error.
6An unsuppressed finding at or above --fail-on.
7Nothing failed, but some evidence could not be gathered: a file did not parse, or a probe could not run.

--fail-on none never exits 6.

prorm audit on its own

Before the toolkit, prorm audit showed the account audit log. That is now
prorm audit log (and still prorm security audit). Bare prorm audit keeps
working for one minor release and prints a note pointing to audit log and
audit run.

Next: Evidence bundles.

Modified at 2026-10-04 00:40:16
Previous
Compliance
Next
Checklists by regulation
Built with