Studio's Office formats run model-written Python unsandboxed in the worker
I maintainer di solito rispondono entro 1 giorno
@Cedric921 ci sta già lavorando.
Dal 6/10/2026.
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 35/100
Direzione di ricerca
Read CONTRIBUTING.md, docs/architecture/studio.md, ADR 0010 and ADR 0028, then review the proposal header in docs/README.md. Trace the current runner in surfsense_local/backend/worker/studio/office/runner.py and its pipeline seam in pipeline.py; use test_studio_office.py to understand existing coverage. Done for this first contribution is a proposal in docs/proposals/ choosing an approach, documenting platform coverage, approval and repair-loop behavior, and its tradeoffs.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
The gap
docs/architecture/studio.md lists this under Known gaps:
DOCX, PPTX, XLSX and PDF run model-written Python with
exec()in the worker process, unsandboxed and without asking the user; the 120-second limit cannot stop a runaway thread.
Why it matters
The model that writes that Python has just read the user's own documents, and a document is untrusted input: it can carry instructions aimed at the model. What comes back is executed with the worker's privileges, on the user's machine, with reach into their data directory and the network, and the user is never asked. Nothing distinguishes a script that builds a spreadsheet from a script that reads ~/.surfsense and posts it somewhere; both are just output_bytes by the time the job finishes.
This is the one place where the app's own rule does not hold. ADR 0010 says the model emits structured content and a committed builder renders it, which turns "arbitrary code" into "malformed JSON"; eight of the twelve formats still work that way. ADR 0028 accepted the four that do not, and left open whether they should ask.
This needs a design before it needs code, and the right first contribution is a proposal in docs/proposals/, not a PR. The realistic shapes are an out-of-process runner the worker can kill and confine, an OS-level sandbox per platform, asking the user to approve the script the way ADR 0028 makes the agent's shell tool ask, or returning these four formats to ADR 0010's builder rule and giving up on model-written layout. Whichever you favour, say what it costs on Windows, macOS and Linux: the app is offline-first and has no Docker, which is what ruled the hosted sandbox out to begin with. Comment here before you start writing, so we can agree the direction.
Where
surfsense_local/backend/worker/studio/office/runner.py—execute()runsexec(compile(code, "<studio-office>", "exec"), namespace)on a daemon thread and joins it forTIMEOUT_SECONDS. The module docstring already names the ceiling and the upgrade path.surfsense_local/backend/worker/studio/office/pipeline.py—render()is the only caller, and the seam any replacement runner sits behind: it hands code in and readsoutput_bytes,titleandsummaryback out. Keep that seam rather than inventing a new one.surfsense_local/backend/worker/studio/office/prompt.pyand each format'sSKILL.mdunderoffice/docx/,office/pptx/,office/xlsx/andoffice/pdf/— what the model is asked for, if the answer is to stop asking for code.surfsense_local/backend/bundling/worker.spec— python-docx, python-pptx, xlsxwriter and reportlab are named there as hidden imports precisely because the generated code imports them and no static import exists. A separate runner process has to keep them reachable in a frozen build.
What done looks like
- For the proposal: one approach chosen, with the platforms it covers and the ones it does not, what happens to the three-attempt repair loop in
render(), and whether the user is asked. For the code that follows: a script that tries to open a network connection or read outside the data directory does not succeed, and a script that loops forever is stopped rather than waited out. - Whichever way it goes, the fixing change deletes two Known-gap lines, not one: the line above in
docs/architecture/studio.md, and the cross-reference indocs/architecture/egress.md— "The Office Studio formats run model-written code in the worker, and that code can open connections of its own (studio)." Egress carries it because that code can open connectionsegress.require()never sees. - The Studio doc's The builder rule, and where it is broken section describes the current behaviour in detail and is updated to match whatever lands.
- An accepted ADR is not rewritten. If the answer reverses ADR 0010 or ADR 0028, the PR carries a new ADR that supersedes it.
What not to change
Do not bolt a partial sandbox onto the current runner. A blocklist of imports, a stripped __builtins__, or a RestrictedPython-style namespace filter is defeated in a dozen documented ways, and shipping one would be worse than the honest ponytail: comment sitting there now, because it would read as a guarantee to the next person who looks.
Leave the eight formats that follow the builder rule alone. They are the part of Studio that works as designed, and the fix here is for the four that do not.
How to verify
surfsense_local/backend/tests/unit/worker/test_studio_office.py drives the runner today, including a script that hangs and one that raises. Write the failing test first: a generated script that reaches something it should not, asserted to fail rather than to succeed.
cd surfsense_local/backend
uv run pytest -m unit
uv run pytest -m integration
uv run ruff check .
cd ../.. && python scripts/check_docs.py
Before you start
Read CONTRIBUTING.md, the Studio doc, ADR 0010 and ADR 0028. docs/README.md has the header a proposal needs. Report anything exploitable today through SECURITY.md rather than in this thread. Open your PR against dev, not main. Comment here to claim this.
- Lingua principale
- Python
- Stelle
- 16.3k
- Fork
- 1.6k
- Merge medio
- 13h 35m
- PR unite (30g)
- 267
Preparare l'ambiente
Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di MODSetter/SurfSense
-
Security Scan: stop flagging pinned hashes and test fixtures on release PRsForse già presa @karthikeya1220 l’ha presa 2 giorni fa. Apertacode quality security
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
MODSetter/SurfSense#2225 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Check Apple notarization credentials on dry runs and weeklyForse già presa @Cedric921 l’ha presa 2 giorni fa. Apertadesktop
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
MODSetter/SurfSense#2224 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Release workflow: keep the macOS certificate off the Windows dry-run buildForse già presa @Cedric921 l’ha presa 2 giorni fa. Apertadesktop security
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
MODSetter/SurfSense#2223 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Write the ADR for chat modesForse già presa @Cedric921 l’ha presa 2 giorni fa. Apertaarchitecture desktop documentation
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
MODSetter/SurfSense#2220 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 73/100
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di MODSetter/SurfSense
Issue simili
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 82/100
EchoTools/nevr-runtime#651 ·
I maintainer di solito rispondono entro 1 giorno
-
bug frontend rt sev-3
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
I maintainer di solito rispondono entro 2 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
noontide-co/mainbranch#1211 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
[1.x Bug] run-operation --sql reports success but rolls back writes on transaction-capable adaptersApertatriage
Difficoltà 2/5 1-3 ore Idoneità per principianti 64/100
dbt-labs/dbt#16784 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno