diff --git a/core/CHANGELOG.txt b/core/CHANGELOG.txt index 853260ae9f38863850ddbc29d8b0964f11aa2d9b..d8233459f76c70bf70d5d878b7db07cea64ed7c0 100644 --- a/core/CHANGELOG.txt +++ b/core/CHANGELOG.txt @@ -1,3 +1,7 @@ +Drupal 8.2.8, 2017-04-19 +------------------------ +- Fixed security issues. See SA-CORE-2017-002. + Drupal 8.2.7, 2017-03-15 ------------------------ - Fixed security issues. See SA-CORE-2017-001. diff --git a/core/lib/Drupal/Core/Entity/EntityAccessControlHandler.php b/core/lib/Drupal/Core/Entity/EntityAccessControlHandler.php index 15306934692b351b39d12a23d184736b7f4087d9..86668bc69406ee283bc1d081462aed888554b055 100644 --- a/core/lib/Drupal/Core/Entity/EntityAccessControlHandler.php +++ b/core/lib/Drupal/Core/Entity/EntityAccessControlHandler.php @@ -303,6 +303,19 @@ public function fieldAccess($operation, FieldDefinitionInterface $field_definiti // Get the default access restriction that lives within this field. $default = $items ? $items->defaultAccess($operation, $account) : AccessResult::allowed(); + // Explicitly disallow changing the entity ID and entity UUID. + if ($operation === 'edit') { + if ($field_definition->getName() === $this->entityType->getKey('id')) { + return $return_as_object ? AccessResult::forbidden('The entity ID cannot be changed') : FALSE; + } + elseif ($field_definition->getName() === $this->entityType->getKey('uuid')) { + // UUIDs can be set when creating an entity. + if ($items && ($entity = $items->getEntity()) && !$entity->isNew()) { + return $return_as_object ? AccessResult::forbidden('The entity UUID cannot be changed')->addCacheableDependency($entity) : FALSE; + } + } + } + // Get the default access restriction as specified by the access control // handler. $entity_default = $this->checkFieldAccess($operation, $field_definition, $account, $items);