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.
Python artificial-intelligencedagdata-sciencedata-visualizationdataflowdeveloper-toolsmachine-learningnotebookspipelinepythonreactivesqlweb-app
fix: provide a warning when toml keys are skipped for security (#8854)
Dylan Madisetti21bd8e2a6896
diff --git a/marimo/_config/reader.py b/marimo/_config/reader.pyindex 85e14cb0c5..44bc2b07af 100644--- a/marimo/_config/reader.py+++ b/marimo/_config/reader.py@@ -42,6 +42,10 @@ def sanitize_pyproject_dict(else:return pyproject_dictif current_level and key_path[-1] in current_level:+ LOGGER.warning(+ "%s in script metadata is ignored for security reasons",+ ".".join(key_path),+ )del current_level[key_path[-1]]return pyproject_dictdiff --git a/tests/_config/test_manager.py b/tests/_config/test_manager.pyindex 87117928f2..ec9b4753cb 100644--- a/tests/_config/test_manager.py+++ b/tests/_config/test_manager.py@@ -287,6 +287,7 @@ def test_script_config_manager_no_marimo_section(tmp_path: Path) -> None:def test_script_config_manager_sanitizes_auto_instantiate(tmp_path: Path,+ caplog: pytest.LogCaptureFixture,) -> None:"""Test that auto_instantiate in script metadata is ignored"""notebook_path = tmp_path / "notebook.py"@@ -302,13 +303,27 @@ def test_script_config_manager_sanitizes_auto_instantiate(notebook_path.write_text(textwrap.dedent(notebook_content))manager = ScriptConfigManager(str(notebook_path))- config = manager.get_config()+ with caplog.at_level("WARNING"):+ from marimo import _loggers++ logger = _loggers.marimo_logger()+ old_propagate = logger.propagate+ try:+ logger.propagate = True+ config = manager.get_config()+ finally:+ logger.propagate = old_propagate# auto_instantiate should be stripped outassert "auto_instantiate" not in config.get("runtime", {})# Other configs should still be present# Note: runtime key may exist but be empty after sanitizationassert config.get("save") == {"autosave_delay": 2000}+ # Warning should be logged+ assert any(+ "auto_instantiate" in record.message and "ignored" in record.message+ for record in caplog.records+ )def test_marimo_config_reader_properties() -> None: