I have a dockerized application that processes data fetched from 3rd party APIs. Now, API-token or password is required to work with these APIs. Currently, I'm supplying it to my script by setting the docker container's environment variables using a docker-compose file.
The problem with this approach is that the API credentials are stored in plain text in my docker-compose file. So I'm planning to first encrypt it and then storing it in the docker-compose file but with this approach, my script needs to know the decryption key using which the credentials are encrypted. Hard coding it in the script would not be the best possible option as anyone can view my script in running a docker container. So how to manage the decryption key? Is this even possible?
I explored "Docker secrets" but it seems that it's built for solving a different problem.
Here is a similar question without any answers: What is best way to secure secret keys with Docker in spring boot application
Some other references:
- I need to securely store a username and password in Python, what are my options?
- Securely storing passwords for use in python script
But these do not answer the question of decryption key management. Any high-level ideas and/or references are appreciated.