Skip to content

epic: cedar lexicon — typed authoring for a CNCF policy language #1645

Closed

Description

@lex00

Cedar joined the CNCF as a Sandbox project in December 2025 — a vendor-neutral, Lean-verified authorization policy language with production adopters beyond AWS (Cloudflare, MongoDB, StrongDM, Cloudinary). chant already touches it in one place: the aws lexicon's generated VerifiedPermissionsPolicy carries its policy text as an opaque CedarPolicy string. Everything upstream of that string — authoring, composition, validation, environments, drift — is unowned. This epic proposes lexicons/cedar to own it.

What cedar is to chant

Cedar is a deliberately abstraction-free target: no variables, no modules, no loops, and policy templates carry exactly two slots (?principal, ?resource). Its toolchain is validation and evaluation only — it checks policies after they are written and decides requests at runtime. Teams managing policy sets at scale generate .cedar text with string templating today. That is the CloudFormation shape exactly: an intentionally dumb target starving for a typed authoring layer, which is the product chant is.

The surfaces chant consumes and emits:

  • .cedar policy text and the JSON policy format — the serializer's outputs. The JSON form is also the parse source for import.
  • Cedar schema (JSON and human-readable forms) — the upstream spec generate() consumes to produce typed entity/action classes per project.
  • @cedar-policy/cedar-wasm (npm, TS types included) — the real validator, runnable in-process at post-synth. No CLI on PATH, no Docker.

The walk-away test holds: an emitted .cedar policy set is consumed by any Cedar evaluator — AVP, cedar-agent, Cloudflare-style embeddings — with chant nowhere in sight.

Decisions

Own lexicon. Cedar is a non-Kubernetes spec with its own upstream, versioning, and grammar — the authoring rule's test for a new lexicon. rulePrefix: "CED".

Cedar is a target, never chant's gate. The organizational-policy ruling stands: org policy is TS post-synth checks, and a separate policy engine "would duplicate the lint engine and break 'TypeScript is the one language.'" There will be no cedarGate(). chant compiles to Cedar; it is not governed by Cedar.

Schema-driven codegen, per project. Unlike aws/azure, the interesting spec is not one global upstream but the user's own Cedar schema: generate() turns declared entity types, actions, and attributes into typed TS classes, so a typo'd attribute is a compile error and a renamed entity type is a compiler-guided refactor. The Cedar grammar itself is the pinned upstream; the user's schema is the input.

The aws lexicon keeps the deployment vehicle. AWS::VerifiedPermissions::* and the ApplyOp cloudformation path already ship. The cedar lexicon makes the embedded string typed — a VerifiedPermissionsPolicy whose statement is a serialized cedar-lexicon policy value rather than prose. Standalone .cedar/JSON files serve every non-AVP evaluator.

Cedar-for-Kubernetes kinds are not this lexicon. The CNCF push includes Cedar as a K8s authorizer with policies as CRDs. CRDs belong to the k8s lexicon's CRD sources — same rule that kept helm.cattle.io out of k3s. The cedar lexicon lints the policy text embedded in those kinds, the ARGO001–005 pattern.

Cross-domain checks are the differentiator. Because policies and the resources they govern live in one build, post-synth checks can span them: an entity ID that references an actual resource declaration, "every declared bucket is covered by at least one forbid," "no schema action lacks any policy." No Cedar tool can express these; they are ordinary PostSynthChecks here.

Ownership channel is store-scoped until proven finer. AVP policy stores are taggable; individual policies are not. The ownershipChannel design question — store-level granularity vs. a description-field marker — is a sub-issue, and no channel is declared until its read paths are implemented (the tier-2 check exists because of exactly this).

Dogwood is out of scope. Days old, AWS-governed, reference interpreter explicitly not production-ready, no JS bindings. Its lower-to-Cedar step means this lexicon's output remains its substrate; revisit as an extraRulePrefixes extension when the spec settles.

Pin

Cedar language 4.x via @cedar-policy/cedar-wasm@4.12.0 (current latest). The schema grammar has two syntaxes (JSON and human-readable); sub-issue 1 verifies which the codegen consumes as canonical and whether the wasm package exposes the schema parser both ways. Cedar Analysis (semantic diff of policy sets) is a separate toolchain — priced in sub-issue 7, not assumed.

Definition of done

  • lexicons/cedar/ passes chant dev check-lexicon Tier 1 and the codegen tests, like every other lexicon.
  • The native tool is the test: every emitted policy set validates clean under cedar-wasm against its schema, exercised in post-synth and in example tests — not just well-formed text.
  • A typed policy authored against a generated schema round-trips: TS → .cedar → JSON policy format → regenerated TS (templateParser/templateGenerator).
  • An example ships pairing a policy set with the infrastructure it governs, with at least one cross-domain post-synth check firing in CI, plus an AVP embedding example through VerifiedPermissionsPolicy.
  • Meta-policy lint walls: a bare permit(principal, action, resource); fails in prod builds; a policy referencing an entity type or action absent from the schema fails everywhere.
  • LSP completions/hover serve schema-derived entity types and actions; MCP tools answer "which policies cover this resource."

Sub-issues

  1. Upstream verification and pin — canonical schema syntax for codegen, wasm parser coverage, JSON policy format fidelity for import. The k3d lesson: price the machine-readable-source question before anything is hand-typed.
  2. Scaffold + serializer — chant init lexicon, .cedar and JSON policy outputs, serializer tests.
  3. Schema-driven generate() — user schema → typed entity/action classes; naming strategy; validate()/coverage().
  4. Lint + post-synth — wasm validation check, meta-policy rules, cross-domain coverage checks, auditCatalog().
  5. AVP integration + lifecycle — typed statement embedding into VerifiedPermissionsPolicy; describeResources()/observeAmbient() against a policy store (an ambient permit is a standing grant — the security finding, not housekeeping); ownership channel design.
  6. Import/reconcile — JSON policy format parser, TS generator, ReconcileOp example pulling console edits back to source.
  7. Docs, LSP/MCP/skills, examples to Tier 2 — and a stretch spike: Cedar Analysis as a post-synth "unreviewed widening" check against the previous snapshot's policy set.

Related: #1638-adjacent aws generated surface (VerifiedPermissionsPolicy, CedarPolicy), the k8s CRD-sources rule, organizational-policy's no-second-engine ruling.

Sub-issues follow this comment.

Activity

  1. added
    enhancement
    epic
    on Aug 10, 2026
  2. lex00 commented on Aug 10, 2026

    @lex00
    ContributorAuthor

    Coverage audit before implementation — the epic checked against the full LexiconPlugin interface (packages/core/src/lexicon.ts) and all twenty lexicon-authoring pages, tier checklists included.

    Already covered: serializer + rulePrefix, schema-driven generate(), lint/post-synth/auditCatalog, LSP + MCP, import round-trip, observation + ownership channel, docs/skills/examples, the tier-1 DoD. The following gaps are folded into the sub-issue set (amendments in bold):

    1. upstreamPin + the upgrade op. The pin section pinned versions but not the mechanism: declare upstreamPin on the plugin and add ops/lexicon-upgrade/cedar-upgrade.op.ts like every other lexicon. Cedar's wrinkle: the "spec" generate() consumes is the project's own Cedar schema (local input), while the pinned upstream is the language/wasm version — the first lexicon with that split, worth stating so the content-pin guidance (digest extracted schemas, commit covered names beside the digest, chant#1390) is applied to the right thing.
    2. Intrinsics: none, on purpose. Policies are pure data; the lexicon registers no intrinsics and no pseudo-parameters, so the check-lexicon intrinsic gates pass trivially. Recorded as a decision so nobody adds a tagged template later without meeting isTag/foldsAsCall obligations.
    3. configSchema is required, not optional here. Schema-driven codegen needs to know where the user's Cedar schema lives — that is a cedar config namespace (cedar.schema, plus validation strictness), and reading it without declaring the schema is exactly the chant#1344 trap.
    4. CI + publishing onboarding was missing entirely — now sub-issue 8: chant dev onboard cedar, examples registered in root workspaces, the root package.json dependency entry (lexicon-wiring.test.ts enforces it), the test/integration.sh smoke section, Docker smoke files, and the npm trusted-publisher record — the one manual step, per-package, publish fails ENEEDAUTH without it, and the first publish must happen by hand before the record can attach.
    5. Tier-2 surface named explicitly: ≥3 initTemplates (default, AVP embedding, gateway policy set), ≥1 composite in src/composites/ (the composition story is this lexicon's thesis — StandardTenantPolicy etc.), detectTemplate for .cedar/JSON policy documents.
    6. Docs-site mechanics: standalone Starlight site under lexicons/cedar/docs/ with explicit sidebar (every page reachable — chant#1312), docs() registered on the plugin, cross-namespace link rules, just docs-check-links.
    7. Observation hardening named: tri-state via the ObservationResult envelope, closed UnobservedReason set, total ownership verdicts (unknown when the channel can't be read), the queried map, and describeObservationConformance from @intentius/chant-test-utils in the test suite.

    Non-goals, stated so their absence is a decision: no emulator (validation is in-process wasm; there is no evaluator service worth faking — a local cedar-agent could become one later), no commands(), no applier (the aws lexicon owns the deploy vehicle), no generateComponentPipeline, no migrationSource.

    Sub-issues follow.

  3. lex00 commented on Aug 10, 2026

    @lex00
    ContributorAuthor

    Complete and released in chant-v0.44.8. All eight sub-issues landed across seven PRs (#1656, #1664, #1663, #1666, #1667, #1669, #1668): typed schema-driven authoring over the user's .cedarschema, .cedar + Cedar JSON policy-format serialization, eleven CED lint/post-synth rules with full audit-catalog coverage, byte-identical import round-trips, LSP/MCP/skills/init-templates/composites and the standalone docs site, AVP embedding + policy-store observation with the description-marker ownership channel, and CI/publish onboarding. chant dev check-lexicon: 21/21 tier-1, zero KNOWN_FAILURES entries.

    Outstanding, tracked elsewhere: the npm trusted-publisher record + first manual publish for @intentius/chant-lexicon-cedar (maintainer step, documented in #1669); onboard.ts Dockerfile patcher bug (#1678); the dogwood dialect stack (#1646, PRs #1672/#1677) proceeds now that this is released.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementepic

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions