From 3b37e3451b54737f944fd9e94d484d181bb899b6 Mon Sep 17 00:00:00 2001 From: kasun Date: Sun, 6 Dec 2026 02:52:11 +0100 Subject: [PATCH] enhancement(k8s-bootstrap): fail CI key removal when the key is not found The final check only verified that the key was absent afterwards, which also passes when the key was never matched, e.g. a hand-added key with a comment. Requiring the key beforehand makes that case fail visibly. --- 02-k8s-bootstrap/index.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/02-k8s-bootstrap/index.ts b/02-k8s-bootstrap/index.ts index 9cd3f28..eb9ff21 100644 --- a/02-k8s-bootstrap/index.ts +++ b/02-k8s-bootstrap/index.ts @@ -472,6 +472,7 @@ const revokeCiKeyScript = `set -euo pipefail IFS= read -r KEY || true [ -n "$KEY" ] f="$HOME/.ssh/authorized_keys" +grep -qxF -- "$KEY" "$f" grep -vxF -- "$KEY" "$f" > "$f.new" || [ $? -eq 1 ] [ -s "$f.new" ] chmod 600 "$f.new"