Repository navigation
feat(engines): Lumina routes and view, CliRunner hardening with pinned-executable admission (draft, depends on #139) - #143
Closed
DVOpenLabs wants to merge 8 commits into
Closed
DVOpenLabs wants to merge 8 commits into
DVOpenLabs wants to merge 8 commits into
Conversation
…cy, and Lumina-compatible service route and view
CliRunner stops the whole tree it started (POSIX process group; Windows kill-on-close Job Object), removes the job directory after a failed run, and refuses a slicer-named executable. POST /engines/lumina/{formats,status,generate} and a Studio+ view with an explicit format choice; output is a new file, no path is returned. Mock-service-tested against a synthetic loopback service; no real Lumina exercised. Depends on #139 only.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…ecutable, not by name alone Sol HIGH: a renamed copy of a slicer passed the basename check. Name rail kept; unpinned executables now refused (executable_not_approved). Tests: renamed copy refused, pin admits, wrong/malformed pin refused, name rail wins over pin. Verified: engines+ext_routes+routes_engines_lumina+foundation 865 passed/2 skipped (py3.14). Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…imits Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…ckage O1 refuse the NT passthrough prefix (\??\ and /??/) in the local-input guard. O2 refuse the Windows launcher in a frozen (packaged) build instead of starting the sidecar. O3 match slicer names by token (Snapmaker_Orca, bambu-studio, UltiMaker-Cura, AppImage names). O10 run the launcher with -I. O6 evidence-label wording in ENGINES.md. Deferred, not fixed: O4 close race, O5 default-folder edge, O7 timeout flake, O8 magic bytes, O9 partial file. Verified: engines+ext_routes+routes_engines_lumina+foundation 872 passed/2 skipped (py3.14). Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: true
|
test_noop_when_stdin_is_not_a_pipe replaced os.fstat for the whole process and test_noop_on_non_posix / the EOF test replaced os.name / os._exit the same way, so any other caller of os.fstat during the test (pytest, the runtime) saw a stub with no st_size. CI hit "AttributeError: 'RegularFileStat' object has no attribute 'st_size'". The tests now give the lifeline module its own os view (a module-local shim) and use a real temporary regular-file descriptor through start_parent_lifeline(fd=...). The no-watcher assertion and the real pipe/EOF coverage are unchanged. Test-only; no product code, skip or suppression. Verified: py -3.13 -m pytest tests/test_lifeline.py -> 4 passed, 1 skipped (Windows local). The original CI failure did not reproduce locally, so the process-wide stub is the cause by inspection, not by reproduction; the Python patch version is not established as the trigger. Linux and CI results come from this PR's checks. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…test Review of the first fix found the shim raised TypeError when an override repeated a key (`_exit`), so the Linux EOF test errored before running. Attributes are now merged into a dict first. The non-POSIX test passes a real pipe fd so only the os.name check can stop the watcher. Verified: Windows py -3.13 pytest tests/test_lifeline.py -> 4 passed, 1 skipped. Linux (WSL Ubuntu, Python 3.12.3, _lifeline.py + this test in an isolated directory, pytest) -> 5 passed, so the pipe/EOF test ran. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The runner docs said the name rail matched only the basename or "slicer". The code also matches any token of the name (split on - _ . and space), refuses before identity admission, and exempts sys.executable from the pin. State that, and state what a pin does and does not mean: bytes not behaviour, read at construction only, never derived from an untrusted request, and the packaged-Windows and frozen-POSIX cases. List the optional runner changes that are still not done (re-hash before each run, a start test for a pinned non-interpreter binary, narrowing sys.executable in a frozen POSIX build). Documentation only; the Lumina HTTP routes still do not call the runner. Verified the name examples against _executable_policy_refused (orca_v2 and my-cura.bin refused, mycuracao allowed). Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Owner
Author
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.
Draft for review. Opus APPROVE-WITH-NOTES, Sol APPROVE-WITH-NOTES on the Lumina bytes (943c9a8) and again on the later delta (6ccab7f: docs correction plus the two lifeline test commits) (Sol's earlier HIGH on executable admission is CLOSED under the trusted-caller model below). Depends only on #139 (base
feat/lumina-adapter); #139 is unchanged. Merge and release are not authorized.What
/engines/lumina/{formats,status,generate}registered through the existing/enginesseam, and a Studio+ (Advanced) "Lumina" view. Format (3mf/png/glb) is an explicit user choice, never inferred; the result is a NEW file created exclusively in a Studio-owned folder; no full path appears in any response; netguard (loopback/LAN) applies. Private image-path guard (local_input.py) is interim; feat: Phase 2 portfolio tracks P2, P4-P8 with shared local-path guard (R4-F1 fixed via #147; Opus+Sol approved f40a18d) #140's shared localpath should replace it.CliRunnerhardening: POSIX process group, Windows kill-on-close Job Object, failed-run job-dir removal, slicer-name rail, and identity-based admission.CliRunner; it has no production caller. It was not wired in only to demonstrate the pin.Findings by component
HTTP integration (
routes_engines.py,local_input.py, UI, mock): Opus O1 (NT\??\prefix) fixed; O6 wording fixed; O5, O8, O9 carried.Generic CLI runner (
cli_runner.py): Sol HIGH (renamed slicer copy passed a basename check) fixed; Opus O2 (refuse the Windows launcher when frozen), O3 (slicer-name tokens), O10 (-I) fixed; O4, O7 carried.Executable admission, trusted-caller model
sys.executableis exempt and can run arbitrary Python.approved_sha256) approves exact bytes, not behaviour.This is a safety rail, not a sandbox, and not a guarantee against slicing.
Review
Round 1 (27c6e4c): Opus AWN; Sol BLOCK HIGH. Round 2 (943c9a8, artifact 5f72698e11ff7966b31845f4de6e87418e22d59e9f87a5d081bec3fd871d7ad5): Opus AWN, Sol AWN with no findings.
Carried, not fixed: Opus N1 (MEDIUM, optional) hash is not re-checked before each
run(); N2 in a frozen POSIX buildsys.executableis the sidecar and is admitted without a pin; N3 ENGINES.md does not yet state bytes-not-behaviour or the no-auto-approve rule; N4 docs lag the token matching and the packaged-app refusal; N5 no test runs a pinned non-interpreter binary through the launcher; O4, O5, O7, O8, O9.Evidence labels
fixture-tested and mock-service-tested (synthetic loopback
LuminaHttpMock). No real Lumina was run. The matching-pin test is admission-only; lifecycle tests usesys.executableand do not prove an arbitrary pinned binary starts. Python 3.14 locally: engines + ext_routes + routes_engines_lumina + foundation 872 passed, 2 skipped; vitest 1369 and tsc clean at the first freeze. Python 3.13 confirmation is CI's.🤖 Generated with Claude Code
CI note
The first CI run failed one test,
tests/test_lifeline.py::test_noop_when_stdin_is_not_a_pipe('RegularFileStat' object has no attribute 'st_size'), on ubuntu and windows (Python 3.13). That test patches the process-wideos.fstat; the likely trigger (inferred from the traceback, not reproduced locally) is a thread left by the new runner tests callingos.fstatwhile it is patched. Two test-only commits cherry-picked from the open PR #134 (0e5c959, 9bd7df7; now 38ce6bb, 117adb5 here) give that test its ownosview. They are identical in content to #134, so the later merge is a no-op for them. These two commits were not part of the frozen review artifact; they change one test file only.Delta review of the post-freeze commits (6ccab7f)
Artifact 5ab465fd; Opus APPROVE-WITH-NOTES, Sol APPROVE-WITH-NOTES (no findings). The two lifeline test commits (38ce6bb, 117adb5) have the same
git patch-id --stableas #134's 0e5c959 and 9bd7df7; #134 itself has no formal review, so this is their first review. Reviewers confirmed they isolate only the test's view ofosand do not weaken assertions. Notes carried, not fixed:_forbid_threadstill patches the sharedthreading.Thread, so the comment "nothing global is patched" intest_lifeline.pyis inaccurate and a sibling race is possible (kept identical to #134 on purpose); the stray runner thread that outlives its test is not fixed (F6/F9 lifecycle follow-ups); ENGINES.md does not state the 64-hex pin format or that symlinks are checked under the target's name.docs/internal/ENGINES.mdnow states the admission model as the code implements it: token matching, name rail before identity,sys.executableexempt, pins approve bytes not behaviour, hash read at construction only, no auto-approving an untrusted hash, packaged-Windows refusal, frozen-POSIXsys.executableadmitted, and the optional runner changes not done (re-hash before each run, a start test for a pinned non-interpreter binary, narrowingsys.executablein a frozen POSIX build). The Lumina HTTP routes still do not callCliRunner.