[Bounty proposal] fix(iq_rating): prevent internal exception leakage and HTML injection in GET /iq dashboard ( proposed)
Following the contribution guide's invitation to propose paid work — @kodjima33, @josancamon19, would a US bounty be appropriate for this? Proposed amount, not an existing award. Fix and tests are already up as PR #15610.
Context & Follow-up
This implements the specific follow-up hardening pass called out by @Git-on-my-level in the review on PR #15564:
"One follow-up worth a separate hardening pass (pre-existing, not introduced here): the GET /iq HTML page's error path still renders str(e) unescaped into the error page (error_content = f'<div class="empty-state">
Error
{str(e)}
Symptom
In plugins/iq_rating/main.py, the GET /iq dashboard endpoint caught unexpected exceptions and interpolated raw str(e) directly into the HTML response body:
except Exception as e:
logger.error(f"Error generating IQ ratings: {e}")
error_content = f'<div class="empty-state"><h2>Error</h2><p>{str(e)}</p></div>'
html = IQ_RATING_HTML.format(content=error_content)
return HTMLResponse(content=html)
When database exceptions (e.g. SQLite file path/lock errors), parse faults, or exceptions containing user-controlled memory text occur, internal paths and unescaped HTML/XSS payloads were rendered directly into the user's browser.
Fix
- Log exceptions server-side with
logger.error(f"Error generating IQ ratings: {e}", exc_info=True)for full diagnostic tracing. - Return a fixed, generic error message in
error_content(<div class="empty-state"><h2>Error</h2><p>An unexpected error occurred while loading IQ ratings.</p></div>), eliminating both the secret leak and the HTML/XSS injection vector. - Added
plugins/iq_rating/test_error_handling.pywith 3 hermetic unit tests verifying that filesystem paths, database errors, and XSS payloads never leak into HTML responses. - Registered
iq-rating-error-handling-testsin.github/checks-manifest.yaml.
Failure class
Failure-Class: FC-secret-printed-to-plugin-logs
Fixes via PR #15610.
Proposed Bounty Reward: .00 USD Bounty Payout Destination (EVM / Base Mainnet): 0x240C74A953Fc04Fe8cD713c68b53e94d9b449F8C (ENS: gewenbo.eth)
Duplicate of #15004, the earlier iq_rating exception leak.