18.11 Manage Credentials and Sensitive Fields

An approach for handling sensitive data in code (for example, passwords) is provided below.

Tip:

The approach is provided with emphasis on secure development practices to follow during development. It doesn’t mandate a specific tool or technology.

Implementing Custom SecretUtility class

from datatransforms.secrets_util import SecretsStore

class MySecretManager(SecretsStore):

    ....
    #implement the password fetch/store contracts
    #if the custom class allows ONLY fetch passwords,
    #have exception thrown for store

This will be the default password manager for the modules while creating connections.

Connection con = Connection()
#fetches the password from the secret store implementation
con.set_password(MySecretManager().getPass("MyconnectionID"))