Skip to content

Commit

Permalink
token: fix simple token broker
Browse files Browse the repository at this point in the history
Fix bug where wrong claims were added to the token.

Also, rename claims to flattened_claims to be slightly clearer.

Signed-off-by: Tobin Feldman-Fitzthum <tobin@ibm.com>
  • Loading branch information
fitzthum authored and mkulke committed Dec 4, 2024
1 parent d3fcebb commit c8bb601
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions attestation-service/src/token/simple.rs
Original file line number Diff line number Diff line change
Expand Up @@ -214,12 +214,12 @@ impl AttestationTokenBroker for SimpleAttestationTokenBroker {
reference_data_map: HashMap<String, Vec<String>>,
tee: Tee,
) -> Result<String> {
let claims = flatten_claims(tee, &tcb_claims)?;
let flattened_claims = flatten_claims(tee, &tcb_claims)?;
let reference_data = json!({
"reference": reference_data_map,
});
let reference_data = serde_json::to_string(&reference_data)?;
let tcb_claims = serde_json::to_string(&claims)?;
let tcb_claims = serde_json::to_string(&flattened_claims)?;

let mut policies = HashMap::new();
for policy_id in policy_ids {
Expand Down Expand Up @@ -298,7 +298,7 @@ impl AttestationTokenBroker for SimpleAttestationTokenBroker {
.to_owned(),
);

let claims_value = Value::Object(claims);
let claims_value = Value::Object(jwt_claims);
let claims_string = serde_json::to_string(&claims_value)?;
let claims_b64 = URL_SAFE_NO_PAD.encode(claims_string.as_bytes());

Expand Down

0 comments on commit c8bb601

Please sign in to comment.