question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Allow defining credentials from variable environment

See original GitHub issue

Description

It is not clear how one can best deploy Kedro with credentials for production. A good practice in traditional applications is to put sensitive credentials using environment variables.

In Kedro, it looks like it relies only on credentials.yml, located somewhere except in conf/local/ folder.

(PS: If I’m missing something with this, the problem is probably bad or missing documentation since I’m not able to find this information in the doc)

Context

Using environment variables will help standardize the deployment of Kedro like any app, thus reduces learning curve for developers.

Possible Implementation

Possible change could be to look for environment variables first, before looking for the content of credentials.yml. Changes will mainly be located in ConfigLoader class.

Possible Alternatives

I create credentials.yml file in config/base/ folder, because this folder ignored by Git, but is still packaged in the Kedro Docker. This is still not good because the credentials are now located in the Docker images repository: Anyone can pull that image and get prod credentials!


If this is an interesting implementation (which I think it is), I would be happy to contribute by implementing it. I first want to open the discussion about the best implementation given Kedro orientation, before making any pull request.

Regards,

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:2
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

3reactions
DmitriiDeriabinQBcommented, Jul 10, 2019

@htaidirt, thank you for your contribution. Please find some comments below.

It is not clear how one can best deploy Kedro with credentials for production.

Currently Kedro supports deploying credentials for production via configuration environments. Default project template contains 2 of them - conf/base is intended for storage of non-sensitive shareable configuration, and conf/local, where you can put sensitive credentials. conf/local is in .gitignore by default. Please find more information on how kedro configuration module works in this section of documentation.

I create credentials.yml file in config/base/ folder, because this folder ignored by Git, but is still packaged in the Kedro Docker. This is still not good because the credentials are now located in the Docker images repository: Anyone can pull that image and get prod credentials!

conf/base is indeed copied into Docker image, however, as documentation suggests, it is not intended to store any credentials. You should rather store your credentials in conf/local/credentials.yml, which is in .dockerignore by default.

Using environment variables will help standardize the deployment of Kedro like any app, thus reduces learning curve for developers.

Currently you can manually construct/enrich your credentials dictionary in src/<package_name>/run.py with any data, including one coming from the environment variables.

In long term we consider adding templating capability for kedro configs, which may, possibly, handle environment variables, however exact specification hasn’t been finalised yet.

2reactions
HugoPerriercommented, Jun 3, 2020

I posted my solution in How do I fill the credentials from environment variables #403

Thanks for the help

Read more comments on GitHub >

github_iconTop Results From Across the Web

Handling Passwords and Secret Keys using Environment ...
To set password or secret keys in environment variable on Linux(and Mac) you need to modify .bash_profile file that is in your home...
Read more >
Using credentials from environment variables - AWS SDK for ...
To authenticate to Amazon Web Services, the SDK first checks for credentials in your environment variables. The SDK uses the getenv() function to...
Read more >
Is it secure to store passwords as environment variables ...
Period. There's no way to store an un-encrypted password securely. Now which of environment variables vs. config files is more "secure" is perhaps...
Read more >
Allow defining credentials from variable environment · Issue #49
A good practice in traditional applications is to put sensitive credentials using environment variables. In Kedro, it looks like it relies only ...
Read more >
How to separate your credentials, secrets, and configurations ...
This article shows how to separate your credentials and configurations from the application source code with the environment variables and ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found