🚨 Severity: MEDIUM
💡 Vulnerability: Information Exposure (CWE-209)
- The web dashboard returned raw exception messages to users, potentially leaking internal details (stack traces, file paths, sensitive info).
- This violated the principle of "Fail Securely".
🎯 Impact:
- Attackers could glean information about the internal file structure or database errors to facilitate further attacks.
🔧 Fix:
- Configured `logging` to capture errors securely to stderr (standard practice for containerized apps).
- Updated `dashboard()` and `get_cached_markdown` to log the full exception traceback server-side.
- Changed user-facing response to a generic "Internal Server Error" (500).
✅ Verification:
- Added unit test `test_dashboard_error_handling` in `scripts/test_web_dashboard.py`.
- Verified that the test passes: `python scripts/test_web_dashboard.py`.
- Confirmed that the response body contains "Internal Server Error" and does NOT contain the mock secret.
💡 What: Separated the /health endpoint from the main dashboard rendering logic. It now returns a lightweight JSON response.
🎯 Why: The previous implementation rendered the full Markdown dashboard for every health check, consuming unnecessary CPU and I/O resources during frequent polling.
📊 Impact: Reduces health check processing time from file reading + markdown parsing (~milliseconds) to a simple JSON return (~microseconds).
🔬 Measurement: Verified with new test script scripts/test_web_dashboard.py and updated render.yaml/app.yaml to use the new endpoint.