hermes-control-interface icon indicating copy to clipboard operation
hermes-control-interface copied to clipboard

[BUG] Missing input validation on prompt in cron creat

Open stamandster opened this issue 7 months ago • 1 comments

Problem: The /api/hermes-cron/:profile/create endpoint passes prompt directly to execHermes without validation.

Current code (line 4306-4307):
javascript
args.push(schedule);
if (prompt) args.push(prompt);


Fix: Add character validation to prompt parameter:
javascript
if (prompt) {
  if (prompt.length > 10000) {
    return res.status(400).json({ ok: false, error: 'prompt too long (max 10000 chars)' });
  }
  // Allow alphanumeric, common punctuation, spaces - prevent injection
  if (!/^[\w\s.,!?;:'"()-]*$/i.test(prompt)) {
    return res.status(400).json({ ok: false, error: 'invalid prompt characters' });
  }
  args.push(prompt);
}

stamandster avatar Apr 23 '26 15:04 stamandster

✅ 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

xaspx avatar Apr 27 '26 11:04 xaspx