In the book Programming Grails, Burt Beckwith gives some really good insights about how to develop Grails applications which follows OWASP Top 10 recommendations in chapter 9.
Punctually,I'm trying to implement the recommendation for Insecure Cryptographic Store. That reads as follows
Do not store passwords in config files, or even in files on the filesystem. Instead, create a web page that you use to initialize the system where people trusted with passwords enter the passwords (using SSL!) when the application starts up. Ideally, you shouldn’t trust any one person with all of the information to start the system. For example, to use JCE encryption, you will need to load a java.security.KeyStore , and this requires a password, and you use this to create a javax.crypto.SecretKey , which also requires a password. Use different passwords. If two people know the key store password and two other people know the key password (it’s a good idea to have backup users in case someone isn’t available), then no one person can decrypt the data or be coerced into giving someone else access.
I want to secure the Amazon AWS[1] Access Credentials that will be used by the application in order to use the KMS[2] API call to secure encrypt and decrypt information.
I would like and example about how this can be achieved. My initial idea is to use a Service in the Singleton scope which holds the credentials and those credentials are setted by a Controller which is responsible of loading the KeyStore and the SecretKey used to decrypt a previusly encrypted and store AWS Access Credentials.