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

AB#2432: Check for unsupported eclient import #172

Merged
merged 3 commits into from
Sep 22, 2022

Conversation

Nirusu
Copy link
Contributor

@Nirusu Nirusu commented Sep 20, 2022

Proposed changes

  • Check based on ELF sections whether github.com/edgelesssys/ego/eclient was imported on sign or run
  • Redirect user to github.com/edgelesssys/ego/enclave instead
  • Move some other ELF functions both used by sign.go & bundle.go to elf.go & elf_test.go

The unit test is a bit heavy since it needs a go.mod & go.sum to function. Not sure whether we want to keep it as is or if there is a sleeker way.

Related issue

@Nirusu Nirusu changed the title AB#2432: Check for unsupported import eclient import AB#2432: Check for unsupported eclient import Sep 20, 2022
@Nirusu Nirusu force-pushed the feat/unsupported-import-detection branch 2 times, most recently from da657d6 to a3cf018 Compare September 20, 2022 13:04
ego/cli/elf.go Show resolved Hide resolved
ego/cli/elf.go Outdated Show resolved Hide resolved
ego/cli/run.go Outdated Show resolved Hide resolved
ego/cli/sign.go Outdated Show resolved Hide resolved
ego/cli/elf_test.go Outdated Show resolved Hide resolved
@Nirusu Nirusu force-pushed the feat/unsupported-import-detection branch from cb873c9 to 0b1bb9d Compare September 21, 2022 16:14
@Nirusu
Copy link
Contributor Author

Nirusu commented Sep 21, 2022

Moved it from unit tests to integration tests.
However, my bash foo is not quite there to show the executed command with the pipe in there.

I would expect to show this in the output:
run test: ego sign unsupported-import |& grep "unsupported import"

But it's dropped. Any idea how to do handle this properly in bash?

Copy link
Member

@thomasten thomasten left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd guess that it cannot be done with our run function. But I'm not a bash expert either, so this is not a definite answer.
However, the test itself works and the output is meaningful enough for me.

@Nirusu Nirusu force-pushed the feat/unsupported-import-detection branch from a00a718 to 9a17f03 Compare September 22, 2022 08:26
@Nirusu
Copy link
Contributor Author

Nirusu commented Sep 22, 2022

Okay, I'll just keep it this way then.

I also had the idea that since we already have custom Open Enclave / Edgeless RT error handling for more user friendly error handling that we can also put everything in the same function handleErr(err). This should make everything a bit cleaner in terms of code and more consistent in terms of user output.

Only thing I am not super happy is that the

if err != nil {
   return err
}
return nil

block in sign.go is kinda pointless, but changing it to just

return err

is inconsistent with the other functions, even though it effectively also returns nil in case no error occurred.

Not sure what is the cleaner way here.

@thomasten
Copy link
Member

LGTM. I have a slight preference for return err, but please do as you prefer.

@Nirusu
Copy link
Contributor Author

Nirusu commented Sep 22, 2022

I'll make it return err with a small comment next to it (in case it's not obvious).

@Nirusu Nirusu force-pushed the feat/unsupported-import-detection branch from 99c593c to f5a5024 Compare September 22, 2022 09:03
@Nirusu Nirusu merged commit a0aabbd into master Sep 22, 2022
@Nirusu Nirusu deleted the feat/unsupported-import-detection branch September 22, 2022 09:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants