security: move OG image execution behind flag#10175
Merged
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
There was a problem hiding this comment.
All reported issues were addressed across 11 files
Architecture diagram
sequenceDiagram
participant User as Client Browser
participant CLI as CLI (marimo run)
participant Server as Starlette Server
participant SM as SessionManager
participant AssetEP as Assets Endpoint (og_thumbnail)
participant HomeEP as Home Endpoint
participant IndexEP as Index Endpoint
participant OGMod as resolve_opengraph_metadata
participant FS as File System
participant NB as Notebook App (generator fn)
Note over User,NB: NEW: OpenGraph generator execution gated by flag
User->>Server: GET / (index) or /api/home/files or /api/og-thumbnail
alt Index page request
Server->>IndexEP: handle index request
IndexEP->>SM: get execute_opengraph_generators
SM-->>IndexEP: flag (bool)
IndexEP->>OGMod: resolve_opengraph_metadata(execute_generator=flag)
OGMod->>FS: read notebook file for og config
FS-->>OGMod: config (maybe with generator name)
alt generator declared AND execute_generator == True
OGMod->>NB: execute _run_opengraph_generator()
NB->>NB: run notebook-defined code
NB-->>OGMod: dynamic metadata (e.g., title, image)
else generator absent OR execute_generator == False
Note over OGMod: skip generator execution (safe default)
end
OGMod-->>IndexEP: resolved OpenGraphMetadata
IndexEP-->>User: HTML with og tags
else Home endpoint (file listing) request
Server->>HomeEP: get_files_with_metadata()
HomeEP->>SM: get execute_opengraph_generators
SM-->>HomeEP: flag
HomeEP->>OGMod: resolve_opengraph_metadata(execute_generator=flag) per file
OGMod->>FS: read file
OGMod-->>HomeEP: metadata
HomeEP-->>User: FileInfo with og title (static only if flag false)
else OG thumbnail request
User->>Server: GET /api/og-thumbnail?file=...
Server->>AssetEP: og_thumbnail()
AssetEP->>SM: get execute_opengraph_generators
SM-->>AssetEP: flag
AssetEP->>OGMod: resolve_opengraph_metadata(execute_generator=flag)
OGMod->>FS: read file config
OGMod-->>AssetEP: metadata
AssetEP-->>User: image redirect or static OG image
end
Note over CLI,SM: Flag originates from CLI or ASGI builder
CLI->>Server: start(execute_opengraph_generators=True/False)
Server->>SM: SessionManager(execute_opengraph_generators=flag)
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
dmadisetti
approved these changes
Jul 14, 2026
dmadisetti
left a comment
Member
There was a problem hiding this comment.
Thanks! I think this is a great compromise
Contributor
|
🚀 Development release published. You may be able to view the changes at https://marimo.app?v=0.23.15-dev16 |
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.
Makes the OG image generator function's automatic execution opt-in through
--execute-opengraph-generatorsflag to reduce risk of Remote Code Execution vulnerability.