# GHSA-W5JW-X8FM-533G: Embedded resources reuse the parent's attribute cache key, bypassing property security for secured children

- Database: GitHub
- Severity: CVSS 6.5 (Medium)
- Published: 2026-11-16
- Modified: 2026-11-16

## Affected versions

- api-platform/core (Packagist): from 2.6.0, through 4.4.8
- api-platform/core (Packagist): from 5.0.0, through 5.0.7
- api-platform/serializer (Packagist): from 4.0.0, through 4.4.8
- api-platform/serializer (Packagist): from 5.0.0, through 5.0.7

## Description

### Summary

`AbstractItemNormalizer::normalize()` only computes the serializer `cache_key` when none is present in the context:

```php
if (!isset($context['cache_key'])) {
    $context['cache_key'] = $this->isCacheKeySafe($context) ? $this->getCacheKey($format, $context) : false;
}
```

Child contexts created for embedded relations inherit the parent's `cache_key` (Symfony `AbstractObjectNormalizer::createChildContext()` appends `-attr`), so `isCacheKeySafe()` never runs for the embedded resource class. When the parent has no secured property and the embedded resource has a property guarded by `ApiProperty(security:)` or `ApiProperty(policy:)`, the list of allowed attributes computed for the first embedded object is cached and reused for the following ones.

The same guard exists in the JSON:API (`src/JsonApi/Serializer/ItemNormalizer.php`) and HAL (`src/Hal/Serializer/ItemNormalizer.php`) item normalizers.

### Impact

- Any runtime, including PHP-FPM, single request: all elements of one embedded to-many relation share the decision taken for the first element. A user reading a parent can see an object-level secured property of a child they do not own.
- Long-running runtimes (FrankenPHP worker mode, RoadRunner, Swoole): the cache entry outlives the request, so the decision taken for one user is served to another user requesting the same parent IRI.

The root-class check fixed in GHSA-cwhh-732q-p35c (5248f9a02) does not cover embedded children.

### Reproduction (to be turned into a functional test)

A parent resource without secured properties, with a to-many relation to a child resource exposing `#[ApiProperty(security: "object.owner == user.getUserIdentifier()")] $secret` in the parent's read group. Child c1 owned by `dunglas`, c2 owned by `admin`. `GET` the parent as `dunglas`: `children[1].secret` is present, expected absent.

### Patches

When `cache_key` is inherited, still evaluate `isCacheKeySafe()` for the current resource class and disable the cache when it is not safe, in `AbstractItemNormalizer`, the JSON:API and HAL item normalizers.

### Workarounds

None at configuration level besides avoiding property-level `security`/`policy` on resources that are embedded in other resources.

Found internally while auditing request-scoped state for GHSA-xmq6-3c6q-fr8m.

## References

- https://github.com/api-platform/core/security/advisories/GHSA-w5jw-x8fm-533g

Page: https://cve.now/GHSA-W5JW-X8FM-533G

Wrong or missing data? Send feedback: POST https://cve.now/api/v1/feedback (see https://cve.now/agents#feedback).
