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

Embedding two files with the same target directory #177

Closed
djav35 opened this issue Oct 5, 2022 · 2 comments · Fixed by #178
Closed

Embedding two files with the same target directory #177

djav35 opened this issue Oct 5, 2022 · 2 comments · Fixed by #178
Assignees

Comments

@djav35
Copy link

djav35 commented Oct 5, 2022

Issue description

I am trying to embed two different files into the enclave. If their target path within the enclave share the same directory it throws an error when trying to run the executable.

To reproduce

Steps to reproduce the behavior:

  1. Configure enclave.json:
{
 "exe": "tags",
 "key": "private.pem",
 "debug": true,
 "heapSize": 512,
 "executableHeap": false,
 "productID": 1,
 "securityVersion": 1,
 "mounts": null,
 "env": null,
 "files": [
         {
            "source": "secret.txt",
            "target": "testdir/secret.txt"
        },
        {
            "source": "secret2.txt",
            "target": "testdir/secret2.txt"
        }
 ]
}
  1. Build, sign and run the program.
  2. Error:
EGo v1.0.1 (e1e48c9dbfdfd3cb2f2fda7602729162c9f762cc)
[erthost] loading enclave ...
[erthost] entering enclave ...
panic: mkdir testdir: file exists

goroutine 17 [running, locked to thread]:
main.ert_ego_premain(0x7fbbc14c6448, 0x7fbbc14c6440, 0xd408c000?, 0x0?, 0x1?)
        ego/premain/main.go:31 +0x1e5

Additional info

From the error it seems like it is not checking whether the path already exists within the enclave before using mkdir.

@Nirusu
Copy link
Contributor

Nirusu commented Oct 6, 2022

Hey there,

Thanks for reporting the issue. It actually turns out to be a bug by us not setting any specific permissions for the directories created for the embedded files and how the underlying in-memory filesystem handles this case.

I opened a PR to fix this issue. Should likely be fixed in the next release of EGo then.

@thomasten
Copy link
Member

fixed in v1.1.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants