Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HAL-04 sensitive information in environment variables #3255

Open
juniuszhou opened this issue Sep 18, 2022 · 2 comments
Open

HAL-04 sensitive information in environment variables #3255

juniuszhou opened this issue Sep 18, 2022 · 2 comments
Assignees
Labels
Peggy Team Peggy team task

Comments

@juniuszhou
Copy link
Contributor

juniuszhou commented Sep 18, 2022

Description

When you store your secret keys in an environment variable, you are prone to accidentally exposing them. Given that the environment is implicitly available to the process, it’s hard, if not impossible, to track access and how the contents get exposed.

Environment variables can be exposed in a variety of scenarios and are therefore an inappropriate location for extremely sensitive information. For example, it’s common to have applications grab the whole environment and print it out for debugging or error reporting. Environment variables are passed down to child processes and can be leaked as a result. This breaks the principle of least privilege. Imagine that as part of your application, you call to a third-party tool to perform some action.all of a sudden that third-party tool has access to your environment. When applications crash, it’s common for them to store the environment variables in log-files for later debugging. This means plain-text secrets can be stored on disk.

code location

Listing 6: cmd/ebrelayer/txs/signature.go
21 func LoadPrivateKey() (key *ecdsa.PrivateKey, err error ) {
22 // Private key for validator 's Ethereum address must be set as an environment variable
23 rawPrivateKey := os.Getenv("ETHEREUM_PRIVATE_KEY")

Recommendation

Use an external key manager to store and transmit secrets.

@juniuszhou juniuszhou added the Peggy Team Peggy team task label Sep 18, 2022
@juniuszhou juniuszhou self-assigned this Sep 18, 2022
@juniuszhou
Copy link
Contributor Author

please @Brando753 assess the proposal if we need external key manager.

@juniuszhou juniuszhou assigned Brando753 and unassigned juniuszhou Sep 26, 2022
@Brando753
Copy link
Contributor

In general, storing secrets in env variables is a bad idea, using a secret manager is a better solution. This will require cross-team work between chainops, sifnode, and peggy. I suggest we put this off until after Peggy 2.0 launches and then come back to it as its something we should improve.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Peggy Team Peggy team task
Projects
None yet
Development

No branches or pull requests

2 participants