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

feat(dcap): make DCAP RA default #150

Merged
merged 102 commits into from
Sep 25, 2024
Merged

Conversation

dusterbloom
Copy link
Contributor

@dusterbloom dusterbloom commented Aug 5, 2024

Closes: #70

@dusterbloom dusterbloom self-assigned this Aug 5, 2024
@hu55a1n1 hu55a1n1 changed the title Making DCAP RA default // WIP feat(dcap): make DCAP RA default Aug 23, 2024
@hu55a1n1
Copy link
Member

The CosmWasm unittests are failing because the testdata is not updated for DCAP and still has hardcoded EPID attestations in tests.

@hu55a1n1 hu55a1n1 mentioned this pull request Aug 23, 2024
4 tasks
@hu55a1n1
Copy link
Member

hu55a1n1 commented Aug 23, 2024

Summary

See #70 (comment) for more details.

This PR allows a user to explicitly specify the FMSPC on the quartz enclave start CLI command. We pass this to the enclave via the gramine-manifest which is accessible to the enclave as a CLI arg. The CLI arg then uses the fmspc to construct the partial Collateral (i.e. collateral without TcbInfo).

What's in this PR

  • DCAP is now the default attestation type.
  • --fmspc arg added to app enclaves and quartz eclave start CLI cmd.
  • DCAP attestation generation with partial collateral. (see FIXMEs)

Next steps

  • Remove unsafe code
  • Resolve FIXMEs - related to collateral creation
  • Update test data with real DCAP attestations (perhaps by running on Zed)
  • Test on Zed/Azure
  • Clippy fixes

@hu55a1n1 hu55a1n1 marked this pull request as ready for review September 24, 2024 16:33
@hu55a1n1 hu55a1n1 requested review from dangush and amiller September 24, 2024 17:30
Copy link
Contributor

@dangush dangush left a comment

Choose a reason for hiding this comment

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

My comments are cosmetic things that can be addressed separately.

Congrats on getting this to the finish line!

Comment on lines +195 to +209
/// FMSPC (Family-Model-Stepping-Platform-Custom SKU); required if `MOCK_SGX` is not set
#[arg(long)]
#[serde(skip_serializing_if = "Option::is_none")]
pub fmspc: Option<Fmspc>,

/// Address of the TcbInfo contract
#[arg(long)]
#[serde(skip_serializing_if = "Option::is_none")]
pub tcbinfo_contract: Option<AccountId>,

/// Address of the DCAP verifier contract
#[arg(long)]
#[serde(skip_serializing_if = "Option::is_none")]
pub dcap_verifier_contract: Option<AccountId>,

Copy link
Contributor

Choose a reason for hiding this comment

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

not in this PR but we should move these into a separate struct that we flatten into whatever command needs them

Copy link
Member

Choose a reason for hiding this comment

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

"FMSPC is required if MOCK_SGX isn't set".to_string(),
));
};

Copy link
Contributor

Choose a reason for hiding this comment

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

Can this validation be moved into requests/enclave_start.rs?

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

I thought about putting this into impl TryFrom<EnclaveCommand> for Request, but the problem is that the validation depends on config.mock_sgx which isn't available in the TryFrom. Did you have something else in mind?

Copy link
Member

Choose a reason for hiding this comment

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

Opened #214 to track this.


use crate::error::Error;

#[derive(Debug)]
pub enum RelayMessage {
Instantiate,
Instantiate { init_msg: JsonValue },
Copy link
Contributor

Choose a reason for hiding this comment

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

Just curious behind the motivation for having a struct vs attaching data to the enum?

Copy link
Member

Choose a reason for hiding this comment

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

I think I prefer attaching data like this when the enum variant is not used elsewhere in code (as a separate type or if there isn't more validation for the inner type/fields, etc.). Not sure what's the best practice here. :)

@@ -22,6 +22,9 @@ loader.env.QUARTZ_PORT = { passthrough = true }

loader.argv = ["enclave",
"--chain-id", "testing",
"--fmspc", "{{ fmspc }}",
"--tcbinfo-contract", "{{ tcbinfo_contract }}",
Copy link
Contributor

Choose a reason for hiding this comment

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

we need to add node_url here according to #189 right? Could be a separate pr also

Copy link
Member

Choose a reason for hiding this comment

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

Right! This is being tracked in #211

@hu55a1n1
Copy link
Member

Will merge this now to unblock development and follow-up with Andrew regarding questions on handling security advisories, etc.

@hu55a1n1 hu55a1n1 merged commit 391b7bc into main Sep 25, 2024
7 checks passed
@hu55a1n1 hu55a1n1 deleted the dusterbloom/70-DCAP-as-default-RA-type branch September 25, 2024 19:14
@dangush
Copy link
Contributor

dangush commented Sep 25, 2024

bye bye 102 commit pr.. you will not be missed!

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.

Use DCAP as the default RA type
3 participants