Functional concerns
As site admin, in bugzilla reference plugin administration:
- A warning is displayed on references whose api key in store in cleartext
Then, at reference creation or update, when updating the API key,
- If not already present, generate a random secret in a file in etc/tuleap/conf/encryption_secret.key (owned by codendiadm 00400)
- Use this secret to encrypt the API key and store the encrypted stuff in DB
- The encrypted API key is stored in a new column and the cleartext version is nulled
When the reference is used
- Use the secret to decrypt the API key before usage
Note: make the mecanism generic for other credentials later on
Technical concerns
Leverage on sodium_compat the official polyfill of libsodium that is the recommended/trusted way to do encryption in PHP starting 7.2
Our wrapper must ensure that the secret will not leak:
- On object clone
- In stack traces
- In serialization attempts