Skip to content

Commit a072769

Browse files
Use a hard-coded string for virtual measurement (#6802)
Co-authored-by: Amaury Chamayou <amchamay@microsoft.com>
1 parent efcab26 commit a072769

3 files changed

Lines changed: 3 additions & 11 deletions

File tree

src/pal/quote_generation.h

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
#pragma once
44

55
#include "ds/files.h"
6-
#include "ds/system.h"
76

87
#include <nlohmann/json.hpp>
98
#include <string>
@@ -23,13 +22,7 @@ namespace ccf::pal
2322

2423
auto j = nlohmann::json::object();
2524

26-
const auto uname = ccf::ds::system::exec("uname -a");
27-
if (!uname.has_value())
28-
{
29-
throw std::runtime_error("Error calling uname");
30-
}
31-
32-
j["measurement"] = uname.value();
25+
j["measurement"] = "Insecure hard-coded virtual measurement v1";
3326
j["host_data"] = package_hash.hex_str();
3427

3528
files::dump(j.dump(2), virtual_attestation_path("measurement"));

tests/code_update.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ def test_verify_quotes(network, args):
5151
j = r.body.json()
5252
if j["format"] == "Insecure_Virtual":
5353
# A virtual attestation makes 3 claims:
54-
# - The measurement (same on many nodes) is the result of calling `uname -a`
54+
# - The measurement (same on any virtual node) is a hard-coded string, currently unmodifiable
5555
claimed_measurement = j["measurement"]
5656
# For consistency with other platforms, this endpoint always returns a hex-string.
5757
# But for virtual, it's encoding some ASCII string, not a digest, so decode it for readability

tests/infra/utils.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@
88

99
def get_measurement(enclave_type, enclave_platform, package, library_dir="."):
1010
if enclave_platform == "virtual":
11-
result = infra.proc.ccall("uname", "-a")
12-
return result.stdout.decode().strip()
11+
return "Insecure hard-coded virtual measurement v1"
1312

1413
else:
1514
raise ValueError(f"Cannot get measurement on {enclave_platform}")

0 commit comments

Comments
 (0)