Skip to content

A reactive notebook for Python — run reproducible experiments, query with SQL, execute as a script, deploy as an app, and version with git. Stored as pure Python. All in a modern, AI-native editor.

docs: provide guidelines on reading endpoints (#10503)

Dylan Madisetti1b9dc6e6b6f5
diff --git a/marimo/_server/api/endpoints/file_explorer.py b/marimo/_server/api/endpoints/file_explorer.py
index 29f20b9d31..ba01504efe 100644
--- a/marimo/_server/api/endpoints/file_explorer.py
+++ b/marimo/_server/api/endpoints/file_explorer.py
@@ -49,6 +49,27 @@ if TYPE_CHECKING:
LOGGER = _loggers.marimo_logger()
+# Design note on scope and path handling (please read).
+#
+# Every endpoint below is gated by `@requires("edit")`, so it is reachable only
+# in edit mode, not by a run-mode viewer (`read` scope). Edit-mode marimo is
+# equivalent to a standard IDE, which allows file traversal and arbitrary file
+# read/write. Moreover, edit-mode marimo is, by design, equivalent to
+# arbitrary code execution. As such, there is no privilege escalation or
+# unexpected file read/write vulnerability in these endpoints.
+#
+# See marimo's security model and disclosure policy in docs/security.md
+# (https://docs.marimo.io/security/) before drafting an advisory for this file.
+#
+# A brief checklist if you are considering disclosing a vulnerability:
+# - Is unexpected or unintended code execution possible?
+# - Are unauthenticated users allowed unintended environment details?
+# - Are unauthenticated users allowed unintended file system access?
+# - Are unauthenticated users allowed unintended arbitrary code execution?
+#
+# The marimo team takes security seriously, and we welcome responsible
+# disclosure of any vulnerabilities. We are happy to discuss any reports.
+
# Router for file system endpoints
router = APIRouter()
@@ -77,7 +98,9 @@ async def list_files(
"""
app_state = AppState(request)
body = await parse_request(request, cls=FileListRequest)
- # Use workspace's directory as default, fall back to cwd
+ # Use workspace's directory as default, fall back to cwd.
+ # NB. This isn't a security boundary; the workspace is just the initial view
+ # for the browser.
directory = app_state.session_manager.workspace.directory
root = body.path or directory or file_system.get_root()
files = file_system.list_files(root)