Skip to content

fix(mock-attestation): handle PCK collateral errors - #1017

Merged
kvinwang merged 1 commit into
masterfrom
fix/mock-attestation-pck-crl-error
Aug 6, 2026
Merged

fix(mock-attestation): handle PCK collateral errors#1017
kvinwang merged 1 commit into
masterfrom
fix/mock-attestation-pck-crl-error

Conversation

@kvinwang

@kvinwang kvinwang commented Aug 6, 2026

Copy link
Copy Markdown
Collaborator

Problem

The Rust checks workflow on master fails Clippy because the mock PCCS PCK CRL handler calls unwrap() while the workspace denies clippy::unwrap_used.

The panic is also inappropriate for an HTTP handler because collateral generation can fail.

Change

  • handle sample_collateral() failures explicitly
  • return HTTP 500 instead of panicking
  • reuse the successfully generated collateral when setting the issuer-chain header

Verification

  • cargo fmt --manifest-path dstack/Cargo.toml --all -- --check
  • cargo clippy --manifest-path dstack/Cargo.toml -p mock-attestation -- -D warnings -D clippy::expect_used -D clippy::unwrap_used --allow unused_variables
  • git diff --check

Copilot AI lite review requested due to automatic review settings August 6, 2026 01:32

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Ready to approve

The change is small, localized to one handler, and brings behavior in line with existing error-handling patterns in this file while addressing the Clippy failure.

This review doesn't count toward merge requirements. Sign up for the private preview to control whether Copilot approvals count.

Pull request overview

This PR updates the mock-attestation HTTP server to avoid unwrap() in the PCCS PCK CRL handler, aligning with the workspace’s Clippy clippy::unwrap_used denial and preventing panics in an HTTP request path.

Changes:

  • Handle tdx.sample_collateral() failure in the PCK CRL route and return HTTP 500 instead of panicking.
  • Reuse the generated collateral to populate the SGX-PCK-CRL-Issuer-Chain header (avoids regenerating collateral / second fallible call).
File summaries
File Description
dstack/crates/mock-attestation/src/server.rs Replaces unwrap() in the PCK CRL handler with explicit error handling and collateral reuse for the issuer-chain header.
Review details
  • Files reviewed: 1/1 changed files
  • Comments generated: 0
  • Review effort level: Lite

We're testing this review assessment. Please use 👍 or 👎 to tell us if it's correct.

@kvinwang
kvinwang merged commit c88969d into master Aug 6, 2026
16 checks passed
@kvinwang
kvinwang deleted the fix/mock-attestation-pck-crl-error branch August 7, 2026 13:47
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