diff --git a/AGENTS.md b/AGENTS.md index f4a09a6..d2cb3ad 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -11,6 +11,7 @@ High-signal context for OpenCode sessions in this repo. - **Python 3.13 strictly required.** `manifold3d` and `pymeshfix` have no wheels for 3.14 yet. - Runtime deps live in `requirements.txt`, test-only deps in `requirements-dev.txt` (which includes the former via `-r`). `scikit-image` is a runtime dep despite never being imported directly: `trimesh` imports it lazily inside `matrix_to_marching_cubes`, so pip won't pull it in on its own. Don't "clean it up". +- Pillow is an explicit runtime pin although Streamlit pulls it in transitively: 13.0.0 fixes the OSV findings against 12.3.0. Streamlit 1.66.1 is the first release that accepts Pillow 13; versions 1.62.0-1.66.0 constrain it to `<13`. Update the two together and keep the resolver/test check in `tests/test_streamlit_config.py` green. - No linters or build system are configured. Do not invent them unless asked. `pyrefly.toml` is checked in for local type checks (`pyrefly check`), but it is deliberately **not** part of CI — keep it that way unless asked. - **The runtime image must ship `.streamlit/config.toml`.** The Dockerfile copies files individually (not `COPY . .`), and the pinned dark theme lives in that file. Without it the container falls back to the light theme while the custom CSS in `app.py` stays dark-tuned — sidebar labels then render unreadable. Any new file the app reads at runtime has to be added to the `runtime` stage explicitly. **The same holds for the `test` stage:** it copies its files individually too, so a repo file the tests read has to be named there *and* must not be excluded by `.dockerignore` — which is why the `Dockerfile` deliberately stays in the build context (`tests/test_streamlit_config.py` reads it). Miss one and the tests pass locally but fail inside the image. diff --git a/README.md b/README.md index 6d7e4ae..dbcbbfa 100644 --- a/README.md +++ b/README.md @@ -72,6 +72,24 @@ python inlayer.py -i fig1.stl fig2.stl fig3.stl -o inlay.stl > **Note:** Python 3.14 is not supported yet — `manifold3d` and `pymeshfix` > have no wheels for it. +### Dependency security baseline + +The runtime pins **Streamlit 1.66.1** and its otherwise transitive **Pillow +13.0.0** dependency together. Pillow 13.0.0 fixes the OSV findings reported for +12.3.0. Streamlit 1.62.0 through 1.66.0 require `pillow<13`, so do not combine +the Pillow pin with an older Streamlit version or force-install either package. + +After changing dependencies, recreate the Python 3.13 environment and record +the actual direct and transitive resolution rather than relying on the pins +alone: + +```bash +pip install -r requirements-dev.txt +python -m pip check +python -m pip show streamlit pillow +python -m pip freeze +``` + ### 🌍 Language The interface speaks English and German. English is the default. diff --git a/requirements.txt b/requirements.txt index 6d2fb78..a14db15 100644 --- a/requirements.txt +++ b/requirements.txt @@ -36,5 +36,10 @@ pymeshfix==0.18.1 fast_simplification==0.2.0 # Web-App (nur fuer `streamlit run app.py`, nicht fuer die CLI noetig). -streamlit==1.62.0 +# Streamlit 1.66.1 is the first release that accepts Pillow 13 (`pillow<14`). +# Pin the transitive Pillow dependency explicitly: 13.0.0 fixes every OSV +# finding reported for 12.3.0. Streamlit 1.62.0-1.66.0 require `pillow<13` +# and must not be combined with this pin. +streamlit==1.66.1 +pillow==13.0.0 plotly==6.9.0 diff --git a/tests/test_streamlit_config.py b/tests/test_streamlit_config.py index 16c72d4..104d03f 100644 --- a/tests/test_streamlit_config.py +++ b/tests/test_streamlit_config.py @@ -9,10 +9,14 @@ from __future__ import annotations import ast +import importlib.metadata import re import tomllib from pathlib import Path +from packaging.requirements import Requirement +from packaging.utils import canonicalize_name + _REPO_ROOT = Path(__file__).resolve().parent.parent _CONFIG = _REPO_ROOT / ".streamlit" / "config.toml" @@ -129,3 +133,30 @@ def test_no_deprecated_use_container_width_api(): if "use_container_width" in (_REPO_ROOT / name).read_text(encoding="utf-8") ] assert not hits, f"deprecated use_container_width in: {hits}" + + +def test_pillow_security_pin_is_installed_and_accepted_by_streamlit(): + """The pinned Streamlit release must accept the Pillow security fix.""" + requirements = { + canonicalize_name(req.name): req + for line in (_REPO_ROOT / "requirements.txt").read_text(encoding="utf-8").splitlines() + if line.strip() and not line.startswith("#") + for req in [Requirement(line)] + } + assert str(requirements["streamlit"].specifier) == "==1.66.1" + assert str(requirements["pillow"].specifier) == "==13.0.0" + + installed = { + name: importlib.metadata.version(name) + for name in ("streamlit", "pillow") + } + assert all(installed[name] in requirements[name].specifier for name in installed) + + streamlit_pillow_constraints = [ + req.specifier + for requirement in importlib.metadata.requires("streamlit") or [] + for req in [Requirement(requirement)] + if canonicalize_name(req.name) == "pillow" + ] + assert streamlit_pillow_constraints + assert all(installed["pillow"] in specifier for specifier in streamlit_pillow_constraints)