# GHSA-MX63-5CWX-V3PR: Eclipse Ditto resolved policy view discloses non-readable content of imported, namespace root and referenced policy entries

- Database: GitHub
- Severity: CVSS 2.3 (Low)
- Published: 2026-11-19
- Modified: 2026-11-19

## Tracked as

- [CVE-2026-129916](https://cve.now/CVE-2026-129916.md): Eclipse Ditto authorization bypass in resolved policy view

## Description

### Summary

The **resolved policy view** of Eclipse Ditto (`GET /api/2/policies/{policyId}?policy-view=resolved`, also available as
`policy-view` header via WebSocket and connections) returns the effective policy: the policy itself merged with the
entries it imports and with the entries of the namespace root policies that apply to its namespace.

The view does not apply the READ permissions of the policies the merged content comes from:

- Directly imported and namespace root entries are only checked **per entry**, and only require READ on **some part**
  of the entry in its source policy. The merged result is then filtered with the permissions of the requested
  (importing) policy only. A caller who may read only part of an entry in the source policy (e.g. only its
  `subjects`, or everything except its `resources` because READ on them is revoked) therefore receives the
  **complete** entry.
- Entries of **transitive imports** (`transitiveImports`) and of the imports of namespace root policies are only
  checked against the intermediate policy, never against the policy they originate from.
- Content copied into an entry by **`references`** (subjects, resources and namespaces of the referenced entry) is not
  checked against the READ permissions on the referenced entry at all, also for references to another entry of the
  same policy.

In all cases the resolved view can contain subjects, resources and granted/revoked permissions that are hidden from
the caller when they read the originating policy directly.

Severity: **Low**.

### Details

[`PolicyCommandEnforcement#filterResponse`](https://github.com/eclipse-ditto/ditto/blob/3.9.8/policies/service/src/main/java/org/eclipse/ditto/policies/service/enforcement/PolicyCommandEnforcement.java#L202-L206)
handles a `RetrievePolicyResponse` with `policy-view=resolved` in two steps:

1. [`mergeAndDropUnreadable`](https://github.com/eclipse-ditto/ditto/blob/3.9.8/policies/service/src/main/java/org/eclipse/ditto/policies/service/enforcement/PolicyCommandEnforcement.java#L260-L309)
   merges imported and namespace root entries into the policy and removes each entry the caller may not read in its
   source policy. The check,
   [`hasSourceSideRead`](https://github.com/eclipse-ditto/ditto/blob/3.9.8/policies/service/src/main/java/org/eclipse/ditto/policies/service/enforcement/PolicyCommandEnforcement.java#L329-L333),
   is a **partial** permission check:

   ```java
   src.getEnforcer().hasPartialPermissions(
           PoliciesResourceType.policyResource("/entries/" + label), authCtx, Permission.READ);
   ```

   It is `true` as soon as the caller may read the entry **or any part of it**, so the entry is kept as a whole.

2. The merged policy is then filtered by
   [`getJsonViewForPolicyQueryCommandResponse`](https://github.com/eclipse-ditto/ditto/blob/3.9.8/policies/service/src/main/java/org/eclipse/ditto/policies/service/enforcement/PolicyCommandEnforcement.java#L464-L473)
   with the enforcer of the **requested policy**, not of the source policy. A caller with READ on `policy:/` of the
   requested policy sees every field of every kept entry. The READ permissions of the source policy on the fields of
   the entry (`policy:/entries/<label>/subjects`, `.../resources`, ...) are never applied.

A direct `GET /api/2/policies/{sourcePolicyId}` filters the same entry field by field with the source policy's enforcer
and correctly hides the parts the caller may not read.

Content of policies further away than the direct imports and namespace root policies is not covered by these checks
at all:

- For **transitive imports** and the imports of namespace root policies, the merged entry (e.g.
  `imported-<B>-imported-<C>-<label>`) is only checked against the intermediate policy `B` (step 1) and the requested
  policy (step 2). The READ permissions of `C` are never applied, even if the caller has no READ on `C` at all.
- When **`references`** are resolved
  ([`PolicyImporter#resolveAllReferences`](https://github.com/eclipse-ditto/ditto/blob/3.9.8/policies/model/src/main/java/org/eclipse/ditto/policies/model/PolicyImporter.java#L451-L535)),
  the subjects, resources and namespaces of the referenced entry are copied into the referencing entry. The
  referencing entry, an own entry of the requested policy or an entry of an imported policy, is only checked with the
  READ permissions on itself, never with those on the referenced entry. This also applies to references to another
  entry of the same policy (e.g. a READ revoke on `policy:/entries/HIDDEN/resources` does not hide the resources an
  entry referencing `HIDDEN` gets copied from it).

The issue can be reached in these ways:

- **Declared policy imports:** the caller may read a policy that imports another policy. Adding an import requires
  unrestricted READ on the imported entries
  ([`PolicyImportsPreEnforcer`](https://github.com/eclipse-ditto/ditto/blob/3.9.8/policies/enforcement/src/main/java/org/eclipse/ditto/policies/enforcement/pre/PolicyImportsPreEnforcer.java#L186-L188)).
  So this case requires that the caller is not the one who added the import, or that the caller's READ on the source
  policy was restricted after the import was added, or that importable entries were added to the source policy
  afterwards.
- **Namespace root policies:** the caller may read any policy in a namespace for which namespace root policies are
  configured (`ditto.policies.namespace-policies`), and has partial READ on an entry of such a root policy, or any
  READ restriction in a policy a root policy imports. No import needs to be added.
- **Transitive imports and `references`:** the caller may read a policy which transitively imports, or references an
  entry of, a policy whose content the caller may not (completely) read. Here the caller does not need any READ on
  that policy. This includes references between entries of the requested policy itself, if the caller may not read
  all of the referenced entry.

The resolved policy view was introduced in Ditto 3.9.0. Ditto 3.8.x and earlier do not have it and are **not affected**.

### Proof of concept

Using the `deployment/docker` docker-compose setup, which enables pre-authentication and exposes the gateway directly on
port `8081`:

1. As `nginx:ditto`, create a source policy. Its entry `x` is importable. `nginx:alice` may read the policy, except the
   `resources` of entry `x`:

   ```sh
   curl -u ditto:ditto -X PUT -H 'Content-Type: application/json' \
     http://localhost:8080/api/2/policies/org.example:source -d '{
       "entries": {
         "admin": {
           "subjects": { "nginx:ditto": { "type": "admin" } },
           "resources": {
             "policy:/": { "grant": ["READ", "WRITE"], "revoke": [] }
           },
           "importable": "never"
         },
         "alice": {
           "subjects": { "nginx:alice": { "type": "user" } },
           "resources": {
             "policy:/": { "grant": ["READ"], "revoke": [] },
             "policy:/entries/x/resources": { "grant": [], "revoke": ["READ"] }
           },
           "importable": "never"
         },
         "x": {
           "subjects": { "nginx:service-account": { "type": "service" } },
           "resources": {
             "thing:/attributes/secret-path": { "grant": ["READ", "WRITE"], "revoke": [] }
           },
           "importable": "implicit"
         }
       }
     }'
   ```

2. As `nginx:ditto`, create a policy that imports the source policy and lets `nginx:alice` read it:

   ```sh
   curl -u ditto:ditto -X PUT -H 'Content-Type: application/json' \
     http://localhost:8080/api/2/policies/org.example:importing -d '{
       "entries": {
         "admin": {
           "subjects": { "nginx:ditto": { "type": "admin" } },
           "resources": {
             "policy:/": { "grant": ["READ", "WRITE"], "revoke": [] }
           }
         },
         "alice": {
           "subjects": { "nginx:alice": { "type": "user" } },
           "resources": {
             "policy:/": { "grant": ["READ"], "revoke": [] }
           }
         }
       },
       "imports": {
         "org.example:source": {}
       }
     }'
   ```

3. As `nginx:alice`, read entry `x` directly from the source policy. `resources` is hidden, as configured:

   ```sh
   curl -H 'x-ditto-pre-authenticated: nginx:alice' \
     http://localhost:8081/api/2/policies/org.example:source/entries/x
   # -> {"subjects":{"nginx:service-account":{"type":"service"}},"importable":"implicit"}
   ```

4. As `nginx:alice`, read the resolved view of the importing policy:

   ```sh
   curl -H 'x-ditto-pre-authenticated: nginx:alice' \
     'http://localhost:8081/api/2/policies/org.example:importing?policy-view=resolved'
   ```

   Vulnerable versions return the imported entry `imported-org.example:source-x` **including** its `resources`:

   ```json
   "imported-org.example:source-x": {
     "subjects": { "nginx:service-account": { "type": "service" } },
     "resources": {
       "thing:/attributes/secret-path": { "grant": ["READ", "WRITE"], "revoke": [] }
     },
     "importable": "implicit"
   }
   ```

   Patched versions return the entry without `resources`, the same as step 3.

The same applies to entries of namespace root policies, which appear in the resolved view as
`nsimported-<rootPolicyId>-<label>`.

5. Variant with `references`: as `nginx:ditto`, create a policy with an own entry referencing entry `x` of the
   source policy, which `nginx:alice` may read:

   ```sh
   curl -u ditto:ditto -X PUT -H 'Content-Type: application/json' \
     http://localhost:8080/api/2/policies/org.example:referencing -d '{
       "entries": {
         "admin": {
           "subjects": { "nginx:ditto": { "type": "admin" } },
           "resources": {
             "policy:/": { "grant": ["READ", "WRITE"], "revoke": [] }
           }
         },
         "alice": {
           "subjects": { "nginx:alice": { "type": "user" } },
           "resources": {
             "policy:/": { "grant": ["READ"], "revoke": [] }
           }
         },
         "local": {
           "subjects": { "nginx:bob": { "type": "user" } },
           "resources": {},
           "references": [ { "import": "org.example:source", "entry": "x" } ]
         }
       },
       "imports": {
         "org.example:source": {}
       }
     }'

   curl -H 'x-ditto-pre-authenticated: nginx:alice' \
     'http://localhost:8081/api/2/policies/org.example:referencing?policy-view=resolved'
   ```

   Vulnerable versions return the resources of `x` copied into the own entry `local`:

   ```json
   "local": {
     "subjects": {
       "nginx:service-account": { "type": "service" },
       "nginx:bob": { "type": "user" }
     },
     "resources": {
       "thing:/attributes/secret-path": { "grant": ["READ", "WRITE"], "revoke": [] }
     },
     "references": [ { "import": "org.example:source", "entry": "x" } ]
   }
   ```

   Patched versions return `local` without the resources of `x`.

The same applies to entries of transitively imported policies (`transitiveImports`) and of policies imported by
namespace root policies, independent of the caller's READ on the intermediate policy.

### Impact

Incorrect authorization (CWE-863) leading to exposure of information (CWE-200) in the resolved policy view.

An authenticated caller can read content of imported, transitively imported, namespace root and referenced policy
entries that the policy it originates from does not allow them to read: the entry's subjects (e.g. user, group or
service account IDs), resources and granted/revoked permissions. This tells them who has which access to which resources and can help to prepare further attacks. The
issue does not allow modifying policies, and does not grant access to Things or other resources.

Impacted are deployments that let callers read a policy whose resolved view contains content of another policy the
caller may not (completely) read, i.e. where

- callers have **partial** READ on importable entries of a directly imported or namespace root policy (READ on only
  some parts of an entry, or READ with a more specific READ revoke inside the entry), **or**
- policies use **`transitiveImports`**, namespace root policies import other policies, or entries use
  **`references`** to entries of other policies, and the caller may not read everything in those other policies.

Not impacted:

- callers with no READ at all on a directly imported or namespace root entry: such entries are removed from the
  resolved view,
- the default (`original`) policy view,
- Ditto 3.8.x and earlier.

#### Workarounds

Until a patched version is deployed, do one of the following:

- Reject requests with the `policy-view` query parameter or header set to `resolved` in a reverse proxy in front of the
  Ditto gateway (this covers the HTTP API only, not WebSocket or connections), or
- grant callers who may read a policy READ on everything that policy imports or references (including transitive
  imports and the imports of namespace root policies), or no READ at all on directly imported entries, and do not
  revoke READ on parts of importable entries.

### Patches

Fixed in Eclipse Ditto **3.9.9**: the resolved policy view now restricts all content copied from other entries to
what the caller may READ in the policy it originates from. Every policy contributing to the view (the requested
policy itself, declared imports, transitive imports, namespace root policies and their imports, policies referenced by
`references`) is restricted to the caller's READ view of it before being merged, and directly imported and namespace
root entries are additionally filtered field by field in the same way as a direct read of the source policy. Own
entries of the requested policy without `references` are returned exactly as in the default policy view.

## References

- https://github.com/eclipse-ditto/ditto/security/advisories/GHSA-mx63-5cwx-v3pr

Page: https://cve.now/GHSA-MX63-5CWX-V3PR
