MNT: Restrict webagg toolbar actions to valid actions#31294
Merged
QuLogic merged 3 commits intomatplotlib:mainfrom Mar 13, 2026
Merged
MNT: Restrict webagg toolbar actions to valid actions#31294QuLogic merged 3 commits intomatplotlib:mainfrom
QuLogic merged 3 commits intomatplotlib:mainfrom
Conversation
ba73df8 to
f1f0da8
Compare
tacaswell
reviewed
Mar 13, 2026
Member
|
I'm 👍🏻 on the toolbar change, but confused by the CORS change as I think tornando defaults to locked down. |
f1f0da8 to
dff2887
Compare
tacaswell
approved these changes
Mar 13, 2026
QuLogic
reviewed
Mar 13, 2026
Co-authored-by: Elliott Sales de Andrade <[email protected]>
QuLogic
approved these changes
Mar 13, 2026
andreas16700
added a commit
to andreas16700/matplotlib
that referenced
this pull request
Mar 16, 2026
…webagg_cross_origin
andreas16700
added a commit
to andreas16700/matplotlib
that referenced
this pull request
Mar 16, 2026
…webagg_cross_origin
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR summary
The WebAgg backend starts a local Tornado web server with no origin checking on its WebSocket handler and an opengetattrdispatch for toolbar actions. This means any webpage a user visits while WebAgg is running can silently connect to the server, receive figure image data, and invoke arbitrary zero-argument methods on the toolbar object.The good news is that I believe this is sandboxed to the figure window & its methods, and does not allows for arbitrary code execution. So the blast radius is pretty limited. @tacaswell FYIThis adds origin checking to the websocket handler, to ensure all requests are coming from the webagg server hosting the figure. And it restricts the toolbar button dispatch to only allow acting on the actual toolbar buttons.
AI Disclosure
Claude authored, manually reviewed.
PR checklist