AI agent skill that researches any topic across Reddit, X, YouTube, HN, Polymarket, and the web - then synthesizes a grounded summary
Python ai-promptsai-skillblueskyclaudeclaude-codeclawhubdeep-researchhackernewsinstagramopenclawpolymarketrecencyredditresearchsocial-mediatiktoktrendstwitterweb-searchyoutube
harden: detected non-static command inside command in run.go (#1109)
Anupam Mediratta8caa6d0d38a1
diff --git a/changelog.d/1109.security.md b/changelog.d/1109.security.mdnew file mode 100644index 00000000..9af4edfb--- /dev/null+++ b/changelog.d/1109.security.md@@ -0,0 +1,3 @@+Require an absolute path for automatically discovered MCP Python interpreters,+including when Go's built-in relative-path protection is explicitly disabled.+Explicit interpreter overrides retain their existing behavior.diff --git a/mcp/internal/engine/run.go b/mcp/internal/engine/run.goindex 2538b394..6afa0984 100644--- a/mcp/internal/engine/run.go+++ b/mcp/internal/engine/run.go@@ -121,7 +121,9 @@ func resolvePython(override string) (string, error) {return override, nil}path, err := exec.LookPath(DefaultPythonBinary)- if err == nil {+ // Go normally rejects relative results with ErrDot. Keep this invariant+ // even when that protection is disabled with GODEBUG=execerrdot=0.+ if err == nil && filepath.IsAbs(path) {return path, nil}return "", fmt.Errorf(diff --git a/mcp/internal/engine/run_test.go b/mcp/internal/engine/run_test.goindex 0c60d151..521c9f55 100644--- a/mcp/internal/engine/run_test.go+++ b/mcp/internal/engine/run_test.go@@ -238,6 +238,45 @@ func TestRunMissingPython(t *testing.T) {}}+func TestResolvePythonRejectsRelativePATH(t *testing.T) {+ if runtime.GOOS == "windows" {+ t.Skip("POSIX executable fixture")+ }+ t.Chdir(t.TempDir())+ if err := os.WriteFile(DefaultPythonBinary, []byte("#!/bin/sh\nexit 0\n"), 0o755); err != nil {+ t.Fatal(err)+ }+ t.Setenv("PATH", ".")+ // Exercise our own guard even when Go's ErrDot protection is disabled.+ t.Setenv("GODEBUG", "execerrdot=0")+ if path, err := resolvePython(""); err == nil || path != "" {+ t.Fatalf("resolvePython accepted relative executable: path=%q err=%v", path, err)+ }+}++func TestResolvePythonAcceptsAbsolutePATH(t *testing.T) {+ if runtime.GOOS == "windows" {+ t.Skip("POSIX executable fixture")+ }+ dir := t.TempDir()+ want := filepath.Join(dir, DefaultPythonBinary)+ if err := os.WriteFile(want, []byte("#!/bin/sh\nexit 0\n"), 0o755); err != nil {+ t.Fatal(err)+ }+ t.Setenv("PATH", dir)+ if path, err := resolvePython(""); err != nil || path != want {+ t.Fatalf("resolvePython = %q, %v; want %q", path, err, want)+ }+}++func TestResolvePythonPreservesExplicitOverride(t *testing.T) {+ t.Setenv("PATH", "")+ want := filepath.Join("explicit", "python")+ if path, err := resolvePython(want); err != nil || path != want {+ t.Fatalf("resolvePython = %q, %v; want trusted override %q", path, err, want)+ }+}+func TestRunMissingScript(t *testing.T) {stub := makeStubPython(t)// CacheDir exists but contains no last30days.py.