mirror of
https://github.com/ChuckBuilds/LEDMatrix.git
synced 2026-10-13 18:46:37 +00:00
fix(auto-update): let the app-wide handler answer status-route errors
CodeQL (py/stack-trace-exposure, #709) flagged the route's own except, which returned describe_exception(e). web_interface/app.py's error handler already logs the traceback and returns the same redacted detail for any unhandled exception, so the local copy is removed: same response, no new exception-to-response flow, and test_web_error_detail's policy still holds. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -124,17 +124,15 @@ def get_system_version():
|
|||||||
return jsonify({'status': 'error', 'message': 'Unable to retrieve version'}), 500
|
return jsonify({'status': 'error', 'message': 'Unable to retrieve version'}), 500
|
||||||
@api_v3.route('/system/auto-update', methods=['GET'])
|
@api_v3.route('/system/auto-update', methods=['GET'])
|
||||||
def get_auto_update_status():
|
def get_auto_update_status():
|
||||||
"""Weekly automatic update status: last result, next check, and any alert."""
|
"""Weekly automatic update status: last result, next check, and any alert.
|
||||||
|
|
||||||
|
No local except: a failure falls through to the app-wide handler in
|
||||||
|
web_interface/app.py, which logs the traceback and returns the redacted
|
||||||
|
detail -- the response every route gives, without a second copy here.
|
||||||
|
"""
|
||||||
from web_interface import auto_update
|
from web_interface import auto_update
|
||||||
try:
|
config = api_v3.config_manager.load_config() if api_v3.config_manager else {}
|
||||||
config = api_v3.config_manager.load_config() if api_v3.config_manager else {}
|
return jsonify({'status': 'success', 'data': auto_update.describe_status(config)})
|
||||||
return jsonify({'status': 'success', 'data': auto_update.describe_status(config)})
|
|
||||||
except Exception as e:
|
|
||||||
# describe_exception redacts credentials; the detail is kept on purpose
|
|
||||||
# (see test_web_error_detail.py) so a failure is diagnosable from the UI.
|
|
||||||
logger.error("get_auto_update_status failed", exc_info=True)
|
|
||||||
return jsonify({'status': 'error', 'message': 'Could not read automatic update status',
|
|
||||||
'details': describe_exception(e)}), 500
|
|
||||||
|
|
||||||
|
|
||||||
@api_v3.route('/system/auto-update/dismiss', methods=['POST'])
|
@api_v3.route('/system/auto-update/dismiss', methods=['POST'])
|
||||||
|
|||||||
Reference in New Issue
Block a user