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

Fix: Base64 encode Padding of Policy should be STANDARD #155

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading