diff --git a/cmd/anvilmcp/execute.go b/cmd/anvilmcp/execute.go index ba55fcf..93aedb3 100644 --- a/cmd/anvilmcp/execute.go +++ b/cmd/anvilmcp/execute.go @@ -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 { diff --git a/mcptools/capture_browser.sh b/mcptools/capture_browser.sh index 2b4d979..f91c172 100755 --- a/mcptools/capture_browser.sh +++ b/mcptools/capture_browser.sh @@ -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}" diff --git a/mcptools/list_sessions.sh b/mcptools/list_sessions.sh index 9db1869..afbc72d 100755 --- a/mcptools/list_sessions.sh +++ b/mcptools/list_sessions.sh @@ -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") | { diff --git a/mcptools/list_skills.sh b/mcptools/list_skills.sh index bb3778a..0462eeb 100755 --- a/mcptools/list_skills.sh +++ b/mcptools/list_skills.sh @@ -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 diff --git a/mcptools/read_inbox.sh b/mcptools/read_inbox.sh index 082f832..469bc2b 100755 --- a/mcptools/read_inbox.sh +++ b/mcptools/read_inbox.sh @@ -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 }" inbox_path="agent/${agent_id}/inbox" diff --git a/mcptools/send_message.sh b/mcptools/send_message.sh index d4889cf..4919a00 100755 --- a/mcptools/send_message.sh +++ b/mcptools/send_message.sh @@ -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 }" to="${2:?Usage: send_message }" type="${3:?Usage: send_message }"