# Environment Variable Security

**URL:** <https://forums.balena.io/t/environment-variable-security/700>\
**Category:** Product support\
**Created:** [March 27, 2017, 7:50pm UTC](https://forums.balena.io/t/environment-variable-security/700 "2017-03-27T19:50:32Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![rmoore](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/rmoore/32/317_2.png) [@rmoore](https://forums.balena.io/u/rmoore)\
**Post date:** [March 27, 2017, 7:50pm UTC](https://forums.balena.io/t/environment-variable-security/700/1 "2017-03-27T19:50:32Z")

</div>

I’m wondering how secure Environment Variables are generally speaking?

For example, Let’s say that I store a password in an Environment Variable…

- I assume the transmission of that Envt Variable to the Resin image is secure, correct?
- Once the variable hits the image, how is it stored, in memory or on the file system?
- If it’s on the file system, is it somehow encrypted on the file system?

Thanks

---

<div class="post-metadata">

**Author:** ![imrehg](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/imrehg/32/36_2.png) [@imrehg](https://forums.balena.io/u/imrehg)\
**Post date:** [March 27, 2017, 8:01pm UTC](https://forums.balena.io/t/environment-variable-security/700/2 "2017-03-27T20:01:51Z")

</div>

Hi @rmoore, great question!

1. the communication between the device and the [resin.io](http://resin.io) services is secured via standard secure web communication.
2. the variable is stored in the file system, so the supervisor can inject it into the user container whenever the container is started, and so that this can happen after reboots and without further access to the internet
3. on the file system they are not encrypted, as if they were, the system needs to be able to decrypt them without network, so the decryption key would need to be there, completely negating the encryption in the first place

Thus to protect the data within your environment variables, you need to have physical security for the device (i.e. making sure that others don’t have access to it for example to remove and clone the SD card).

We are evaluating other paths as well, for example using secure enclaves, such as TrustZone on ARM devices or TPM for platforms that have that, but it’s a tough nut.

You can also check out this other thread regarding secrets management:

> [@Enhancement request: secrets management](https://forums.balena.io/t/enhancement-request-secrets-management/587):
>
> Hey there! I’m currently using Hashicorp’s Vault to manage secrets for my Resin devices. While it’s pretty solid, I would love it if it were baked into Resin instead of having another component to manage. Docker just announced a feature for managing secrets… Is that something you see Resin doing in the future?

---

<div class="post-metadata">

**Author:** ![rmoore](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/rmoore/32/317_2.png) [@rmoore](https://forums.balena.io/u/rmoore)\
**Post date:** [March 27, 2017, 8:15pm UTC](https://forums.balena.io/t/environment-variable-security/700/3 "2017-03-27T20:15:35Z")

</div>

Thanks much for your quick response!

So if I understand correctly, since a hacker could (somehow) access the unencrypted file-system with physical access, there is currently no way to secure a password on a Resin image running on a Raspberry Pi, even if that Pi is modified to use EMMC rather than SD, correct?

---

<div class="post-metadata">

**Author:** ![imrehg](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/imrehg/32/36_2.png) [@imrehg](https://forums.balena.io/u/imrehg)\
**Post date:** [March 27, 2017, 8:33pm UTC](https://forums.balena.io/t/environment-variable-security/700/4 "2017-03-27T20:33:54Z")

</div>

eMMC (for example as it is the case for the BeagleBone line of devices already) would pose as a hurdle, but it would just make it more difficult, not impossible for bad actors to access the file system data.

Other setups have similar weaknesses, such as requiring internet access to decrypt some secret then used by the device - the device have to identify itself that it is authorized to get the decryption key - which authorization needs to be then kept safe from bad actors so they couldn’t replicate the authorization, thus back to square one.

Physical access in most security scenarios is considered “game over”, unfortunately. But there are still ideas to be explored and we are constantly looking at new solutions, to provide the best in class security within our service.

---

<div class="post-metadata">

**Author:** ![rmoore](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/rmoore/32/317_2.png) [@rmoore](https://forums.balena.io/u/rmoore)\
**Post date:** [March 27, 2017, 8:37pm UTC](https://forums.balena.io/t/environment-variable-security/700/5 "2017-03-27T20:37:22Z")

</div>

Out of curiosity, does the Resin support for Intel Nuc support any higher level of security?

---

<div class="post-metadata">

**Author:** ![imrehg](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/imrehg/32/36_2.png) [@imrehg](https://forums.balena.io/u/imrehg)\
**Post date:** [March 27, 2017, 8:41pm UTC](https://forums.balena.io/t/environment-variable-security/700/6 "2017-03-27T20:41:09Z")

</div>

Not at the moment, but I see that there are some ideas being developed internally to make use of the TPM for some way to secure and authenticate the system and updates. No concrete outcome of that yet.

What sort of use case do you have in mind, or what sort of scenario you are thinking to protect against?

---

<div class="post-metadata">

**Author:** ![rmoore](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/rmoore/32/317_2.png) [@rmoore](https://forums.balena.io/u/rmoore)\
**Post date:** [March 27, 2017, 8:58pm UTC](https://forums.balena.io/t/environment-variable-security/700/7 "2017-03-27T20:58:37Z")

</div>

At the end of the day, we just want to understand the security considerations 100% and what steps we can take to minimize them.

---

<div class="post-metadata">

**Author:** ![imrehg](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/imrehg/32/36_2.png) [@imrehg](https://forums.balena.io/u/imrehg)\
**Post date:** [March 27, 2017, 9:21pm UTC](https://forums.balena.io/t/environment-variable-security/700/8 "2017-03-27T21:21:19Z")

</div>

Got it! We have a security whitepaper coming out soon, that should answer a bunch of related issues, as far as I’ve seen. In the meantime please let us know if you have any questions whatsoever, we take security issues and concerns seriously!

---

<div class="post-metadata">

**Author:** ![rmoore](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/rmoore/32/317_2.png) [@rmoore](https://forums.balena.io/u/rmoore)\
**Post date:** [March 27, 2017, 11:48pm UTC](https://forums.balena.io/t/environment-variable-security/700/9 "2017-03-27T23:48:45Z")

</div>

Sounds great - if you remember, please update this thread when the whitepaper comes out so we can stay up to date.

Thanks!

---

<div class="post-metadata">

**Author:** ![bakerlisa510](https://avatars.discourse-cdn.com/v4/letter/b/3be4f8/32.png) [@bakerlisa510](https://forums.balena.io/u/bakerlisa510)\
**Post date:** [September 27, 2017, 5:37am UTC](https://forums.balena.io/t/environment-variable-security/700/10 "2017-09-27T05:37:09Z")

</div>

yeah you are right

---

<div class="post-metadata">

**Author:** ![MichaelR](https://avatars.discourse-cdn.com/v4/letter/m/6a8cbe/32.png) [@MichaelR](https://forums.balena.io/u/MichaelR)\
**Post date:** [October 18, 2017, 1:36pm UTC](https://forums.balena.io/t/environment-variable-security/700/11 "2017-10-18T13:36:07Z")

</div>

@imrehg what is the state of the security whitepaper? Thanks a lot!

---

<div class="post-metadata">

**Author:** ![willnewton](https://avatars.discourse-cdn.com/v4/letter/w/e9c0ed/32.png) [@willnewton](https://forums.balena.io/u/willnewton)\
**Post date:** [October 18, 2017, 2:20pm UTC](https://forums.balena.io/t/environment-variable-security/700/12 "2017-10-18T14:20:08Z")

</div>

The security whitepaper should be available in the next few weeks, its currently in the final round of reviews.

---

<div class="post-metadata">

**Author:** ![lekkas](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/lekkas/32/78_2.png) [@lekkas](https://forums.balena.io/u/lekkas)\
**Post date:** [May 11, 2018, 4:10pm UTC](https://forums.balena.io/t/environment-variable-security/700/13 "2018-05-11T16:10:00Z")

</div>

Hi [@everyone](https://forums.balena.io/groups/everyone) ,

Just a quick update to let you know that the security white-paper is available as a distinct section in our docs at [https://docs.resin.io/learn/welcome/security/](https://docs.resin.io/learn/welcome/security/).

This should address the most common questions, including environment variable security. If you have more questions, please let us know.

Thanks!
