After Setting the Fields to encrypt the Form Breaks

Created on 20 September 2023, 9 months ago
Updated 16 January 2024, 5 months ago

Problem/Motivation

After selecting the fields for a Entity Type at "Encrypted fields entity type settings", the form breaks, and you cannot add/edit fields

Steps to reproduce

Install Real AES ( https://www.drupal.org/project/real_aes β†’ )

Create a Key with:

  1. Type: Encryption
  2. Size: 256
  3. Provider: Config
  4. Value: 32 character key

In /admin/config/system/encryption/profiles, add an Encryption Profile with: Encryption Method Authenticated AES

Add the key created, go to the test option for the Encryption Profile to verify encryption/decryption of information

In admin/config/system/field-encrypt you can set the Profile Encryption to the Profile just created, configured and tested.

Go to Encrypted fields entity type settings select an Entity Type and configure a couple fields.

After you configure the fields, try to configure additional fields for that Entity Type.

The form will throw an Ajax error and won't display the additional fields

Proposed resolution

After some testing, getEncryptionProfilesTable generates a NULL value for encrypted_field_storage__encryption_profile, which eventually breaks the form. By filtering the NULL values, we can prevent this problem. I am attaching a patch.

πŸ› Bug report
Status

RTBC

Version

3.1

Component

User interface

Created by

πŸ‡²πŸ‡½Mexico jaimeah

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @jaimeah
  • Open in Jenkins β†’ Open on Drupal.org β†’
    Core: 10.0.7 + Environment: PHP 8.1 & MySQL 5.7
    last update 9 months ago
    36 pass
  • Status changed to RTBC 5 months ago
  • πŸ‡΅πŸ‡ΉPortugal joum Porto

    After importing my encryption-relevant configuration on a unencrypted database for testing, I was getting an Ajax console error:

    "
    An AJAX HTTP error occurred.
    HTTP Result Code: 200
    Debugging information follows.
    Path: /admin/config/system/field-encrypt/entity-types?ajax_form=1
    StatusText: OK
    ResponseText: 
    Warning:  array_flip(): Can only flip string and integer values, entry skipped in /var/www/html/docroot/core/lib/Drupal/Core/Entity/EntityStorageBase.php on line 278
    The website encountered an unexpected error. Please try again later."

    This prevented me from altering the entity field encryption configuration.

    I've applied the patch and tested again on Drupal 10.1.6 and I no longer get this error.

    I propose moving to RTBC.

Production build 0.69.0 2024