fix(ook): address Copilot review — stale process, XSS presets, localStorage

- Detect crashed rtl_433 process via poll() and clean up stale state
  instead of permanently blocking restarts with 409
- Replace innerHTML+onclick preset rendering with createElement/addEventListener
  to prevent XSS via crafted localStorage frequency values
- Normalize preset frequencies to toFixed(3) on save and render
- Add try/catch + shape validation to loadPresets() for corrupted localStorage

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
thatsatechnique
2026-03-05 17:21:14 -08:00
parent 51f7bca4c0
commit c20c7c6a16
2 changed files with 36 additions and 10 deletions
+5 -1
View File
@@ -63,7 +63,11 @@ def start_ook() -> Response:
with app_module.ook_lock:
if app_module.ook_process:
return jsonify({'status': 'error', 'message': 'OOK decoder already running'}), 409
# If the process exited/crashed, clean up stale state and allow restart
if app_module.ook_process.poll() is not None:
cleanup_ook(emit_status=False)
else:
return jsonify({'status': 'error', 'message': 'OOK decoder already running'}), 409
data = request.json or {}