Issue Feature Under Review Stale

#108621Password Type for Site Settings

Christian Rath-Ulrich 01/13/26, 08:44 updated 06/16/26, 22:28

Description

New `password` type for Site Settings that automatically encrypts passwords using AES-256-CBC and displays them masked in the backend editor.

Problem

Previously, passwords had to be stored as regular `string` types, which means:
- Passwords are stored in plain text in `settings.yaml`
- Security risk in version control
- No masking in the backend editor

Solution

New `password` type with:
- Automatic encryption using AES-256-CBC
- Uses TYPO3 `encryptionKey`
- Masked as `********` in backend editor
- Smart handling of already encrypted values

Usage

In settings.definitions.yaml

settings:
  api.password:
    label: 'API Password'
    description: 'Password for external API authentication'
    type: password
    default: ''
    category: api

In PHP Code

use TYPO3\CMS\Core\Settings\Type\PasswordType;

// Read password from settings (encrypted)
$encryptedPassword = $site->getSettings()->get('api.password');

// Decrypt password

$passwordType = GeneralUtility::makeInstance(PasswordType::class);
$decryptedPassword = $passwordType->decrypt($encryptedPassword);

Implementation

New Files

- `typo3/sysext/core/Classes/Settings/Type/PasswordType.php` – PHP class
- `Build/Sources/TypeScript/backend/settings/type/password.ts` – TypeScript component

Modified Files

- `Build/Sources/TypeScript/backend/settings/editor.ts` – Added import

Security

- Encryption using AES-256-CBC
- Uses TYPO3 `encryptionKey`
- Encrypted values have prefix `###ENCRYPTED###`
- Empty passwords are not encrypted

Example: Encrypted Value


api.password: '###ENCRYPTED###dGhpc2lzYW5leGFtcGxlZW5jcnlwdGVkcGFzc3dvcmQ='

for testing

https://github.com/Rathch/setting_type_test

Reviews 1

History 638

Show 113 earlier messages