Skip to content

security: harden localPath validation and runServer() cmd in gcp.ts#2524

Merged
louisgv merged 2 commits intomainfrom
fix/security-gcp
Mar 12, 2026
Merged

security: harden localPath validation and runServer() cmd in gcp.ts#2524
louisgv merged 2 commits intomainfrom
fix/security-gcp

Conversation

@la14-1
Copy link
Member

@la14-1 la14-1 commented Mar 12, 2026

Why: Fixes two HIGH-severity security issues in gcp.ts — unvalidated localPath in uploadFile() could allow path traversal to read arbitrary local files; runServer() cmd parameter lacked validation before SSH execution.

Fixes #2521
Fixes #2522

Changes

  • Added localPath validation in uploadFile(): rejects .. traversal, leading - args, and empty paths
  • Added cmd validation in runServer() and interactiveSession(): rejects empty commands and null bytes

-- refactor/security-auditor

…n gcp.ts

Fixes #2521 - Add path traversal and argument injection protection for localPath
Fixes #2522 - Add validation for cmd parameter before SSH execution

Agent: security-auditor
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Copy link
Member

@louisgv louisgv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Security Review

Verdict: APPROVED
Commit: c619361

Findings

No security issues found. All changes are security hardening improvements.

Changes reviewed:

  • runServer() - Added null byte and empty command validation
  • uploadFile() - Added localPath validation (path traversal, argument injection, empty path)
  • interactiveSession() - Added null byte and empty command validation

All validations are appropriate and properly implemented. Commands are already protected by proper escaping mechanisms (shellQuote(), single-quote escaping, array-based args).

Tests

  • bun test: PASS (1396 tests, 0 failures)
  • biome lint: PASS (0 errors)
  • curl|bash safety: N/A (TypeScript only)
  • macOS compat: N/A (TypeScript only)

-- security/pr-reviewer

@louisgv louisgv merged commit 7278638 into main Mar 12, 2026
5 checks passed
@louisgv louisgv deleted the fix/security-gcp branch March 12, 2026 08:50
AhmedTMM pushed a commit to AhmedTMM/spawn that referenced this pull request Mar 12, 2026
…n gcp.ts (OpenRouterTeam#2524)

Fixes OpenRouterTeam#2521 - Add path traversal and argument injection protection for localPath
Fixes OpenRouterTeam#2522 - Add validation for cmd parameter before SSH execution

Agent: security-auditor

Co-authored-by: B <6723574+louisgv@users.noreply.github.com>
Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
AhmedTMM pushed a commit to AhmedTMM/spawn that referenced this pull request Mar 13, 2026
…n gcp.ts (OpenRouterTeam#2524)

Fixes OpenRouterTeam#2521 - Add path traversal and argument injection protection for localPath
Fixes OpenRouterTeam#2522 - Add validation for cmd parameter before SSH execution

Agent: security-auditor

Co-authored-by: B <6723574+louisgv@users.noreply.github.com>
Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
AhmedTMM pushed a commit to AhmedTMM/spawn that referenced this pull request Mar 13, 2026
…n gcp.ts (OpenRouterTeam#2524)

Fixes OpenRouterTeam#2521 - Add path traversal and argument injection protection for localPath
Fixes OpenRouterTeam#2522 - Add validation for cmd parameter before SSH execution

Agent: security-auditor

Co-authored-by: B <6723574+louisgv@users.noreply.github.com>
Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants