encrypted-config.md 2.1 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
cfg/config.ini.example Tracked placeholder template for local configuration
cfg/config.ini Ignored local plaintext configuration, potentially containing credentials

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. Deployment tooling provisions cfg/config.bin before bootstrap; no configuration-generation script is tracked.
  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 Numeric permission ID 1 required before reading plaintext AdminController::load()
Sensitive config mutation Numeric permission ID 1 and CSRF validation required AdminController::save()
Partial replacement failure Backup rename and restore attempt after write failure AdminController::saveConfiguration()
Local config source Placeholder template is copied to an ignored local file cfg/config.ini.example

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.