Add sandbox enforcement to mcptools scripts

This commit is contained in:
Levi Neely 2026-02-27 00:25:01 +01:00
parent 17ec56fbdd
commit f252aa9452
6 changed files with 32 additions and 0 deletions

View File

@ -182,6 +182,8 @@ func executeCode(code, language string, timeout int) (string, error) {
{"--rox", "/bin"},
{"--ro", "/etc/alternatives"},
{"--ro", "/etc/ld.so.cache"},
{"--rw", "/dev/null"},
{"--ro", "/dev/urandom"},
}
for _, sp := range systemPaths {

View File

@ -3,6 +3,12 @@
# description: Capture browser window showing a specific URL: capture_browser.sh [output_path] [url_pattern]
set -e
# Verify running under landrun (test filesystem restriction)
if cat /etc/passwd >/dev/null 2>&1; then
echo "Error: This script must be run via execute_code tool" >&2
exit 1
fi
OUTPUT="${1:-${TMPDIR:-/tmp}/browser_capture.png}"
URL_PATTERN="${2:-localhost}"

View File

@ -3,6 +3,12 @@
# description: List all active agent sessions (JSON array)
set -euo pipefail
# Verify running under landrun (test filesystem restriction)
if cat /etc/passwd >/dev/null 2>&1; then
echo "Error: This script must be run via execute_code tool" >&2
exit 1
fi
9p read agent/list | jq -Rs '
split("\n") | map(select(length > 0)) | map(
split("\t") | {

View File

@ -3,6 +3,12 @@
# description: List all available skills (JSON array)
set -euo pipefail
# Verify running under landrun (test filesystem restriction)
if cat /etc/passwd >/dev/null 2>&1; then
echo "Error: This script must be run via execute_code tool" >&2
exit 1
fi
if [ -z "${ANVILLM_SKILLS_PATH:-}" ]; then
echo "[]"
exit 0

View File

@ -3,6 +3,12 @@
# description: Read messages from agent inbox: AGENT_ID
set -euo pipefail
# Verify running under landrun (test filesystem restriction)
if cat /etc/passwd >/dev/null 2>&1; then
echo "Error: This script must be run via execute_code tool" >&2
exit 1
fi
agent_id="${1:?Usage: read_inbox <agent_id>}"
inbox_path="agent/${agent_id}/inbox"

View File

@ -3,6 +3,12 @@
# description: Send message to agent or user: FROM TO TYPE SUBJECT BODY
set -euo pipefail
# Verify running under landrun (test filesystem restriction)
if cat /etc/passwd >/dev/null 2>&1; then
echo "Error: This script must be run via execute_code tool" >&2
exit 1
fi
from="${1:?Usage: send_message <from> <to> <type> <subject> <body>}"
to="${2:?Usage: send_message <from> <to> <type> <subject> <body>}"
type="${3:?Usage: send_message <from> <to> <type> <subject> <body>}"