tvm icon indicating copy to clipboard operation
tvm copied to clipboard

Security concern for private key in tvm repo

Open kevinthesun opened this issue 8 years ago • 10 comments

There is a private key stored in tvm repo:https://github.com/dmlc/tvm/blob/fdba6cc9bd3bec9ccd0592fa3900b7fe25d6cb97/apps/sgx/enclave_private.pem Do we have any potential security concern?Can we remove it?

kevinthesun avatar May 29 '18 17:05 kevinthesun

I think it is purely used for demo purposes to run SGX, cc @nhynes

tqchen avatar May 29 '18 22:05 tqchen

yep, it's for the SGX demo. It's not a security concern but it can't be removed otherwise the demo won't run.

nhynes avatar May 30 '18 00:05 nhynes

Is there a reason not to generate the key at the beginning and destroy it at the end?

mnuyens avatar Jun 01 '18 18:06 mnuyens

reason not to generate the key

No, but generating the key is non-trivial

nhynes avatar Jun 01 '18 19:06 nhynes

Leaving the key in the repo means that it will be flagged by many security tools, even if the key is not used for anything but the demo. I think the simplest fix would be move the demo into a separate repo for demos and examples, which would let TVM itself not be flagged, but not require the work to generate the key each. I think long term we should probably generate the key each time.

mnuyens avatar Jun 04 '18 18:06 mnuyens

If we just don't want any private key in TVM repo, a quick workaround might be create a gist to store the private key file.

kevinthesun avatar Jun 04 '18 18:06 kevinthesun

Hmm. I wonder if a fake key can be auto-generated from random bytes instead. I'll look into that

many security tools

Which ones, exactly? Do they check the file extension or do they look in the file, itself?

nhynes avatar Jun 04 '18 18:06 nhynes

In this case it was specifically an internally developed one and I assumed that others would flag it as well. And I believe it looks in the file itself, this part is also supposed to flag keys that are hard coded as well.

mnuyens avatar Jun 05 '18 17:06 mnuyens

This change is not enough to not have it flagged by the security tools as they are looking for any private keys hardcoded in the repo, and once the key is removed we should also rewrite the commit history to remove it there as well, otherwise it is still in the repo. Here is a link that details easy ways to do that. https://help.github.com/articles/removing-sensitive-data-from-a-repository/

mnuyens avatar Jun 15 '18 22:06 mnuyens

Rewriting history for a public repo is a no-go. I suggest that you whitelist TVM in your security checker. This should be relatively easier since your tool is developed in-house.

nhynes avatar Jun 15 '18 23:06 nhynes