From 80a38782959b59287c94bbd9d8657b4bb561c002 Mon Sep 17 00:00:00 2001 From: Pallav Vasa Date: Sat, 17 May 2025 02:42:56 +0000 Subject: [PATCH] fix: check for scp early to avoid shell ouput --- gitops_router.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/gitops_router.sh b/gitops_router.sh index 3471452..a21250e 100644 --- a/gitops_router.sh +++ b/gitops_router.sh @@ -20,6 +20,11 @@ log() { log info "Received SSH_ORIGINAL_COMMAND: $SSH_ORIGINAL_COMMAND" +if [[ "${SSH_ORIGINAL_COMMAND:-}" == "scp -t $ALLOWED_PATH" ]]; then + eval "$SSH_ORIGINAL_COMMAND" + exit +fi + # Ensure the variable is set if [[ -z "${SSH_ORIGINAL_COMMAND:-}" ]]; then log error "No SSH_ORIGINAL_COMMAND provided." @@ -88,8 +93,7 @@ status) podman images ;; scp) - log info "Accepting scp upload to $ALLOWED_PATH" - [[ "${args}" == "-t $ALLOWED_PATH" ]] && eval "$SSH_ORIGINAL_COMMAND" || log error "Invalid scp upload path: $args" + log error "Invalid scp upload path: $args" ;; *) log error "Unknown command: $command"