encrypted-config.md 2.0 KB

Read this when changing configuration encoding, runtime loading, backup behavior, or administrator configuration access.

Encoded Configuration Files

Implementing Files

File Key symbols
index.php LoadEncryptedConfig('cfg/config.bin') during bootstrap
src/OpenMind/System/OMUtils.php LoadEncryptedConfig, Encrypt, Decrypt
src/OpenMind/Api/AdminController.php Admin read/save and backup restoration
scripts/generate-config-bin.sh First-time runtime config generation
cfg/config.ini Plaintext source used by the generator

Flow

  1. Bootstrap checks the PHP version and asks OMUtils to load cfg/config.bin.
  2. The utility decodes it to a temporary file, calls F3 config(), then deletes the temporary file.
  3. The generator encodes cfg/config.ini into a previously absent cfg/config.bin.
  4. An administrator can read plaintext through the API or submit replacement text.
  5. Save renames the prior runtime config to .old, writes the encoded replacement, and restores the backup if writing fails.

Trust Boundaries

Boundary Mechanism Location
Runtime config presence Bootstrap throws when the required file is absent OMUtils::LoadEncryptedConfig()
Sensitive config disclosure admin role required before reading plaintext AdminController::load()
Sensitive config mutation admin role and CSRF validation required AdminController::save()
Partial replacement failure Backup rename and restore attempt after write failure AdminController::saveConfiguration()
Generator overwrite Script exits if cfg/config.bin already exists scripts/generate-config-bin.sh

Config

  • Runtime file: cfg/config.bin.
  • Backup file: cfg/config.bin.old.
  • Encoding: base64_encode(gzcompress()); decoding is gzuncompress(base64_decode()).
  • The encoding is reversible; it is not a confidentiality mechanism.

See configuration spec and commands.