How to skip the ReferenceAccess constraint on a file upload by an anonymous user?
That constraint is validated by \Drupal\Core\Entity\Plugin\Validation\Constraint\ReferenceAccessConstraintValidator. ReferenceAccessConstraintValidator::validate uses the following code.

  /* @var \Drupal\Core\Entity\FieldableEntityInterface $referenced_entity */
  $referenced_entity = $value-&gt;entity;
  if ($referenced_entity) {
    $entity = $value-&gt;getEntity();
    $check_permission = TRUE;
    if (!$entity-&gt;isNew()) {
      $existing_entity = \Drupal::entityManager()-&gt;getStorage($entity-&gt;getEntityTypeId())-&gt;loadUnchanged($entity-&gt;id());
      $referenced_entities = $existing_entity-&gt;{$value-&gt;getFieldDefinition()-&gt;getName()}-&gt;referencedEntities();

      // Check permission if we are not already referencing the entity.
      foreach ($referenced_entities as $ref) {
        if (isset($referenced_entities[$ref-&gt;id()])) {
          $check_permission = FALSE;
          break;
        }
      }
    }

    // We check that the current user had access to view any newly added
    // referenced entity.
    if ($check_permission &amp;&amp; !$referenced_entity-&gt;access('view')) {
      $type = $value-&gt;getFieldDefinition()-&gt;getSetting('target_type');
      $this-&gt;context-&gt;addViolation($constraint-&gt;message, [
        '%type' =&gt; $type,
        '%id' =&gt; $id,
      ]);
    }
  }


(In particular, see the line containing $referenced_entity-&gt;access('view').)

We can hook into the file's access control to alter the outcome, with hook_entity_access() or hook_ENTITY_TYPE_access().

Another solution could be to create a new field type which inherits everything from Drupal\file\Plugin\Field\FieldType\FileItem, except for the ReferenceAccess constraint in its plugin definition. You can do this in two ways:


Create a new plugin class that extends the original class, and copy and modify its docblock, including the @FieldType annotation.
Implement hook_field_info_alter(), copy the file plugin definition to your own, and make the necessary adjustments there.