Skip to content
This repository has been archived by the owner on May 2, 2023. It is now read-only.

Make enclave application build reproducibly. #57

Merged
merged 1 commit into from
Apr 18, 2023

Conversation

NullHypothesis
Copy link
Contributor

This commit makes the example application build reproducibly on different platforms, i.e., a build on Linux and macOS will result in an identical image. To accomplish this, the following was necessary:

  • Used new flags and environment variables to build the nitriding executable. The use of -ldflags="-s -w" reduces the binary size.

  • Don't use "apk add". Instead, use a python base image and take advantage of the built-in urllib.request module.

  • Add the flag "--custom-platform linux/amd64" to kaniko, which is necessary on non-Linux, non-amd64 platforms like macOS.

  • Revise the Dockerfile so that inconsistent file permissions on the host don't affect the Docker image.

Unrelated to the above, this commit also refactors the Makefile and adds a script that starts gvproxy.

example/service.py Show resolved Hide resolved
example/service.py Show resolved Hide resolved
This commit makes the example application build reproducibly on
different platforms, i.e., a build on Linux and macOS will result in an
identical image.  To accomplish this, the following was necessary:

* Used new flags and environment variables to build the nitriding
  executable.  The use of -ldflags="-s -w" reduces the binary size.

* Don't use "apk add".  Instead, use a python base image and take
  advantage of the built-in urllib.request module.

* Add the flag "--custom-platform linux/amd64" to kaniko, which is
  necessary on non-Linux, non-amd64 platforms like macOS.

* Revise the Dockerfile so that inconsistent file permissions on the
  host don't affect the Docker image.

Unrelated to the above, this commit also refactors the Makefile and adds
a script that starts gvproxy.
@bcaller bcaller removed their assignment Apr 11, 2023
@thypon thypon removed their assignment Apr 11, 2023
@NullHypothesis NullHypothesis requested a review from a team April 11, 2023 20:22
Copy link
Contributor

@rillian rillian left a comment

Choose a reason for hiding this comment

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

Thanks for tracking down the problem here!

COPY service.py /
COPY start.sh /
# Clone the repository and build the stand-alone nitriding executable.
RUN git clone https://github.com/brave/nitriding.git
Copy link
Contributor

Choose a reason for hiding this comment

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

Doesn't this make it harder to test local changes?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It does but I'm fine with that considering that this is just an example application.

import requests
import urllib.request
Copy link
Contributor

Choose a reason for hiding this comment

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

Using the standard library for a smaller footprint, good. The built-in client is ok for this minimal usage. from urllib.request import urlopen would be more idiomatic.

@NullHypothesis NullHypothesis merged commit cac319d into master Apr 18, 2023
@NullHypothesis NullHypothesis deleted the reproducible-example branch April 18, 2023 13:23
NullHypothesis pushed a commit that referenced this pull request Apr 21, 2023
Make enclave application build reproducibly.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants