Skip to content

pcsclient: qeidentity and tdqeidentity are double-encoded as JSON strings in the output JSON #497

Description

@mythi

In pcsclient.py _fetch_identity(), the raw HTTP response body (a JSON string) is
assigned directly to the output dict:

    self.output_json["collaterals"][f"{identity_type}identity{key_suffix}"] = identity[0]

When the output dict is serialised with json.dumps(), the string is escaped and
written as a JSON string value instead of a nested object. Consumers reading the
file see e.g.:

"qeidentity": "{\"enclaveIdentity\":{...},\"signature\":\"...\"}"

instead of the expected:

"qeidentity": {"enclaveIdentity": {...}, "signature": "..."}

Fix: parse identity[0] before storing it:

    self.output_json["collaterals"][f"{identity_type}identity{key_suffix}"] = json.loads(identity[0])

The same issue affects tdqeidentity, qveidentity, and their _early variants.
tcbinfos entries are not affected as those are already stored as dicts.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions