omi icon indicating copy to clipboard operation
omi copied to clipboard

[Bounty proposal] fix(iq_rating): prevent internal exception leakage and HTML injection in GET /iq dashboard ( proposed)

Open gewenbo888 opened this issue 2 months ago • 1 comments

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)}

', ~line 1756). That's the same information-leak class and, since exception text there can include user-derived data, also a potential HTML-injection vector."

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

  1. Log exceptions server-side with logger.error(f"Error generating IQ ratings: {e}", exc_info=True) for full diagnostic tracing.
  2. 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.
  3. Added plugins/iq_rating/test_error_handling.py with 3 hermetic unit tests verifying that filesystem paths, database errors, and XSS payloads never leak into HTML responses.
  4. Registered iq-rating-error-handling-tests in .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)

gewenbo888 avatar Sep 22 '26 01:09 gewenbo888

Duplicate of #15004, the earlier iq_rating exception leak.

aryanorastar avatar Sep 25 '26 03:09 aryanorastar