hermes-control-interface
hermes-control-interface copied to clipboard
[BUG] Inconsistent use of shell() vs execHermes()
Problem: Some endpoints use shell() (shell interpretation) instead of execHermes() (direct execFile), even when inputs are already sanitized. While currently safe due to input validation, using execHermes provides defense-in-depth.
Endpoints to fix:
| Endpoint | Line | Current | Fix |
|----------|------|---------|-----|
| /api/skills/list/:profile | 3389 | shell(\hermes${flag} skills list 2>&1\) | Use execHermes(['-p', profile, 'skills', 'list']) |
| /api/skills/check | 3448 | shell(\hermes ${flag}skills check 2>&1\) | Use execHermes([...profArg, 'skills', 'check']) |
| /api/skills/browse/:page | 3335 | shell(\hermes skills browse --page ${page}\) | Use execHermes(['skills', 'browse', '--page', String(page)]) |
| /api/profiles/use | 2031 | shell(\hermes profile use ${name}\) | Use execHermes(['profile', 'use', name]) |
| /api/insights/:profile/:days | 4242 | shell(\hermes --profile ${profile} insights --days ${days}\) | Use execHermes(['-p', profile, 'insights', '--days', String(days)]) |
| /api/sessions/:id/export | 3717-3719 | Multiple shell() calls | Refactor to use execHermes or validate tmpFile path |
✅ RESOLVED in v3.5.0
Fix applied: Backup download endpoint now uses path.resolve() + startsWith('/tmp/') check instead of weak string matching (filePath.includes('..')).
The fix is part of the v3.5.0 release which includes all security hardening from v3.4.0 plus additional path traversal protections.
Release: https://github.com/xaspx/hermes-control-interface/releases/tag/v3.5.0