fix(security): Pods-Meta nur lesbar, wenn Pods aktiv, aber nicht nutzbar
Ist Pods aktiv, seine API aber nicht nutzbar, melden gesampelte und registrierte Meta-Schlüssel READONLY statt schreibbar. Sonst würden Pods-Felder (auch über Pods' register_meta-Integration) an Pods vorbei geschrieben. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
8f3a4e76eb
commit
234fd1edac
@@ -13,6 +13,11 @@ final class RegisteredMetaSource extends MetaFieldSource
|
||||
{
|
||||
private const TYPES = ['string', 'boolean', 'integer', 'number', 'array', 'object'];
|
||||
|
||||
/** @param bool $readOnly Report every key as READONLY (Pods is active but cannot be used to write its keys). */
|
||||
public function __construct(private bool $readOnly = false)
|
||||
{
|
||||
}
|
||||
|
||||
public function id(): string
|
||||
{
|
||||
return 'meta';
|
||||
@@ -26,7 +31,7 @@ final class RegisteredMetaSource extends MetaFieldSource
|
||||
$key = (string) $key;
|
||||
$args = is_array($args) ? $args : [];
|
||||
$type = (string) ($args['type'] ?? 'string');
|
||||
$readonly = is_protected_meta($key, 'post') && empty($args['show_in_rest']);
|
||||
$readonly = $this->readOnly || (is_protected_meta($key, 'post') && empty($args['show_in_rest']));
|
||||
|
||||
$fields[] = new FieldDefinition(
|
||||
$key,
|
||||
|
||||
Reference in New Issue
Block a user