-
Notifications
You must be signed in to change notification settings - Fork 76
feat(proving-service): add attestation verification #969
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
base: next
Are you sure you want to change the base?
Conversation
Curious why the diff is so large yet so few things have been added. Most apparently in the cargo.lock. |
@phklive the cargo.lock is indeed the reason for the large diff, this is due to adding attestation-rs (lunal's attestation crate) as a dependency. the actual code diffs are 13 lines. |
Part of the problem is that there are a lot of different dep versions e.g. this PR adds a 2nd hyper/http etc with different version to the one we have. I haven't looked into it much deeper beyond skimming the lockfile diff. |
Thank you very much for the awesome work! Being able to do delegated proving inside a TEE is a really cool feature, and I think it would be a great value add. I haven't looked through everything in detail yet, but I do have a question: how does the user know that their request is going to a TEE? My understanding is that the attestation in the response header proves that the proof was generated in a TEE, but how the user can be sure that the encrypted request went directly to a TEE w/o someone in the middle having seen it? That is, what currently prevents the following scenario:
Would the user be able to tell in this scenario that the remote prover (in step 2) was able to see the request in plaintext? |
Great question @bobbinth! To provide some background, there is a lunal proxy that runs inside every TEE. That proxy is used to establish a TLS session with any client communicating with the TEE to prevent a man in the middle attack. TLS ensures that user data is encrypted while it's being transmitted to the TEE. Since TLS terminates inside the TEE, the data is only decrypted inside the TEE where it is protected by the TEE boundary from any external party. The attestation report also includes a nonce generated by the verification client in order to prevent replay attacks for attestation verification. With that in mind, based on our discussions with the Miden team, Miden currently runs the delegate/remote prover as one big instance. Therefore, our current setup assumes that the client communicates directly with a remote prover running inside the TEE directly without intermediate parties. In that setup the flow is:
In the scenario you described where there is a remote prover proxy running independently that directs requests to multiple TEEs, there are options there to ensure that the user is always talking to a TEE:
We support both options if required. For now, if the delegated prover is running as a single instance, the current setup suffices for that and we can switch to another setup if required later on. Hope that answers your question! |
Overview
This PR adds Trusted Execution Environment (TEE) attestation report verification from Lunal's TEEs to proving service clients. This implementation came from @phklive's request to demonstrate an end-to-end flow for confidential delegated proving. With this PR, clients can verify that their delegated prover was run inside a TEE and thus preserved the input and processing privacy of their request.
Note: We tested this end-to-end on versions 0.9.0 of the miden client and the miden prover proxy. The reason behind using these versions is for compatibility with the Miden Testnet.
Implementation Details
Changes
Attestation Verification Integration
Attestation-Report
HTTP response header from TEE-enabled delegated provers.New Dependencies
Architecture
Attestation-Report
HTTP response header.Backwards Compatibility
Attestation-Report
HTTP response header? → Verify the attestation.Attestation-Report
response header or no attestation report in theAttestation-Report
response headers? → Proceed without verification (legacy behavior).Lunal Proxy Service
Every Lunal machine comes with a proxy service pre-installed in the
~/lunal
folder. This proxy acts as the bridge between external clients and the Miden proving service running inside the TEE, handling attestation report generation and response headers.Running the Proxy
Basic Usage
Parameters
--host
: The external hostname that the proxy will serve (e.g.,miden-prover.lunal.dev
)--upstream
: The local Miden service URL to proxy requests to (e.g.,http://127.0.0.1:8082
)Example
Running as a Background Process
For production use, you'll want to run the proxy as a background process. There are several options like systemd, screen, tmux, or process managers. Here's an example using the
daemon
tool:You can also use other process managers like systemd, supervisor, or simply run it in a screen/tmux session depending on your preference.
Testing Changes
To test:
Spin up a delegated prover inside a TEE (this can be provided by Lunal folks). This will have an endpoint (e.g
https://miden-prover.lunal.dev/
)Start the Lunal proxy service on the TEE machine using the instructions above
Initialize a local miden client (https://github.com/0xMiden/miden-client)
In the
miden-client.toml
, set theremote_rpc_endpoint
to the delegated prover url:Migration Strategy
Phase 1: Parallel Deployment
Phase 2: Testing & Validation
Phase 3: Transition (Optional)