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:

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:

json
{
  "_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 GitHub

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:

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 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:

  1. 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 have codeSigning, as cosign requires. Thus a certificate of a TLS server cannot sign a decision.
  2. 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.
  3. 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:

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:

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):

sh
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.json

cosign 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:

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):

sh
cosign verify-blob-attestation --key public_key.pem --signature decision.json \
  --type https://rego4k.dev/decision/v1 --insecure-ignore-tlog=true input.json

input.json must hold the canonical JSON form of the input, because cosign compares its SHA-256 with the subject.