Skip to main content
Version: Next

Governance

Your model says what the landscape is. A policy says what your organization permits: "no static secrets", "nobody anonymous across an ecosystem", "user tokens stop at the BFF". Rules like these usually live in a wiki or a review checklist. Written in the model, they sit next to what they are about, and they change with it.

A policy never makes a model invalid. Whether the landscape follows your policies is a separate question from whether the model is well formed: validation checks that each policy makes sense, its clauses' names and values included (KQ074 to KQ078), and that it fits its set's kind (KQ091 to KQ093), and checking your landscape is a pass of its own, after it.

A policy​

policy no-key in architecture "No static secrets" -> deny auth: key

A policy is a filter, an action and the clause the action is about, on one line: policy, a Code, in and the set it goes in, an optional name, when and the filter, ->, then deny or allow only and one clause. Without when, the policy is about everything where it is written, and the arrow follows its name.

A clause is a name, a colon and one or more values joined by or: auth: key, from: backend or integration. A clause matches when any of its values matches. A policy matches a connection, a workload identity or a grant when all its clauses match. A confidence policy also judges any other element you can mark #assumed (element), and a realization, an influence, a value delivery or a references line, an intent policy a channel, a sources policy a data entity, a kind policy a component, a monolith, a permission or a piece of infrastructure, and an env policy any element or workload identity by the stages it runs in. An exposure or in-transit policy judges an API, a broker or a platform service as well as a connection, a run policy a platform service, a waf policy a gateway, and a ddos policy a gateway or a network.

The clause after the action is the one the action is about. The clauses after when, joined by and, narrow down what the policy applies to:

policy no-outside-keys in architecture "No static secrets from outside" when across: ecosystems -> deny auth: key policy token-at-edge in architecture "User tokens stop at the BFF" when auth: user-token -> allow only from: user-facing-app
  • deny reports everything that matches every clause. no-outside-keys reports a connection that authenticates with a key and crosses from one ecosystem into another.
  • allow only lets through only the values it lists. token-at-edge looks at every connection that carries a user's token (auth: user-token), and reports any that does not come from a user-facing app.

A policy states what it allows or denies, never what it doesn't: write -> deny auth: key, not "anything but key". Where you need "has no value", every aspect takes unstated, and the policy is a model policy, about what your model must say:

policy vaulted in model "Secrets state their vault" when credential: secret or certificate -> deny stored-in: unstated

What a clause can name​

Some clauses read what a subject states:

ClauseApplies toValues
authA connection, a leg through a broker, a syncnone, key, certificate, client-credentials, workload-identity, user-token, on-behalf-of, kerberos
protocolA connection, a syncThe protocols, such as http, grpc, ldap. http also matches http/json and http/xml
brokerA leg through a brokerThe broker kinds, such as kafka, azure.service-bus.queues; for a file handoff's leg, its channel's kind, file-share, blob-storage or sftp
credentialA client workload identitysecret, certificate, federated, managed
stored-inA client workload identityunstated
rotateA client workload identityHow often its credential is rotated, a period: a bound, over P90D or under P2D, and unstated
grantA grantapp-role, scope, role for any cloud role, or a cloud role in quotes, "Owner"
confidenceAny subject but a sync and a grantassumed, a subject marked with an #assumed line, or carrying one from its sources; unstated for one that is not
intentA channelWhat its connections carry: event, command or query where all of it is of that one kind, mixed where it is more than one; unstated where they carry nothing stated
publishersA channelHow many components or monoliths publish to it: one, or many where more than one does. A component publishes to a channel when a leg of its into it carries an event, or carries nothing on a topic or a stream; a leg carrying only commands or queries never counts. unstated where none is counted
sourcesA data entityHow many components its syncs come from: one, or many where they come from more than one; unstated where it has no sync
relationshipA bounded contextThe relationships it states, and the partnerships, shared kernels and separate ways stated toward it: conforms-to, customer-of, partnership, shared-kernel, separate-ways
patternA line of the context mapopen-host, published-language and acl where every crossing of it has them, and each relationship stated between its two contexts
no-acl-fromA line of the context mapFor each crossing of it through no anticorruption layer, the kind of the component at its upstream end, custom for a monolith, and big-ball-of-mud where the upstream context is one
pathA line of the context mapHow data travels between its two contexts, either way: call, leg through a channel, sync
functionA task of a business processOnly unstated: a task that names no function
viaA callOnly unstated: a call that names no gateway it goes through
exposureA call, a leg, an API, a broker, a platform serviceinternet or internal, per stage: an API's, a broker's or a platform service's own, a call's its target's, a leg's its channel's
in-transitA call, a leg, an API, a broker, a platform serviceencrypted or plaintext as an API or a broker states it; else encrypted where the endpoint, or the gateway a call goes via, serves a certificate, its transport takes no plaintext, or it is reached with auth certificate
runA platform servicepaas or on: how it runs, as stated or as its product word fixes it
wafA gatewayOnly unstated: a gateway that states no waf
ddosA gateway, a networkOnly unstated: a gateway or a network that states no ddos; the provider's always-on base protection is never stated
stageA connection, a leg through a broker, a syncRead per stage pair, below: same where the pair stays in one stage, crossed where it joins two; unstated where either side is
way-inA data entity, as a holdingHow its data gets there: origin, replica where a sync writes it, action where a task marked data enters it, command where its component handles a command about it, event where another component sends it one; unstated where none of these is stated

Every one of these also takes unstated, which matches a subject that states nothing for it. A connection with no auth, for example, matches auth: unstated and nothing else about auth.

rotate also takes a bound: over P90D matches a rotation strictly longer than 90 days, and under P2D one strictly shorter than two days. Periods are compared by length, not in whole days, so PT47H is under P2D and PT48H is not. Bounds and words join with or, as in rotate: under P1D or over P90D. A credential that states no rotation matches no bound, only rotate: unstated.

Others read where a subject sits:

ClauseValuesMatches
typecall, leg, sync, grant, workload, element, realization, influence, value-delivery, reference, context, context-edge, task, holding, root; and a piece of infrastructure by its keyword, network, host, app-platform, db-server, gateway, broker, dns, certificate, storage-account, vault, registry, ai-platform, backup-vault, security-service, data-centerWhat the subject is: context a bounded context, context-edge a line of the context map, task a task of a business process, holding a data entity judged by how its data gets there, root a root data entity; an infrastructure keyword one of its elements
kindA component kind, custom for a monolith, client, server, app-role, scope, an infrastructure kindA component's or monolith's own kind, a permission's, or a workload identity's; a piece of infrastructure's kind as written and the generic kind its product word maps to, so kind: postgresql reaches azure.postgresql
from, toA component kind, custom for a monolith, idp, vaultThe component or monolith at that end, by its kind or its idp mark; vault a vault a call lands on
acrossecosystems, platforms; networks, internet, devices, trust-boundaries for any of them, unstatedA connection whose two ends are in different ecosystems, or different platforms; a call, a leg or a sync by the trust boundaries it crosses, and unstated where its placement can't be read
withinecosystem, platformA connection whose two ends are in one ecosystem, or one platform
directionin, outFor a policy written below the model: a connection coming into where it is written, or going out
envDEV, TST, ACC, UAT, EPH, PRD, unstatedAn element or a workload identity by the stages it runs in: its own environment lines, or else those of the nearest part holding it that states any; unstated where none does
from-env, to-envDEV, TST, ACC, UAT, EPH, PRD, unstatedA connection, a leg or a sync by each stage pair, below: the stage at its source, and the one it reaches at its target
datacanonical, managedA root data entity by its domain object: canonical where it is marked so, managed where its users manage it
confidentialityYour repository's levels, by default public, internal, confidential, restricted; a bound, over or under a level; unstatedA domain object by the level it states, a data entity, as an element, a holding or a root, by its domain object's; a connection and a leg by the most sensitive domain object their messages are about, a sync by its entity's; unstated on every other element
personal-datanone, personal, special-category, unstatedThe same subjects, read the same way, none below personal below special-category
scopeYour repository's regulated scopesA subject in a regulated scope: a data entity holding or copying its data, a connection, leg or sync carrying it, a channel or broker it passes through, and the storages, components, monoliths and what they run on; no unstated, and a subject in none matches nothing
connected-toYour repository's regulated scopesAn element outside a scope with a connection, sync or leg to or from one in it, or a gateway a call into it goes through: one hop, no further
subdomaincore, supporting, genericA bounded context by its subdomain type: its domain's, or that of the one domain its components are filed in
upstream, downstreamcore, supporting, generic, big-ball-of-mud, unmappedA line of the context map by the context at that end
crossingcall, leg, copyA line of the context map by what it comes from: a call, in-process included, a message through a channel, a copy of the other's data
statusproposed, planned, building, pilot, active, phasing-out, retired, unstatedAn element by the status it states; unstated where it states none, every element that carries none included
futureinvest, maintain, migrate, replace, retire, unstatedAn element by the future it states; unstated where it is undecided, and on every element that carries none
end-of-mainstream-support, end-of-extended-support, contract-endA bound, over or under a period, and unstatedA run element by the vendor date it states, below
locationA region, such as azure.westeurope, data-center, unstatedAn element by where it runs, worked out: a piece of infrastructure's own location, else its network's, else that of what it runs on; a part's, those of what it runs on; a storage's, its servers'; data-center one in a data center
countryA country, two capitals such as NL, a residency your repository declares, such as eea, unstatedAn element by the country it runs in: its region's, its data center's, or a saas component's own; a holding by the countries it is held in; a residency matches any of its countries
from-country, to-countryA country, a residency your repository declares, unstatedA connection, a leg, a sync or a holding by each country pair, below: the countries data leaves from, and those it reaches
leavesA country, a residency your repository declares, unstatedThe same, by each residency or country a pair leaves: one of its countries is on the source side and a country outside it on the target side
transferadequacy, scc, bcr, code-of-conduct, certification, ad-hoc-clauses, public-instrument, unstatedThe same, by a pair's grounds: those the contracts covering the receiving element and what it runs on state, and adequacy where every country it reaches outside each regime it leaves is on that regime's adequate list
cloudazure, aws, gcp, unstatedAn element by its product word's or its region's provider; a part's, that of what it runs on
zoneszonal, zone-redundant, unstatedA host or a platform service by its zones: zonal in one, zone-redundant in several or spread by its provider

type also takes installation, and kind an installation's kind, os, runtime, sdk, web-server or middleware. A component, a host, an installation and a platform service state their life cycle; a domain, an API or a network never does, so it matches status: unstated. Filter with status or type to judge only the run elements.

A vendor date takes a bound counted forward from the day the model is judged on, by the calendar: judged on 2026-10-20, end-of-extended-support: under P6M matches a date before 2027-04-20, and contract-end: over P2Y one after 2028-10-20. A date already past is under any period, so the policy keeps reporting once support has ended. A bound takes whole days or more, never hours. An element that states no date matches no bound, only unstated. The day is the run's, the one --as-of gives, or a later plateau's own date, so a policy hears of an end of support months ahead, and a build that passed can fail the next day with no edit to the model:

policy stated-future in model "An active element states its future" when status: active -> deny future: unstated policy supported-os in architecture "No operating system within six months of its end of support" when type: installation and kind: os and env: PRD -> deny end-of-extended-support: under P6M

confidentiality takes a level as a bound, strictly beyond it in your repository's order, least sensitive first: with the default levels, over internal matches confidential and restricted. A subject that states no level matches no bound, only unstated. Stating a classification never makes a no-policy finding:

policy no-sensitive-to-saas in architecture "Nothing confidential or above reaches a SaaS" when confidentiality: confidential or over confidential -> deny to: saas policy special-category-authenticated in architecture "Special-category data never moves anonymously" when personal-data: special-category -> deny auth: none

exposure and in-transit are computed from each plateau's model when a policy asks. exposure is never written; in-transit is stated on an API or a broker where you know it (Interface), and what is stated is read first. An endpoint is internet where it, or a gateway that publishes it, is marked public, is paas with no in, or is in no network while its ecosystem declares networks; internal where it and every gateway publishing it are in a network. Plaintext is never read from absence: an endpoint that states nothing and that nothing proves encrypted is unstated, and so is either aspect where the model says too little, such as an ecosystem with no network. A call through a gateway to an API stated plaintext is plaintext: the gateway ends the encryption, and the hop behind it is plain.

policy gateway-at-edge in model "Internet-facing APIs sit behind a gateway" when exposure: internet and type: call -> deny via: unstated policy encrypted-from-internet in architecture "Nothing internet-facing takes plaintext" when exposure: internet -> deny in-transit: plaintext

A connection runs in no stage of its own, so from-env, to-env and stage read it one stage pair at a time, one for each stage its source runs in: that stage at both ends where the target runs there too; else the target's stage, where it runs in only one; else unstated, never a guess. A source that states no stage gives one pair, from unstated. An API reads its component's stages, a component its own or else its module's or monolith's, a channel its broker's, and a user interface only its own. A connection from a component in DEV and PRD to one in PRD alone has two pairs, DEV to PRD, crossed, and PRD to PRD, the same. It breaches a policy once, its finding naming every pair that did, and one exemption lifts them all:

policy prd-no-secrets in architecture "No client secret in production" when env: PRD -> deny credential: secret policy no-nonprod-into-prd in architecture "Nothing outside production calls into it" when from-env: DEV or TST or ACC or UAT or EPH -> deny to-env: PRD

Where personal data moves is read one country pair at a time, from-country, to-country, leaves and transfer together. A country pair is one hop of a connection in one stage pair, from the countries of its source to those of its target: a call through a gateway has two hops, and so does a sync through a channel. An event or a command moves data forward; a query, or a call carrying no message, is read both ways, since its reply comes back. A holding has its own pair in each stage, from its component to where it's held, so a database in another country moves data with no connection drawn. A side whose place can't be read is unstated, never a pass, and a breach names every country pair that breached:

policy eu-only in architecture "Personal data stays in the EEA" when personal-data: personal or special-category -> deny leaves: eea policy grounded in model "A transfer states its ground" when personal-data: personal or special-category and leaves: eea -> deny transfer: unstated

A bounded context and a line of the context map are read from each plateau's model, never written. A finding about either is shown on the element marked bounded-context, a line's on its downstream context, and an exemption names that element.

A clause can also name a property your repository declares, as # and its name, the way its # line writes it: #owner, #sla-tier. Its values are those of the property's type: an enum's values, yes or no for a boolean, a text in quotes for a text, matched exactly as written, and a bound for a number, a duration or a date. A number bound has no unit, over 500, since the declaration's unit is the one compared; a duration compares by length, as rotate does, and a date counts forward from the day the model is judged on, as a vendor date does. Every type also takes unstated, the only value a url, a page or a ref takes, so those are tested by whether they are written. A list property matches when any of its values does.

A property clause judges every subject a policy reaches. A subject whose type cannot carry the property, because the declaration's on leaves its type out or because it is a leg, a sync, a grant or a workload identity, states none and matches only unstated. So name the types a policy is about in its filter:

policy owned in model "Every backend has an owner" when type: element and kind: backend -> deny #owner: unstated policy large-saas-gold in architecture "A SaaS with over 500 seats is on the gold tier" when kind: saas and #seats: over 500 -> allow only #sla-tier: gold

Kanoniq compares what a subject states with the values a clause lists and nothing more: a policy is the only place it reads a property, and the property still means what your repository says it means.

Clause names and values are not reserved words, so none of them takes a Code away from you.

Trust boundaries​

A trust boundary is where data passes between parts that don't trust each other to the same degree. Kanoniq reads it from where your model places things, never written: there is no boundary to declare. A network is the finest segment it reads. A call, a leg through a broker or a sync crosses one of four edges, each named by its word for across:

EdgeacrossCrossed where
An ecosystem'secosystemsThe two ends are in different ecosystems
The internet'sinternetOne end is in a network and the other on the internet, or the target is reached from outside its network because it is exposed to the internet
The user's devicedevicesThe source is a user interface, a client on a device host included
A network'snetworksBoth ends are in networks, and not the same one, linked or not

trust-boundaries matches any of the four. A platform is not a trust boundary: it is containment, and platforms keeps its own meaning.

  • An end is placed by its environment line in the stage: the host or platform service it runs on, in a network or run paas. A broker and a platform service are placed by their own in. An end placed in no network while its ecosystem declares networks is on the internet: a paas service or a host with no in, a SaaS in another ecosystem, a user interface.
  • Where an end's placement isn't stated, nothing is read from what your model leaves out: no internet or network crossing, and the connection matches across: unstated instead. The ecosystem and device edges never depend on placement.
  • A crossing is read per stage pair, as stage is, since a part may run in different networks in each stage. A breach names its pairs where some pairs breach and others don't.
  • A call via a gateway is read hop by hop, the caller to the gateway, then the gateway to the target. A leg's ends are its component and its channel's broker; a sync through a broker is read through its two legs, and one over a protocol as a call.
policy encrypted-crossing in architecture "Nothing crosses a trust boundary in plaintext" when across: trust-boundaries -> deny in-transit: plaintext policy placed in model "A flow's crossings can be read" -> deny across: unstated

Select a line in the viewer and its information pane lists what it crosses under Crosses, per stage pair where they differ. The boundaries switch marks each line that crosses one; see Whole model.

Where a policy is written​

Where you write a policy is what it covers:

  • At the top of a file, it is the model's and covers everything.
  • In an ecosystem, a platform, a monolith or a component, it covers what is inside, and every connection with either end inside. A policy on a component covers its own workload identities and every connection into or out of it; add direction: in to cover only its callers.
ecosystem shop "Shop" { platform payments "Payments" { component ledger "Ledger" : backend { policy certificates-only in architecture "Callers present a certificate" when direction: in -> allow only auth: certificate } } }

An extend block or a scoped file counts as the element it reopens. A connection between two ecosystems answers to the policies of both sides.

A policy written lower down can only add to what a higher one already says. To loosen a rule for one place, write an exemption instead.

Constants​

A constant names a value, so a figure your policies and your model use is said once: const, a name, = and the value, one per line, wherever you may write a policy.

ecosystem shop "Shop" { const MAX_SECRET_ROTATION = P90D policy secret-rotation in architecture "Secrets rotate at least every 90 days" when credential: secret -> deny rotate: over MAX_SECRET_ROTATION }

A policy may always write the value instead: rotate: over P90D and rotate: over MAX_SECRET_ROTATION say the same.

A name is capitals, digits and underscores, starting with a capital: MAX_SECRET_ROTATION, LIMIT. It is never a stage, such as PRD, and never shaped as a period, such as P90D (KQ274).

Its value is one of four types, read from how you write it:

TypeWritten asExample
PeriodA period, unquotedP18M, PT4H
NumberA whole number3
TextText in quotes"Storage Blob Data Reader"
Booleantrue or falsetrue

"P18M", in quotes, is text, not a period. Any other word is a build error (KB083).

Where you write it is what sees it, as for a policy. At the top of a file, a constant is the model's and seen everywhere. In an ecosystem, a platform, a monolith or a component, or an extend block or a scoped file of one, it is seen there and in everything inside it, and a use anywhere else is KQ271. A use is resolved where it is written, never where the subject a policy judges sits, so MAX_SECRET_ROTATION above serves the policies of shop and nothing outside it.

A name is defined once in the whole model (KQ273): never again at another level, so an ecosystem that wants another figure gives it another name. The same name twice in one place is KB005, and a name no constant has is KB082.

A name is taken wherever a value of its type is:

  • A period in a policy's bound, a credential's or a certificate's rotate, and a schedule's every.
  • A number in a bound on a number property.
  • A text as a quoted clause value, such as a cloud role on grant.
  • Any type as the value of an open property of that type.

In a workload identity:

credential secret stored-in secrets rotate MAX_SECRET_ROTATION

A constant of a type its place doesn't take is KQ272: a number in a rotate, a period in a text property. An every constant in years or months is KB011, as it is when written directly.

Your model holds the value at each use, beside the constant it came from, and Kanoniq writes the name back where you wrote it. A constant keeps its Id when you rename it, as any element does, and kq arrange writes it in the policies.kq beside its placement's policies.

A constant can change from one plateau to the next: restate it in that plateau's block, const MAX_SECRET_ROTATION = P30D inside ecosystem shop { … }, and it keeps its Id; -const MAX_SECRET_ROTATION there removes it. Each plateau gives every use the constant's value there, so a policy or a rotate you wrote once follows it with no change of its own. A use in a plateau its constant isn't in is KQ406.

A worked example​

Say your organization wants every secret in production rotated at least once a month. One constant and one policy say it:

const MAX_PRD_ROTATION = P30D policy prd-rotation in architecture "Production secrets rotate at least monthly" when env: PRD and credential: secret -> deny rotate: over MAX_PRD_ROTATION

From the left:

  1. policy prd-rotation in architecture names the policy and puts it in the default set of architecture policies. Its full name is default-architecture/prd-rotation.
  2. "Production secrets rotate at least monthly" is its name.
  3. when env: PRD and credential: secret is the filter. A subject must match both clauses: a client workload identity that runs in production, by its own environment lines, and keeps a secret.
  4. -> deny rotate: over MAX_PRD_ROTATION is the action and the clause it tests. MAX_PRD_ROTATION stands for P30D, so the policy reports every subject passing the filter whose credential rotates strictly longer than 30 days.

Judged against this model:

ecosystem shop "Shop" { environments DEV, PRD vault secrets "Secrets" : azure.key-vault environment PRD x1 platform iam "Identity" { component platform-idp "Identity" : saas idp technology "Entra ID" } platform apps "Apps" { component orders "Orders" : backend { workload orders-app "Orders" : client in iam/platform-idp { environment PRD credential secret stored-in secrets rotate P90D } } component billing "Billing" : backend { workload billing-app "Billing" : client in iam/platform-idp { environment PRD credential secret stored-in secrets rotate MAX_PRD_ROTATION } } component reports "Reports" : backend { workload reports-app "Reports" : client in iam/platform-idp { environment DEV credential secret stored-in secrets rotate P90D } } orders -> secrets over http billing -> secrets over http reports -> secrets over http } }
  • orders-app breaches the policy: it runs in production, keeps a secret, and rotates it every 90 days, over the bound.
  • billing-app passes. Its rotate MAX_PRD_ROTATION is the same constant the policy bounds, P30D, and a bound is strict, so exactly 30 days is not over it.
  • reports-app is never judged: it runs in DEV, so the filter leaves it out.

A secret that states no rotation matches no bound, only rotate: unstated, so this policy passes it. The strict model baseline asks every secret to state its rotation; take it beside this policy. Run kq validate to see the finding.

Policy sets​

policy-set architecture security "Security" { policy no-key -> deny auth: key policy no-anonymous when across: ecosystems -> deny auth: none }

A policy set groups policies under one Code. A set is the model's when it is written at the top of a file, and otherwise its ecosystem's: two policy-set architecture security { … } blocks in two platforms of one ecosystem are the same set. Give a set its name in one place only (KB049).

Every set is one of two kinds, written right after policy-set, and every occurrence of a set states the same one (KB046):

  • model: what your model must state. Each policy denies something left unstated, such as -> deny auth: unstated. A finding means the model is silent where your organization wants it to speak; the system itself may be fine.
  • architecture: what your systems may do. No policy mentions unstated. A finding means the model states something your organization does not permit.

A policy outside every set says where it goes with in: in model or in architecture puts it in that kind's default set, default-model or default-architecture, and in security puts it in the set coded security, of the model or of its own ecosystem (KB048). A policy inside a set takes the set's kind and writes no in (KB047). default-model, default-architecture, baseline-recommended and baseline-strict are reserved set Codes.

Every policy has a full name: <set>/<policy>, such as security/no-key or default-architecture/no-key, and from another ecosystem <ecosystem>/<set>/<policy>.

Exemptions​

An exemption lifts one policy from one subject, with your reason, and optionally until a date:

ecosystem shop { platform legacy { exempt security/no-key because "AD bind until the 2027 migration" until 2027-06-30 } exempt security/no-key for commerce/orders -> commerce/stripe/api because "Stripe offers only API keys" }
  • Without for, it lifts the policy from the element whose block holds it, and from everything that policy would cover there.
  • for names the subject: an element by its path, a root data entity included, a connection as <source> -> <target>, a sync as <entity> from <source>, its copy and the component it syncs from as the sync writes it, or a grant as <client> grant <role>.
  • Past until, the exemption no longer applies. until is the last day it lifts its breach, judged against the run's date and against each plateau's own: a plateau dated past it reports the breach, and so does every plateau once the run's date is past it, the finding naming the plateau and the date that passed until.
  • In a plateau that removes the element an exemption is written in, or the subject it names, the exemption goes with it.
  • Only the side that owns a policy can lift it: in an ecosystem, you can exempt the model's policies and that ecosystem's own.
  • A baseline's policy is named <baseline>/<policy>, such as baseline-architecture-recommended/no-key-crossing, while preset names that baseline in the settings. The exemption stays the same after kq materialize.
  • threats-stated and threats-stride are reserved for the threat-modeling package, which is planned. An exemption of one of their policies is kept as written: it lifts nothing and nothing reports it, so your model builds the same with the package or without it.

A policy is lifted at most once per subject.

The baselines​

Kanoniq ships four ready-made policy sets, a recommended one and a strict one of each kind. They hold only what the rest of validation does not already check, and each strict one holds its recommended one's policies.

baseline-model-recommended asks your model to say how secrets are kept and how its edges authenticate:

policy-set model baseline-model-recommended { policy vaulted when credential: secret or certificate -> deny stored-in: unstated policy stated-saas-auth when to: saas -> deny auth: unstated policy stated-webhook-auth when from: saas -> deny auth: unstated policy stated-vault-auth when to: vault -> deny auth: unstated policy stated-edge-auth when from: user-facing-app -> deny auth: unstated policy replica-has-a-path when crossing: copy -> deny path: unstated policy task-names-function -> deny function: unstated policy holding-has-a-way-in -> deny way-in: unstated }

replica-has-a-path asks that a copy of another bounded context's data come with a call, a message or a sync between the two contexts, so the model says how it travels. task-names-function asks every task of a business process to name the function it performs with via, so its systems, data and people can be read; the language itself accepts a task sketched before its functions are cut. holding-has-a-way-in asks that the model say how every data entity's data gets there: it is an origin, a copy a sync writes, entered by a task marked data, or reached by a command its component handles or an event another component sends it. Being authoritative is not a way in.

baseline-model-strict adds that every connection across a platform, every sync and every leg through a broker states its scheme, and so does every call to an identity provider, a backend, an integration, bought software or a monolith; that a client workload identity states its credential; and that a secret or certificate states its rotation. It adds stated-relationship, -> deny pattern: unstated: every line of the context map reads a pattern at one of its ends or a relationship between its contexts. And it adds stated-target-stage, -> deny stage: unstated: every connection reaches a stage the model states, in each of its stage pairs. With stated-future, when status: active -> deny future: unstated, an active component, host, installation or platform service states what is intended for it. With stated-crossing-transit, when across: ecosystems -> deny in-transit: unstated, every connection across an ecosystem reaches an endpoint whose encryption in transit the model states or proves.

baseline-architecture-recommended says what your systems may do: nobody anonymous across an ecosystem or a network, and no static secret across an ecosystem; nothing crosses a trust boundary in plaintext (encrypted-crossing), and nothing internet-facing takes plaintext (encrypted-from-internet); a user's token stops at its BFF and never goes on a broker; nobody calls a SaaS, a backend or an integration anonymously, nor in from a SaaS; a vault is reached with an identity; nobody syncs or uses a broker anonymously; a channel carries one kind of message, events or commands or queries, not a mix (one-intent-per-channel); a topic has one publisher, though the language allows several (one-publisher-per-topic); and a replica is fed by one component, any data another adds kept in an entity of its own (one-source-per-replica). From domain-driven design's advice on the context map: a core context does not conform to another's model (core-not-conformist), and a core context takes nothing from bought software (acl-to-vendor), nor any context from a Big Ball of Mud (acl-to-mud), except through an anticorruption layer. A connection stays in one stage (one-stage, -> deny stage: crossed): a test system calling into production is reported, and where your organization allows a crossing, an exemption says why.

baseline-architecture-strict holds those, the two crossing rules widened from ecosystems to platforms, and adds that no client uses a secret; that SNMP, a directory bind, a file share and a cloud role stay inside their ecosystem; per protocol and broker kind, which schemes it accepts, never none and never key where a token scheme is available; and that a secret rotates at least every 90 days (secret-rotation, -> deny rotate: over P90D) and a certificate at least yearly (certificate-rotation, -> deny rotate: over P365D).

Where an architecture policy only looks at a stated scheme, a call that states none passes it. Its model counterpart catches that call: authenticated-saas and stated-saas-auth go together, so take a model preset beside an architecture one.

To check one, name it under its kind in preset in your settings. To change one, write it out with kq materialize.

Controls and regulated scopes​

A policy says which framework requirements it serves, with serves after its name and before when. A policy set may say it too, after its name, and every policy in the set then serves those as well as its own:

policy-set architecture transport "Transport security" serves iso-27001-2022/A.8.24, soc2-2017/CC6.7 { policy encrypted-in-pci "Encrypted in the PCI scope" serves pci-dss-4/4.2.1 when scope: pci -> deny in-transit: plaintext policy encrypted-crossing "Encrypted across an ecosystem" serves nis2/21.2.h when across: ecosystems -> deny in-transit: plaintext }

A policy that serves a requirement is what a framework calls a control. A requirement is <framework>/<id>, the id as the framework numbers it. Kanoniq ships five frameworks, each word naming one version, so a new version is a new word:

FrameworkIts wordIds
ISO/IEC 27001:2022, Annex Aiso-27001-2022A.5.1 to A.8.34
PCI DSS v4.0.1pci-dss-41.1.1 to 12.10.7
SOC 2 Trust Services Criteria (2017)soc2-2017CC1.1 to CC9.2, then the availability, confidentiality, processing integrity and privacy criteria, such as C1.2
NIS2, Art. 21(2)nis221.2.a to 21.2.j
DORA, Art. 5 to 14doraArticle, paragraph and point, joined by dots: 9.4.d

Kanoniq holds the ids only, never a requirement's text. For a standard of your own, declare its word and its ids under frameworks in kanoniq.repository.json, "acme-sec": ["NET-01", "NET-02"]. A framework or id neither has is KB087, and a set's requirements are stated on one of its occurrences, KB088. A requirement listed twice is KQ296; one a policy repeats from its set is KP009. An exemption states none, since the policy it names does.

serves changes nothing about how a policy is checked: a breach is reported in its set, at its set's severity, as any breach is. In SARIF, each breach and its policy's rule carry the requirements under properties, so a tool importing the log reads which requirement a finding is evidence for. Kanoniq never says a requirement is met: a requirement whose policies all pass passes what the model checks, and what the model can't check, and whether a requirement applies, stay in your GRC tool. Every baseline policy serves its requirements: encrypted-from-internet serves pci-dss-4/4.2.1 among others, and kq materialize writes them out.

To follow a framework, set it to true under frameworks: "frameworks": { "iso-27001-2022": true }. KQ132 then lists each of its requirements the model can check that no policy you check serves, the baselines included. A framework you don't follow is never reported.

A domain object may be regulated, regulated and the scopes after personal-data, each a word of the repository's regulated-scopes setting, which lists none by default:

object card "Card" : cards confidentiality restricted personal-data personal regulated pci object order "Order" : sales personal-data personal component checkout "Checkout" : backend { sql orders-db "Orders" { root card authoritative origin root order authoritative origin property "PAN" personal regulated pci } }

A significant property ends in regulated too, for a holding in a scope through what it keeps: the checkout's orders keep the card number. A scope your settings don't list is KQ297. What is in a scope is read from the model, never stated: its holdings, every data entity of a regulated object and every one with a regulated property; their copies, sync after sync; what carries the data, each connection, leg and sync with a regulated object and each channel and broker on the way; and the storages, the components and monoliths holding or carrying it, and what they run on. Everything one connection, sync or leg away from those, and a gateway a call into them goes through, is connected to it, one hop and no further. Network placement segments it: whatever shares a network with the scope is in it, whatever sits in a network linked to that one is connected, and a spoke reached only through a hub holding a firewall is out of it. Where nothing states its network, the reading is the worst case. Select a regulated domain object in the viewer and its information pane lists each scope's holdings, copies, carriers, what is in it and what is connected, then its networks, the networks linked to them, the spokes filtered off and what is unsegmented, placed nowhere.

A policy selects a scope with scope, and what is connected with connected-to, as encrypted-in-pci above does. Both take your scopes and neither takes unstated: a subject in no scope matches neither.

Checking your landscape​

kq validate and kq build check the model against its policies once it has no error, and list each finding after the model's own, under policy findings:. A model with an error is not checked: fix it first. A finding at error makes the command exit with 1, kq build after writing its files. --strict is about the model's own lints and never makes a policy finding fail. Policies are judged as of today; --as-of 2027-07-01 judges them as of another day, so you can see what an exemption's until will bring back. See kq validate, with its output for CI.

The other places you see findings:

  • In VS Code, the Problems panel lists them as you type, apart from the model's own, under the source kanoniq policy. A breach links to the policy it breaks; no-policy and the checks below link to this page.
  • kq portal:build prints them after the model's findings. None of them stops the site, whatever its severity.

Settings​

How strictly your policies are checked is the policies setting in kanoniq.repository.json. Leave it out, and every policy set you write is checked, with no baseline:

{
"policies": {
"preset": { "model": "baseline-model-recommended", "architecture": "baseline-architecture-recommended" },
"policy-sets": { "security": "error", "shop/legacy": "warn" },
"no-policy": "info",
"exemptions": "info",
"hygiene": "warn"
}
}
SettingWhat it setsLeft out
enabledfalse checks no policy at all. Validation still checks that each one makes sense, and kq audit still runstrue
presetThe baselines checked as if they were written in the model, at most one of each kind: model names baseline-model-recommended or baseline-model-strict, architecture names baseline-architecture-recommended or baseline-architecture-strictNone
policy-setsThe severity of each set's breaches, by its Code, or <ecosystem>/<code> for an ecosystem's. A baseline's Code and the default sets' counterror
no-policyThe severity of no-policyinfo
exemptionsThe severity of a breach an exemption lifts, still listed with its reasoninfo
hygieneThe severity of the checks on your policies, KP001 to KP009warn
hygiene-checksA severity of its own for a check on your policies, by its code, over hygiene: { "KP001": "info" } reports KP001 at info, and none not at all. A check it doesn't name takes hygieneNone

A severity is none, info, warn or error. A set at none is not checked at all.

Before you turn them on​

kq audit checks every set and lists every finding as info, whatever the settings say, those at none and "enabled": false included. It writes nothing. Run it to see what your policies would report, and kq audit --enforce to fail on anything that breaks them.

Changing a baseline​

kq materialize writes every baseline preset names into model/policies.kq as a policy set of your own, of the baseline's kind, and removes preset from the settings. Each policy keeps its Id, so its findings and exemptions stay the same. From then on it is yours to change.

Findings​

Kanoniq names each finding about your policies: a breach by its policy, <set>/<policy>, and the rest by the ids below. The checks on your policies themselves, KP001 upward, never run across two sets, since two sets have two owners.

no-policy — nothing speaks to it​

A call, a leg, a sync, a grant or a workload identity states a value, such as an auth scheme or a credential, and no architecture policy you check reaches it: no deny matches it and no allow governs it. A model policy never counts, since it only asks for what is left unstated. It is a gap in your rules rather than a breach. A connection that states nothing is never reported. A property it states never counts: only the values above do. Nor does a function, via, stored-in, waf or ddos it states, which no policy can name except by its absence. Write a policy that covers it, or leave it: it is reported at info unless your settings say otherwise.

KP001 — unused​

A policy that, in no plateau, reaches anything its selecting clauses match, of a type its tested clause applies to. A tested property clause that lists no unstated applies only to a type that can carry the property. Its placement or its selectors are narrower than you meant, or the landscape has nothing it is about yet.

KP002 — shadowed​

An allow lists a value that can never pass: a deny of the same aspect, covering it, denies that value, or an allow at an enclosing level, covering it, does not list it. On rotate, a bound is such a value when every period it takes is denied, or when it shares no period with the enclosing allow: allow only rotate: over P90D below an enclosing allow only rotate: under P30D. Remove the value, or change the policy that hides it.

KP003 — redundant​

A policy another one already does: a deny covered by another deny, an allow covered by an allow at its level about the same aspect, or the second of two policies that repeat each other. On rotate, a deny of over P90D is covered by one of over P30D, since every period over P90D is over P30D. Remove it.

KP004 — contradicting​

Two policies of one set that cannot both hold: an allow and a deny about the same aspect, at nested placements, that can judge the same kind of subject, sharing a value; or two allow lists at two nested levels sharing no value, so nothing they govern can pass. On rotate, two bounds share a value when the periods they take overlap: allow only rotate: under P30D and deny rotate: over P10D share every period between. Decide which one stands.

KP005 — too broad​

A clause lists every value its aspect or selector can take, unstated aside: a deny of everything, or an allow that lets everything through. On rotate, bounds that together take every period are too broad, as under P1D or over PT1H are. Narrow it, or drop the clause.

KP006 — exemption unused​

An exemption that lifts no breach in any plateau: what it exempts already complies. Remove it.

KP007 — exemption expired​

An exemption past its until, judged against the day of the run. The breach it lifted is reported again. Fix the breach, or extend the date with a reason.

KP008 — exemption out of reach​

An exemption whose policy, in no plateau, can reach the subject it names, so it can never lift anything. Name the right policy or the right subject.

KP009 — serves redundant​

A policy states a requirement in its serves that its policy set already states, so it serves the requirement twice over: through its set and on its own line. Remove it from the policy.

Formatting​

A policy stays on one line however long it gets. In a block, policies come first: each set under its policy-set <kind> line, then each policy written outside a set on its own line, with its in, then the exemptions.

kq arrange gathers them in one place: the model's policies in model/policies.kq, and each ecosystem's in <ecosystem>/policies.kq, with the policies written on a platform or a component in an extend <path> { … } block by path, and that ecosystem's exemptions last.

Reference​

The element types, relationships and kinds of this area, each with what it means.

Element types

Element typeWhat it is
Policy SetA Policy Set groups Policies of one kind, which are judged together and reported under the set's Code. A Policy Set belongs to the model or to one Ecosystem.
PolicyA Policy is an organization's architecture rule: a filter and an action, allow or deny. Where it is written is what it reaches; its findings are conformance, never validity.
ConstantA Constant names a value, such as a rotation period, so the policies that use it say it once. Where it is written is what sees it.

Relationships

RelationshipWhat it says
ExemptionAn Exemption lifts one Policy from one subject, with the reason. A breach it lifts is still reported, as exempted; past its last day it lifts nothing.

© 2026 Extenza Works. All rights reserved.