Skip to content

fix(skillinject): reject path-traversal in plugin file names (PILOT-250)#6

Merged
TeoSlayer merged 1 commit into
mainfrom
openclaw/pilot-250-20260529-213359
May 29, 2026
Merged

fix(skillinject): reject path-traversal in plugin file names (PILOT-250)#6
TeoSlayer merged 1 commit into
mainfrom
openclaw/pilot-250-20260529-213359

Conversation

@matthew-pilot
Copy link
Copy Markdown
Collaborator

What failed

reconcilePluginFiles at skillinject.go:264 joins installDir with pf.Name from the remote manifest without validating the resulting path stays inside installDir. A malicious manifest with "name": "../../.ssh/authorized_keys" would write outside the plugin sandbox.

Why this fix

Added filepath.Clean + strings.HasPrefix guard that rejects traversal sequences before fetching or writing. Mirrors the standard Go filesystem defense pattern.

Verification

  • go build ./... — clean
  • go vet ./... — clean
  • go test ./... — all tests pass (including new TestReconcilePluginFiles_PathTraversalRejected)
  • Diff stat: 2 files, +65/-0

Files changed

  • skillinject.go: +10 (path-traversal guard + strings import)
  • zz_extra_branches_test.go: +55 (new test)

Closes PILOT-250

reconcilePluginFiles computes dst := filepath.Join(installDir, pf.Name)
where pf.Name comes from the remote manifest. A malicious name like
"../../.ssh/authorized_keys" would escape installDir and write outside
the plugin sandbox.

Add filepath.Clean + strings.HasPrefix guard that rejects traversal
sequences before fetching or writing.

Verified: build + vet + test all green. New test exercises both the
rejection and happy path for non-traversal names.

Closes PILOT-250
@codecov
Copy link
Copy Markdown

codecov Bot commented May 29, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@TeoSlayer TeoSlayer merged commit bbec534 into main May 29, 2026
2 checks passed
@TeoSlayer TeoSlayer deleted the openclaw/pilot-250-20260529-213359 branch May 29, 2026 21:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants