Skip to content
This repository has been archived by the owner on Nov 21, 2023. It is now read-only.

Commit

Permalink
Fix: Base64 encode Padding of Policy should be STANDARD
Browse files Browse the repository at this point in the history
Signed-off-by: Jiale Zhang <[email protected]>
  • Loading branch information
jialez0 committed Oct 30, 2023
1 parent e050dd8 commit 7453851
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions attestation-service/src/policy_engine/opa/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ impl PolicyEngine for OPA {
bail!("OPA Policy Engine only support .rego policy");
}

let policy_bytes = base64::engine::general_purpose::URL_SAFE_NO_PAD
let policy_bytes = base64::engine::general_purpose::STANDARD
.decode(input.policy)
.map_err(|e| anyhow!("Base64 decode OPA policy string failed: {:?}", e))?;
let mut policy_file_path = PathBuf::from(
Expand Down Expand Up @@ -192,7 +192,7 @@ default allow = true"
let input = SetPolicyInput {
r#type: "rego".to_string(),
policy_id: "test".to_string(),
policy: base64::engine::general_purpose::URL_SAFE_NO_PAD.encode(policy),
policy: base64::engine::general_purpose::STANDARD.encode(policy),
};

assert!(opa.set_policy(input).await.is_ok());
Expand Down

0 comments on commit 7453851

Please sign in to comment.