owncloud/core — pull request #7794 by PVince81 (2014-03-18 20:35:29+00:00)
Title: [WIP] Obfuscate passwords in ext storage config

:construction: :no_entry_sign: NOMERGE

Fixes #7717

Uses phpseclib (hi @bantu !) to encrypt/decrypt the password using the "passwordsalt" as key.
The logic is in OC_Mount_Config and will encrypt any "password" field and rename it to "password_encrypted" and back again when reading.

Issues:
1) Needs #7792 to be merged first because it uses the same unit test base code

2) The actual mounting code in `OC\Filesystem\initMountPoints` (which I discovered too late) cannot decrypt the passwords because it uses its own config reading routine.

Here are potential solutions for this, in order of complexity:

a) Quick and dirty: add password decryption code directly in `OC\Filesystem\initMountPoints` and/or make it use `OC_MountConfig` from `files_external` to load the config (which includes password decryption). But that needs phpseclib to be available in core.

b) A bit less dirty: create a utility class "MountConfig" in core to handle mount point config (read/write) and includes password encryption/decryption code. That utility class "MountConfig" can be used by `OC\Filesystem\initMountPoints` and also by `OC_MountConfig`.
Also needs phpseclib available in core.

c) Move the ext storage config loading code from `OC\Filesystem\initMountPoints` to the `files_external` app and call it with a hook.
But I'm not sure whether we want to refactor that part now, keeping a possible backport in mind.

d) Start over with the PR and put the password decryption code directly in `smb.php` and other storages classes (common.php) or a utility class.
I don't like that solution because it's not that generic, and there is also fallback code needed.

@bantu @icewind1991 what do you think ?