Skip to content

go/runtime/host: Improve common.GetQuotePolicy function#6531

Open
martintomazic wants to merge 2 commits into
masterfrom
martin/trivial/simplify-get-quote-policy
Open

go/runtime/host: Improve common.GetQuotePolicy function#6531
martintomazic wants to merge 2 commits into
masterfrom
martin/trivial/simplify-get-quote-policy

Conversation

@martintomazic
Copy link
Copy Markdown
Contributor

Trivial, semantics should be preserved.

Tackles #6474 (comment).

For now only Next step:1 is implemented.

Also open to implementing Next step:2 here, to avoid scope creeping key manager access policy PR. Not 100% convinced about this direction though (feels better but more complex).

@netlify
Copy link
Copy Markdown

netlify Bot commented May 21, 2026

Deploy Preview for oasisprotocol-oasis-core canceled.

Name Link
🔨 Latest commit b7140f0
🔍 Latest deploy log https://app.netlify.com/projects/oasisprotocol-oasis-core/deploys/6a1064dbe0412a0008c1c4d3


// Prepare the quote policy for local verification. In case a policy is not available or it
// indicates that TDX is not supported, use the fallback policy so we can provision something.
// Use the fallback policy for ROFL components and RONL components with no TDX policy so that provisioning can proceed.
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

RONL components with no TDX policy

Or RONL policy with no deployments for given version. RONL tdx is anyways not supported (for now), still raises a question why even pass such things as runtime verifier inside the enclave would then reject anyways.

For ROFL we currently pass because we don't do pre-validation on the host side, and nil tdx policy is not valid (no default override like we have for the nil sgx).

@martintomazic martintomazic marked this pull request as ready for review May 21, 2026 10:35
@martintomazic martintomazic force-pushed the martin/trivial/simplify-get-quote-policy branch from d85eb0c to b7140f0 Compare May 22, 2026 14:14
@martintomazic martintomazic self-assigned this May 26, 2026
// GetRONLQuotePolicy fetches the quote policy for the specified RONL deployment.
//
// Returns nil if the policy is not available.
func GetRONLQuotePolicy(
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I would rename this back to GetQuotePolicy as the parameter runtimeID already says that this is for RONL only. But what I really wanted in that comment is to get rid of the parameter cs, by creating a struct like QuotePolicyProvider (or something better) and calling provider.Get(ctx, runtimeID, version).

var pcsQuotePolicy *pcs.QuotePolicy
if quotePolicy != nil {
pcsQuotePolicy = quotePolicy.PCS
if ec.cfg.Component.Kind == component.RONL {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I would replace all these ifs with switch for better readability, and in the default section add a comment // No policy.

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.

2 participants