Skip to content

fix: backport remaining security and runtime hardening updates#22

Merged
bitifirefly merged 4 commits intodevelopfrom
backport/upstream-20260322-final-batch
Mar 22, 2026
Merged

fix: backport remaining security and runtime hardening updates#22
bitifirefly merged 4 commits intodevelopfrom
backport/upstream-20260322-final-batch

Conversation

@bitifirefly
Copy link
Copy Markdown

Summary

This PR completes the remaining high-value upstream backports in one batch.

1) Filesystem path-boundary security

  • replace startswith() path boundary checks with Path.relative_to()
  • add regression test for the workspace vs workspace_evil bypass shape

2) Exec tool hardening + config enhancement

  • add tools.exec.pathAppend (default empty)
  • pass pathAppend through AgentLoop and SubagentManager into ExecTool
  • append extra PATH entries with os.pathsep for subprocess execution
  • strengthen workspace guard path extraction for:
    • full Windows absolute paths
    • ~ home paths
    • quoted absolute/home paths
  • add coverage for path extraction, home-path blocking, and pathAppend behavior

3) Allowlist/auth hardening

  • remove generic token-splitting (sender_id.split("|")) from BaseChannel.is_allowed
  • keep Telegram backward compatibility by allowing id|username matching only inside Telegram with strict shape checks
  • add base-channel and Telegram allowlist regression tests

4) Email dedupe stability improvement

  • replace "clear all" UID dedupe reset with oldest-entry eviction down to half capacity
  • add targeted unit test for eviction behavior

Validation

  • ruff check ... (touched files)
  • pytest -q tests/test_base_channel.py tests/test_tool_validation.py tests/test_exec_security.py tests/test_filesystem_tools_workspace.py tests/test_telegram_send_reply.py tests/test_email_channel.py tests/test_tool_domain_manager.py
  • pytest -q (full suite)

Result: 417 passed, 5 warnings

@bitifirefly bitifirefly merged commit 2df0e03 into develop Mar 22, 2026
2 checks passed
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