Add the ability to read PGP keys from files and hide it in SQL #701
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Using pgp_pub_crypt/decrypt(..., dearmor(KEY)) expose the key in PostgreSQL log, in clear text, and it may be a problem, a security issue I think. It also may enlarge Postgres logs by 1000%.
This patch allow to use a configuration like this:
Or:
Replacing PUBLIC_PGP_KEY and PRIVATE_PGP_KEY.
It translate in SQL like this:
This patch does nothing, and maintains compatibility, if you use the current configuration.
To enable the patch you need to replace *_PGP_KEY with *_PGP_KEY_ARMORED_FILE or *_PGP_KEY_DEARMORED_FILE, which I prefer since it avoid useless calls to dearmor().
This pull request does not contains the change I made for the tests since it's not complete. I can improve it with other pull requests.