ImportKeyPair bug fix on URL encode base64 encoding

This commit is contained in:
Ben Duncan
2025-11-15 17:58:27 +08:00
parent f8d469220d
commit 42b3ba7fa1
2 changed files with 9 additions and 1 deletions
+7
View File
@@ -2,6 +2,7 @@ package gateway
import (
"errors"
"strings"
"github.com/aws/aws-sdk-go/service/ec2"
"github.com/gofiber/fiber/v2"
@@ -208,6 +209,12 @@ func (gw *GatewayConfig) EC2_Request(ctx *fiber.Ctx) error {
case "ImportKeyPair":
var input = &ec2.ImportKeyPairInput{}
// Bug in parser, end of Base64 is URL encoded
if strings.HasSuffix(queryArgs["PublicKeyMaterial"], "%3D%3D") {
queryArgs["PublicKeyMaterial"] = strings.Replace(queryArgs["PublicKeyMaterial"], "%3D%3D", "==", 1)
}
err = awsec2query.QueryParamsToStruct(queryArgs, input)
if err != nil {
+2 -1
View File
@@ -241,7 +241,8 @@ echo "📊 Monitor background service logs:"
echo " tail -f $LOGS_DIR/*.log"
echo ""
echo "🧪 Test with AWS CLI (once daemon is running):"
echo " aws --endpoint-url https://localhost:9999 --no-verify-ssl ec2 describe-instances"
echo " export AWS_PROFILE=hive"
echo " aws ec2 describe-instances"
echo ""
# This will only be reached if air/daemon exits normally