The format of a signed decision, version 1
https://rego4k.dev/decision/v1 is the predicate type of a decision that
rego4k-signing-signer signs. This page describes the format of version 1.
Verification:
rego4k-signing-verifierverifies it in a JVM.- cosign, the signing tool of the Sigstore project,
verifies it with
cosign verify-blob-attestation.
Signed decisions explains why rego4k signs decisions.
A signed decision
A signed decision is a DSSE envelope that holds an in-toto Statement v1. DSSE is a simple envelope format for signatures. in-toto is a format for software attestations.
The subject of the statement is the input. The predicate is the decision:
{
"_type": "https://in-toto.io/Statement/v1",
"subject": [{"name": "input", "digest": {"sha256": "5e8f..."}}],
"predicateType": "https://rego4k.dev/decision/v1",
"predicate": {
"entrypoint": "authz/allow",
"output": true,
"timestamp": "2026-12-01T10:00:00.123456789Z",
"provided": {"time": "2026-12-01T10:00:00.123456789Z", "zoneData": "2026e"},
"policy": {"sha256": "9a1c...", "bundle": "billing"},
"data": {"sha256": "4413..."},
"principal": {"issuer": "https://login.example.com", "subject": "billing"},
"rego4kVersion": "0.1.0-SNAPSHOT",
"calledImpureBuiltin": false
}
}StatementTest.kt, lines 16 to 31, on GitHubentrypointorquery: the query. The output of an entrypoint is the value of the rule. An undefined value has no keyoutput. The output of a query is an array with the bindings of each solution, as in the result ofopa eval.timestamp: the time of the query, from theInstantSourceof theRego. The verifier checks the certificate chain at this time.provided: the provided values that the query read, with a key for each value:time(the time of the query, for example fortime.now_ns),zoneData(the version of the time zone data of the JVM),localZone(the zone of"Local") andruntime(the value ofopa.runtime). A query that read none has an empty object.Decision.providedgives them, anddecision.reproduceofrego4k-signing-signergives them to the query again. See The signature covers the provided values.policy:Bundle.hashwith the revision of the manifest (RevisionHashTreatment.INCLUDED), andbundle, the name of the bundle, if the signer names one (Decision.bundle). A server that hosts more than one bundle names it.input(the subject) anddata: the SHA-256 of the canonical JSON form that bundle signing hashes for a structured file (CanonicalJson). Thus a change to the whitespace or the key order of a JSON document does not change the digest.principal: the security principal of the system that sent the input, if the signer names one. See The principal.rego4kVersion: the version of rego4k. A fix in rego4k can change an output.calledImpureBuiltin: true if the query called an impure builtin (see A builtin is pure, provided or impure). Nobody can reproduce such an output.
The signature covers the provided values
The signer sets the provided values, so the caller does not know them before the query. Thus the decision must prove them, as it proves the output.
provided is in the predicate, and the predicate is in the payload. The DSSE signature covers all the bytes of
the payload and its type (the PAE).
Thus a changed time, zoneData, localZone or runtime, and a removed or an added key, make the verification
fail. DecisionTest in rego4k-signing-signer changes and removes each key, and the verification fails each time.
We do not add a digest of the provided values to the subject or to the predicate. We decided this for these reasons:
- A digest adds a proof only for a verifier that checks the digest without the payload. No verifier does this. A verifier must read the payload to get the provided values, and the signature already covers the payload.
- The subject is the artifact that the decision is about: the input. cosign compares the digest of a subject with a file that the caller has. The caller has no file of the provided values. It gets them from the decision.
policyanddataare digests because the bundle and the data are large, and can be secret. The provided values are small, and a verifier needs their values, not a digest, to reproduce the decision.
The version of the predicate
The predicate type ends with the version of the format: https://rego4k.dev/decision/v1.
A change that a verifier of the old version cannot read, for example a new required field, gets a new version. A
verifier rejects a statement of
another version, with the message the predicate type is not https://rego4k.dev/decision/v<n>.
An optional field can come without a new version, as the name of the bundle in policy did. A verifier that does not
know it ignores it. The signature covers it, as it covers all the statement.
The principal
A decision can name the security principal of the system that sent the input: {"issuer": ..., "subject": ...}.
The signer gets it from the authentication of the request.
The signer does not authenticate the caller itself. Thus a verifier trusts the signer for the principal, as it trusts the signer for the output.
The principal is an issuer and a subject, not one string. A subject has a meaning only for the issuer that
authenticated it. Two identity providers can each have a user alice, and a verifier must not take one for the other.
Each common form of authentication has the two parts:
- a JWT or an OIDC token: the claims
issandsub; - a TLS client certificate: the issuer and the subject of the certificate;
- SPIFFE, a standard for the identity of workloads: the trust domain and the SPIFFE ID.
A verifier compares both parts, for example decision.principal == Principal("https://login.example.com", "billing").
A changed principal changes the signed bytes, so the signature does not verify.
The trust of a verifier
A verifier trusts the certificates of authorities, or keys by key ID.
Trust.Authorities: the PEM certificates of one or more authorities, roots or intermediates, and the algorithm of
the signatures. The verifier needs only the certificate of the authority, not the key of each signer.
Each signature of the envelope holds the certificate chain of its key in the field x5c. The verifier does these
steps:
- It examines the leaf certificate (the first of the chain). Its key usage, if it has one, must have
digitalSignature. Its extended key usage, if it has one, must havecodeSigning, as cosign requires. Thus a certificate of a TLS server cannot sign a decision. - The JDK builds a certification path (PKIX, RFC 5280) from the leaf to a trusted authority, with the certificates of the chain. The time of validity is the timestamp of the decision: each certificate of the path must be valid at that time. Each authority in the path must be a CA that can sign certificates. The verifier does not examine revocation.
- The public key of the leaf, with the algorithm, verifies the signature.
The timestamp is a fact that the signer signs. Thus a verifier trusts the signer for the time:
- A leaf that expired still verifies a decision with an earlier timestamp.
- A key that leaked can sign a decision with an earlier timestamp.
To prove the time, a third party must record it, for example a timestamp authority or the Rekor log of Sigstore. Rekor is the public log of signatures of Sigstore. rego4k does not do this.
An HS* algorithm cannot be the algorithm of an authority, because a certificate holds a public key, not a secret.
Trust.Keys: the keys by key ID. The envelope names the key with its keyid. The verifier finds the key by this
ID.
The key can be a PEM public key, a certificate or a private key, or the secret of an HS* algorithm. The verifier
does not examine a certificate chain.
The certificate chain in the envelope
DSSE has no field for a certificate, and the in-toto Statement is about the subject, not about the signer. We compared these places for the chain:
- A field of the signature. The JWS header
x5c(RFC 7515) holds the chain of the key that signed: the DER form of each certificate in standard base64, the certificate of the key first. A DSSE signature with the same fieldx5ckeeps the chain next to the signature that it is for. DSSE tools ignore a field that they do not know. - A Sigstore bundle. It holds the DSSE envelope and the certificate (
verificationMaterial). It is a different file format, and cosign v2 reads it only with--new-bundle-format. It also expects a Sigstore log entry or a timestamp. - The statement. The chain would then be part of the signed bytes. The chain does not need a signature: a verifier checks it against the authority.
We chose the field x5c of the signature. The envelope stays a plain DSSE envelope, with the same name and the
same form as in a JWS.
cosign v2.5.3 ignores the field. It verifies a signed decision with the certificate and the chain
in files (CosignTest in rego4k-signing-signer):
cosign verify-blob-attestation --certificate leaf.pem --certificate-chain intermediate-and-root.pem \
--certificate-identity https://decisions.example.com --certificate-oidc-issuer-regexp '.*' \
--insecure-ignore-sct=true --insecure-ignore-tlog=true \
--signature decision.json --type https://rego4k.dev/decision/v1 input.jsoncosign needs a chain that ends with the root. Trust.Authorities can also trust an intermediate.
Why DSSE and in-toto, not a JWS
We compared three formats:
- A JWS, as OPA's bundle signatures use. A JWS has the algorithm in its header (
alg), and a verifier must not trust it. The JWS header can name the key (kid), hold the certificate chain (x5c) or the thumbprint (x5t#S256). No tool knows what a JWS of a decision means. - A DSSE envelope. It signs the bytes of the payload and their type (the PAE), with no base64 and no header to
parse first. It has no algorithm field, so the key of the verifier decides the algorithm. The envelope names the key
with
keyid. Sigstore (cosign, the Rekor log) and the in-toto tools read DSSE. - An in-toto Statement in a DSSE envelope. This is the format of software attestations, for example SLSA provenance. SLSA is a framework for the security of the software supply chain. The statement binds the predicate to the digest of a subject. cosign and the in-toto tools verify it with a key.
We chose the in-toto Statement in a DSSE envelope. A team can verify and store decisions with the tools that it uses for its other attestations.
The format is as simple as a JWS. It uses the same keys and the same 13 algorithms as bundle signing
(rego4k-signing-utils). One difference: an ECDSA signature has the DER form of DSSE tools, not the JWS form.
cosign v2 verifies a signed decision with a key (CosignTest in rego4k-signing-signer, with COSIGN_BIN):
cosign verify-blob-attestation --key public_key.pem --signature decision.json \
--type https://rego4k.dev/decision/v1 --insecure-ignore-tlog=true input.jsoninput.json must hold the canonical JSON form of the input, because cosign compares its SHA-256 with the subject.