Skip to content

docs: rewrite evaluate_trails_with_opa tutorial to fix false-positive… - #220

Merged
JonJagger merged 1 commit into
mainfrom
docs/rewrite-evaluate-trails-opa-tutorial
May 12, 2026
Merged

JonJagger merged 1 commit into
mainfrom
docs/rewrite-evaluate-trails-opa-tutorial

Conversation

@JonJagger

Copy link
Copy Markdown
Contributor

… compliance footgun

The previous tutorial used allow if { count(violations) == 0 } throughout. This pattern silently grants compliance when the violations rule body fails to fire -- for example when the attestation key is wrong. The kosli-public/cli flow names its pull-request attestation "pr", not "pull-request". Under the old policy, those trails were shown as ALLOWED not because PRs had approvers, but because the violations rule never matched and the empty set vacuously passed. The tutorial was demonstrating the exact footgun it should have warned against.

Rewrites all policies to drive allow through positive assertions (every) rather than absence of violations. Parameterises the attestation name via --params so the policy works across orgs with different naming conventions. Explains the three design rules (fail-safe default, positive assertion, violations as diagnostics only) and adds a missing-param fail-safe test. Also fixes a Rego v1 strict-mode compile error: unused iteration variable replaced with _.

… compliance footgun

The previous tutorial used `allow if { count(violations) == 0 }` throughout.
This pattern silently grants compliance when the violations rule body fails to
fire -- for example when the attestation key is wrong. The kosli-public/cli
flow names its pull-request attestation "pr", not "pull-request". Under the
old policy, those trails were shown as ALLOWED not because PRs had approvers,
but because the violations rule never matched and the empty set vacuously
passed. The tutorial was demonstrating the exact footgun it should have warned
against.

Rewrites all policies to drive `allow` through positive assertions (`every`)
rather than absence of violations. Parameterises the attestation name via
--params so the policy works across orgs with different naming conventions.
Explains the three design rules (fail-safe default, positive assertion,
violations as diagnostics only) and adds a missing-param fail-safe test.
Also fixes a Rego v1 strict-mode compile error: unused iteration variable
replaced with `_`.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@JonJagger
JonJagger requested a review from a team as a code owner May 12, 2026 11:46
@mintlify

mintlify Bot commented May 12, 2026 •

Copy link
Copy Markdown
Contributor

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated (UTC)
kosli 🟢 Ready View Preview May 12, 2026, 11:48 AM

@JonJagger
JonJagger merged commit 16da4da into main May 12, 2026
5 checks passed
@JonJagger
JonJagger deleted the docs/rewrite-evaluate-trails-opa-tutorial branch May 12, 2026 11:59

This branch was successfully deployed

1 active deployment
staging — 9dbc17ef Deployed May 12, 2026 by mintlify[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants