update restricted shell to force (–no-kill) option.
Build and Deploy to K3s / test (push) Successful in 1m34s
Build and Deploy to K3s / lint (push) Successful in 58s
Build and Deploy to K3s / build-and-push (push) Successful in 2m3s
Build and Deploy to K3s / deploy (push) Successful in 8s

This commit is contained in:
jasonwitty
2026-08-24 07:33:43 -07:00
parent c540beba18
commit 15ace386e3
5 changed files with 76 additions and 21 deletions
+4 -4
View File
@@ -12,7 +12,7 @@ CYAN='\033[0;36m'
NC='\033[0m' # No Color
# History file
HISTFILE="/home/socktop/.socktop_history"
HISTFILE="${HOME:-/tmp}/.socktop_history"
HISTSIZE=1000
# Load history from file
@@ -135,7 +135,7 @@ main() {
# Allow socktop with validated arguments only
if [ "$cmd" = "$input" ]; then
# No arguments, use default (local profile)
/usr/bin/socktop -P local
/usr/bin/socktop --no-kill -P local
else
# Validate and sanitize arguments to prevent command injection
# Only allow: -P <profile_name> or ws://<url>
@@ -144,11 +144,11 @@ main() {
if [[ "$args" =~ ^-P[[:space:]]+[a-zA-Z0-9_-]+$ ]]; then
# Extract profile name and validate it
profile=$(echo "$args" | sed 's/-P[[:space:]]\+//')
/usr/bin/socktop -P "$profile"
/usr/bin/socktop --no-kill -P "$profile"
# Check for websocket URL (ws:// or wss://)
elif [[ "$args" =~ ^wss?://[a-zA-Z0-9\.\:/_-]+$ ]]; then
# Validate websocket URL format
/usr/bin/socktop "$args"
/usr/bin/socktop --no-kill "$args"
else
# Reject anything else as potentially dangerous
echo -e "${RED}Error:${NC} Invalid arguments for socktop"