---
id: "GHSA-c33x-vcv4-vg3g"
kind: "vulnerability"
aliases: ["GHSA-c33x-vcv4-vg3g"]
title: "Cedar: JSON template is in scope missing slot-id validation allows link panic and decision divergence"
severity: "low"
cvss: null
epss: null
exploited: false
status: "open"
category: "package"
products: [{"name": "cedar-policy", "fixed": ["4.11.1"], "affected": ">= 4.0.0, < 4.11.1", "ecosystem": "cargo"}, {"name": "cedar-policy", "fixed": ["3.4.3"], "affected": ">= 3.0.0, < 3.4.3", "ecosystem": "cargo"}, {"name": "@cedar-policy/cedar-wasm", "fixed": ["4.11.1"], "affected": ">= 4.0.1, < 4.11.1", "ecosystem": "npm"}, {"name": "@cedar-policy/cedar-wasm", "fixed": ["3.4.3"], "affected": ">= 3.2.0, < 3.4.3", "ecosystem": "npm"}]
ecosystems: ["cargo", "npm"]
tags: ["authorization", "cedar", "cedar-policy", "cwe-20", "javascript", "package", "rust"]
not_affected_if: ["cedar-syntax-only", "no-is-in-scope", "no-policy-templates", "well-formed-policies"]
published_at: "2026-10-29T16:35:04+00:00"
first_seen_at: "2026-10-29T16:39:03+00:00"
updated_at: "2026-10-29T16:39:52+00:00"
sources: [{"source": "ghsa", "url": "https://github.com/advisories/GHSA-c33x-vcv4-vg3g", "first_seen_at": "2026-10-29T16:39:03+00:00"}]
---

# Cedar: JSON template is in scope missing slot-id validation allows link panic and decision divergence

Cedar's JSON policy format accepted malformed slot identifiers in principal and resource scope constraints of templates, and silently rewrote them. A linked policy can then either fail or panic, or bind slots to the wrong values, so a forbid rule may not apply and access is allowed unintentionally.

_Summary, check and fix written by a model from the sources; labelled as such._

## Affected

- cargo:cedar-policy affected >= 4.0.0, < 4.11.1 fixed 4.11.1
- cargo:cedar-policy affected >= 3.0.0, < 3.4.3 fixed 3.4.3
- npm:@cedar-policy/cedar-wasm affected >= 4.0.1, < 4.11.1 fixed 4.11.1
- npm:@cedar-policy/cedar-wasm affected >= 3.2.0, < 3.4.3 fixed 3.4.3

## How to check

- Search JSON-format Cedar policy templates for `"slot": "?resource"` inside the principal block and `"slot": "?principal"` inside the resource block, with `is in` conditions.
- Check the `cedar-policy` crate version in `Cargo.lock` and the `@cedar-policy/cedar-wasm` version in `package-lock.json`.

## Fix

- `cedar-policy` (cargo): `4.11.1` for the 4.x line, `3.4.3` for the 3.x line
- `@cedar-policy/cedar-wasm` (npm): `4.11.1` for the 4.x line, `3.4.3` for the 3.x line

## Timeline

- 2026-10-29T16:39:03+00:00 ghsa https://github.com/advisories/GHSA-c33x-vcv4-vg3g

## Documents

- [advisory] Maintainer's advisory: api.github.com https://api.github.com/repos/cedar-policy/cedar/security-advisories/GHSA-c33x-vcv4-vg3g
- [advisory] Maintainer's advisory: github.com https://github.com/cedar-policy/cedar/security/advisories/GHSA-c33x-vcv4-vg3g

## From the sources

Cedar users must be using all of the following features to be affected by this advisory: JSON format policies, policy templates, and the `is in` scope condition. This advisory only affects JSON-formatted Cedar policy templates containing `is in` scope conditions that are **malformed** according to the Cedar syntax. It does **not** affect syntactically well-formed policies.

Users of Cedar who author policies in the JSON format were able to write Cedar policies using the `is in` condition with an incorrect slot identifier in the principal and resource scope constraints (e.g., `?principal` in the resource scope constraint) even though this is not allowed when parsing policies from the Cedar policy syntax. Internally, the slot identifiers were silently corrected (e.g. `?resource` is placed in the resource scope constraint). 

If the policy contains *exactly one slot* in either the principal or resource position, then any attempt to create a linked policy from the template results in an error: the internal representation of the template does not contain the slot identifier as written in the malformed JSON policy (it has been corrected silently), so attempting to fill that slot is an error. If instead the template is linked using slot identifier expected internally (i.e., not what is written in the JSON template), the linking will initially succeed, but a subsequent invariant violation will cause a panic.

When the template contains *slots in both the principal and resource* position, then both slots will be present in the internal representation: linking succeeds, but with each slot bound to the value intended for the other (the silent correction). The linked policy is then semantically different from the malformed policy the user intended, and any subsequent authorization decision made against that policy may lead to accesses being unintentionally allowed or denied.

Concretely, consider the following JSON format policy template intended to deny users in a particular project from accessing documents with a particular classification.
```
{
  "effect": "forbid",
  "principal": {
    "op": "is",
    "entity_type": "User",
    "in": { "slot": "?resource" }
  },
  "action": { "op": "All" },
  "resource": {
    "op": "is",
    "entity_type": "Doc",
    "in": { "slot": "?principal" }
  },
  "conditions": []
}
```

Linked with `?principal = Classification::"topsecret"` and `?resource = Project::"alpha"`, the author expects to create the policy:
```
forbid(principal is User in Project::"alpha", action, resource is Doc in Classification::"topsecret");
```

But because Cedar internally links slots by scope position (not by name), the actual policy evaluated by the engine is:
```
forbid(principal is User in Classification::"topsecret", action, resource is Doc in Project::"alpha");
```

If a user is in `Project::"alpha"` but not `Classification::"topsecret"`, the `forbid` policy does not apply, and access is unintentionally allowed.

## Patches

This advisory is patched in version 4.11.1 and 3.4.3, both available on Crates.io and NPM.

## Workarounds

If you cannot update to a patched version, you can determine if you are affected by checking your JSON format policy templates for the following two patterns.

```
  "principal": {
    "op": "is",
    "entity_type": "User",
    "in": { "slot": "?resource" }
  }
```

and
```
  "resource": {
    "op": "is",
    "entity_type": "Doc",
    "in": { "slot": "?principal" }
  }
```

## References
* [Cedar Policy Language Reference Guide - Cedar Policy Templates](https://docs.cedarpolicy.com/policies/templates.html)
* [Cedar Policy Language Reference Guide - JSON Policy Format](https://docs.cedarpolicy.com/policies/json-format.html)

---

_Free to read at a human pace. An API with keys and an MCP server are in preparation; early access: hello@infrastack.ai_
