Skip to content

Commit 743dbc9

Browse files
committed
fix(verifier): remove pccs_url from public API to prevent SSRF
Remove the pccs_url parameter from the VerificationRequest struct to prevent potential SSRF attacks where a malicious client could specify an arbitrary URL. The PCCS URL is now only configurable via the server configuration file. Changes: - Remove pccs_url field from VerificationRequest in types.rs - Add pccs_url to CvmVerifier struct instead of passing per-request - Update all CvmVerifier::new() calls to pass pccs_url from config - Update README to reflect the configuration-only approach
1 parent 3f8f6d3 commit 743dbc9

5 files changed

Lines changed: 15 additions & 9 deletions

File tree

kms/src/main_service.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ impl KmsState {
6969
config.image.cache_dir.display().to_string(),
7070
config.image.download_url.clone(),
7171
config.image.download_timeout,
72+
config.pccs_url.clone(),
7273
);
7374
Ok(Self {
7475
inner: Arc::new(KmsStateInner {

verifier/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ You usually don't need to edit the config file. Just using the default is fine,
7878
- `image_cache_dir`: Directory for cached OS images (default: "/tmp/dstack-verifier/cache")
7979
- `image_download_url`: URL template for downloading OS images (default: dstack official releases URL)
8080
- `image_download_timeout_secs`: Download timeout in seconds (default: 300)
81-
- `pccs_url`: Optional PCCS URL for quote verification
81+
- `pccs_url`: PCCS URL for quote verification (default: uses Intel's public PCCS)
8282

8383
### Example Configuration File
8484

@@ -88,7 +88,7 @@ port = 8080
8888
image_cache_dir = "/tmp/dstack-verifier/cache"
8989
image_download_url = "https://download.dstack.org/os-images/mr_{OS_IMAGE_HASH}.tar.gz"
9090
image_download_timeout_secs = 300
91-
pccs_url = "https://pccs.phala.network"
91+
# pccs_url = "https://pccs.phala.network"
9292
```
9393

9494
## Usage

verifier/src/main.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,17 +85,15 @@ async fn run_oneshot(file_path: &str, config: &Config) -> anyhow::Result<()> {
8585
.map_err(|e| anyhow::anyhow!("Failed to read file {}: {}", file_path, e))?;
8686

8787
// Parse as VerificationRequest
88-
let mut request: VerificationRequest = serde_json::from_str(&content)
88+
let request: VerificationRequest = serde_json::from_str(&content)
8989
.map_err(|e| anyhow::anyhow!("Failed to parse JSON: {}", e))?;
9090

91-
// Ensure PCCS URL is populated from config when the report omits it
92-
request.pccs_url = request.pccs_url.or_else(|| config.pccs_url.clone());
93-
9491
// Create verifier
9592
let verifier = CvmVerifier::new(
9693
config.image_cache_dir.clone(),
9794
config.image_download_url.clone(),
9895
std::time::Duration::from_secs(config.image_download_timeout_secs),
96+
config.pccs_url.clone(),
9997
);
10098

10199
// Run verification
@@ -187,6 +185,7 @@ async fn main() -> Result<()> {
187185
config.image_cache_dir.clone(),
188186
config.image_download_url.clone(),
189187
std::time::Duration::from_secs(config.image_download_timeout_secs),
188+
config.pccs_url.clone(),
190189
));
191190

192191
rocket::custom(figment)

verifier/src/types.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ pub struct VerificationRequest {
1515
pub vm_config: Option<String>,
1616
#[serde(with = "serde_bytes")]
1717
pub attestation: Option<Vec<u8>>,
18-
pub pccs_url: Option<String>,
1918
pub debug: Option<bool>,
2019
}
2120

verifier/src/verification.rs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,14 +137,21 @@ pub struct CvmVerifier {
137137
pub image_cache_dir: String,
138138
pub download_url: String,
139139
pub download_timeout: Duration,
140+
pub pccs_url: Option<String>,
140141
}
141142

142143
impl CvmVerifier {
143-
pub fn new(image_cache_dir: String, download_url: String, download_timeout: Duration) -> Self {
144+
pub fn new(
145+
image_cache_dir: String,
146+
download_url: String,
147+
download_timeout: Duration,
148+
pccs_url: Option<String>,
149+
) -> Self {
144150
Self {
145151
image_cache_dir,
146152
download_url,
147153
download_timeout,
154+
pccs_url,
148155
}
149156
}
150157

@@ -408,7 +415,7 @@ impl CvmVerifier {
408415

409416
let attestation = attestation.into_inner();
410417
let debug = request.debug.unwrap_or(false);
411-
let verified = attestation.verify(request.pccs_url.as_deref()).await;
418+
let verified = attestation.verify(self.pccs_url.as_deref()).await;
412419
let verified_attestation = match verified {
413420
Ok(att) => {
414421
details.quote_verified = true;

0 commit comments

Comments
 (0)