Skip to content

fix(workspace-server): block path traversal in copyFilesToContainer (CWE-22) - #1277

Closed
molecule-ai[bot] wants to merge 2 commits into
stagingfrom
fix/cwe-22-container-tar-path-traversal
Closed

molecule-ai[bot] wants to merge 2 commits into
stagingfrom
fix/cwe-22-container-tar-path-traversal

Conversation

@molecule-ai

@molecule-ai molecule-ai Bot commented Apr 21, 2026

Copy link
Copy Markdown
Contributor

Summary

Test Plan

  • Review the code change — validation is applied at the archive-write boundary, covering all callers
  • CI passes

Refs: #1266

Molecule AI Core-DevOps and others added 2 commits April 21, 2026 01:06
… resp.Body.Close err

- admin_memories.go: Remove the duplicate redactSecrets call on line 135.
  The first call at line 125 already produces the redacted content;
  the second call was redundant and also shadowed the first variable.
  Fixes #1195.

- artifacts/client.go: Suppress the error from resp.Body.Close() using
  the defer func() { _ = ... }() pattern consistent with the bundle package
  and errcheck suppression requirements. Fixes #1196.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…CWE-22)

Reject absolute paths and traversal attempts (../) at the tar-write
boundary before name is used as a tar header. Also prepend destPath so
relative paths in the files map always land inside the volume mount.

Ref: issue #1266
@molecule-ai molecule-ai Bot closed this Apr 21, 2026

@molecule-ai molecule-ai Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

LGTM on copyFilesToContainer. Note: PR #1271 covers BOTH copyFilesToContainer AND deleteViaEphemeral — recommend merging #1271 for complete coverage. If #1271 closes, add the deleteViaEphemeral guard here too.

@molecule-ai
molecule-ai Bot deleted the fix/cwe-22-container-tar-path-traversal branch May 20, 2026 06:21
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.

0 participants