mystikos icon indicating copy to clipboard operation
mystikos copied to clipboard

Environment variables from host should be disabled by default

Open jxyang opened this issue 3 years ago • 4 comments

In the document it says:

HostEnvironmentVariables | A list of environment variables that can be imported from the insecure host

Without an explicit entry in config.json that's measured, we shouldn't rely on any environment variable from the untrusted host, even though that's convenient.

The proper way here is to create a config.json and put these two variables in there and run myst with --app-config-path

jxyang avatar Jul 08 '21 16:07 jxyang

I assume that in the release mode (packaged app), if the config.json file does not contain a "HostEnvironmentVariables" entry, any environment variable provided through the app execution command line will be ignored. @paulcallen, can you confirm?

bodzhang avatar Jul 09 '21 12:07 bodzhang

Because the application could use host environment variables in unpredicted ways, allowing the enclave to take dependency on a host environment variable is against the fundamental idea that the enclave should be an isolated execution environment. Much like containers allow application to access only environment variables specified with ENV.

jxyang avatar Jul 09 '21 16:07 jxyang

@jxyang , doo you mean with packaged mode, the host environment variables are still exposed to the Mystikos environment in the Enclave?

bodzhang avatar Jul 09 '21 18:07 bodzhang

by default with target=sgx, no environment variables are inherited from the host. When we are not signing and packaging we may not have a config.json with an allow list and so we have no config when we get into the enclave and with that all environments variables are used.
We should have a consistent story without the config.json file, which also is required for linux target

paulcallen avatar Jul 12 '21 20:07 paulcallen