From fa8f725704a03629e02207d783c1ed850c03ecb8 Mon Sep 17 00:00:00 2001 From: Haili Hu Date: Wed, 29 Jan 2025 14:54:36 +0100 Subject: [PATCH] Strip null byte in token to avoid warnings --- ada/ada | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ada/ada b/ada/ada index 9dbf110..7713cd3 100755 --- a/ada/ada +++ b/ada/ada @@ -652,7 +652,7 @@ view_token() { echo "$payload" | jq '. | .exp |= todate | .nbf |= todate | .iat |= todate' else # Not an OIDC token; probably a Macaroon - macaroon_decoded=$(echo "$token" | base64 -d 2>/dev/null | awk '{print substr($0, 5)}' 2>/dev/null) + macaroon_decoded=$(echo "$token" | base64 -d 2>/dev/null | awk '{print substr($0, 5)}' 2>/dev/null | tr -d '\0') # Check if decoding succeeded if [ -z "$macaroon_decoded" ]; then @@ -716,7 +716,7 @@ check_token() { # Macaroon Token (assume it's base64 encoded) $debug && echo "Checking Macaroon token..." - macaroon_decoded=$(echo "$token" | base64 -d 2>/dev/null | awk '{print substr($0, 5)}' 2>/dev/null) + macaroon_decoded=$(echo "$token" | base64 -d 2>/dev/null | awk '{print substr($0, 5)}' 2>/dev/null | tr -d '\0') # Check if decoding succeeded if [ -z "$macaroon_decoded" ]; then