Skip to content

fix(security): add Windows archive detection and .zip extraction for tirith binary#1

Closed
XiaoXiao0221 wants to merge 2 commits into
mainfrom
fix/windows-gateway-encoding-v2
Closed

fix(security): add Windows archive detection and .zip extraction for tirith binary#1
XiaoXiao0221 wants to merge 2 commits into
mainfrom
fix/windows-gateway-encoding-v2

Conversation

@XiaoXiao0221
Copy link
Copy Markdown
Owner

@XiaoXiao0221 XiaoXiao0221 commented Apr 12, 2026

Summary

Fixes WinError 2 when tirith security scanner tries to auto-install on Windows.

Problem

The tirith_security tool only supported Linux/macOS (.tar.gz archives). On Windows, _detect_target() returned None and all archives were assumed to be .tar.gz, but GitHub releases for Windows are .zip format.

Changes

  • Add Windows platform detection in _detect_target() (pc-windows-msvc)
  • Use .zip archive for Windows, .tar.gz for Linux/macOS
  • Implement zipfile extraction for Windows (tirith.exe)
  • Fix src_base path bug that ignored nested zip member paths
  • Skip chmod +x on Windows (not supported)
  • Add test_tirith_security_fix.py (5 unit tests)

Test Plan

  • Unit tests: python tools/test_tirith_security_fix.py - ALL PASSED
  • Manual install: tirith.exe --version - 0.2.12
  • Single file scan: tirith.exe scan tirith_security.py - no issues
  • Directory scan: tirith.exe scan hermes-agent/tools/ - runs correctly

Platforms Tested

  • Windows (x86_64-pc-windows-msvc) - PASSED
  • Linux/macOS - unchanged, existing behavior preserved

Add OSError to os.kill(pid, 0) exception handling in gateway/status.py
…tirith binary

- Add Windows platform detection in _detect_target() (pc-windows-msvc)
- Use .zip archive for Windows targets instead of .tar.gz
- Implement zipfile extraction for Windows binary (tirith.exe)
- Fix path resolution bug where src_base ignored nested zip members
- Skip chmod +x on Windows (not supported)
- Add unit test script for cross-platform archive handling

Fixes: WinError 2 file not found when tirith tries to auto-install on Windows
@XiaoXiao0221
Copy link
Copy Markdown
Owner Author

Closed - replaced by clean PR #5 (only tirith changes)

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