Skip to content

fix(viewer): turn off Mesop debug mode in production - #726

Draft
omkargaikwad23 wants to merge 3 commits into
mainfrom
fix/viewer-keep-xsrf-check
Draft

omkargaikwad23 wants to merge 3 commits into
mainfrom
fix/viewer-keep-xsrf-check

Conversation

@omkargaikwad23

@omkargaikwad23 omkargaikwad23 commented Nov 20, 2026 •

Copy link
Copy Markdown
Collaborator

What this fixes

MESOP_XSRF_CHECK=false turned on the Mesop debug mode in the viewer. The make container and make deploy-corprun targets set this variable, so the deployed viewer ran in debug mode.

In debug mode, Mesop:

  • accepts a cross-site POST to the UI endpoint (no XSRF check).
  • sends the full error details to the browser.

How

  • The viewer no longer turns on the debug mode. It ignores MESOP_XSRF_CHECK=false and logs a warning.
  • Remove the variable from the Makefile targets and the deployment checklist.

Proxy check

Mesop compares the Origin header with the URL of the request. If a proxy changes the host or the scheme, each UI request gets HTTP 403.

A check on 2026-11-20 behind the Cloud Run proxy passed. A temporary second service ran the image of the deployed viewer without MESOP_XSRF_CHECK, so the debug mode was off. Each tab of the UI opened, and each UI request got HTTP 200. Internal links: log, screenshot.

Behavior change

A client that is not a browser and sends no Origin header gets HTTP 403 from the UI endpoint.

Testing

  • Local run with MESOP_XSRF_CHECK=false: a cross-site POST to /__ui__ gets HTTP 403. Before this change, the check accepted it. A same-origin POST still passes the check.
  • .ci/verify_viewer.py passes.
  • The full evalbench/test suite runs in CI for this PR.

MESOP_XSRF_CHECK=false set the Mesop debug mode, which turns off the check for cross-site requests. Ignore the variable and remove it from the Makefile targets and the deployment checklist.
@omkargaikwad23 omkargaikwad23 changed the title fix(viewer): keep the Mesop XSRF check on fix(viewer): turn off Mesop debug mode in production Nov 20, 2026
@omkargaikwad23

Copy link
Copy Markdown
Collaborator Author

/gcbrun

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant