Skip to content

fix(DM01-6173): prevent shell injection and MCP transaction corruption - #634

Merged
liuwei08 merged 1 commit into
masterfrom
fix/DM01-6173
Aug 19, 2026
Merged

fix(DM01-6173): prevent shell injection and MCP transaction corruption#634
liuwei08 merged 1 commit into
masterfrom
fix/DM01-6173

Conversation

@liuwei08

@liuwei08 liuwei08 commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

Summary

  • src/job/job.py: Use shlex.quote() on source/output args in compress() and uncompress() to prevent shell metacharacter injection. Preserves existing shell=True pipeline structure and console.execute logging.
  • src/services/gcp/pkg/stub/handler.go: Replace exec.Command("bash", "-c", "gcloud ..."+maxAge) with a direct exec.Command("gcloud", ...) argument list, eliminating the maxAge string concatenation injection path.
  • src/api/handlers/mcp/auth.py: Call g.db.rollback() when the last_used_at update fails, preventing the DB connection from remaining in an aborted transaction state and causing the rest of the MCP request to fail.

Test plan

  • Verify compress()/uncompress() still works correctly with normal job input/output paths
  • Verify getOutdatedClusters gcloud filter produces identical results with the new argument list form
  • Run existing MCP auth test suite: pytest src/api/handlers/mcp/ — all 35 tests pass including the two new regression tests for rollback behavior

- job.py: use shlex.quote() on source/output args in compress/uncompress
  to prevent shell metacharacter injection; shell=True pipeline preserved
- handler.go: replace bash -c string concat with exec.Command arg list
  in getOutdatedClusters to eliminate maxAge injection path
- auth.py: call g.db.rollback() when last_used_at update fails to avoid
  leaving the connection in an aborted transaction state
@liuwei08

Copy link
Copy Markdown
Contributor Author

@liuwei08
liuwei08 merged commit 726ab38 into master Aug 19, 2026
2 checks passed
@liuwei08
liuwei08 deleted the fix/DM01-6173 branch August 19, 2026 02:46
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.

1 participant