Skip to content

[Security] Make runtime job types semantically safe#241

Open
fettpl wants to merge 4 commits into
sybil-solutions:mainfrom
fettpl:p1/issue-223-runtime-job-types
Open

[Security] Make runtime job types semantically safe#241
fettpl wants to merge 4 commits into
sybil-solutions:mainfrom
fettpl:p1/issue-223-runtime-job-types

Conversation

@fettpl

@fettpl fettpl commented Jul 17, 2026

Copy link
Copy Markdown

Summary

Makes runtime job types match the operations the controller actually implements. Unsupported inspect and download requests now fail before queue creation instead of falling through to mutation-producing install or update behavior.

Closes #223

Dependency

Depends on #244. The branch is stacked on its release-gating repair so the repository's current quality gate remains green. The issue-specific runtime-job delta is six files on top of that prerequisite.

Root cause

The public EngineJob contract advertised install, update, download, and inspect, while the executor only implemented install and update. Its fallback paths could therefore turn an unsupported, apparently read-only operation into a mutation.

Solution design

  • Define one shared RUNTIME_JOB_TYPES tuple and derived RuntimeJobType contract containing only install and update.
  • Validate runtime-job request bodies at the HTTP boundary with Effect Schema and reject unsupported types before creating a job.
  • Keep request-controlled command and args forbidden.
  • Dispatch supported job types exhaustively, without a catch-all mutation fallback.
  • Reject platform install jobs explicitly without invoking the platform upgrade handler.
  • Map explicit backend upgrade routes to update.
  • Narrow the frontend API payload to the same shared contract.
  • Keep the existing job registry, retention, cancellation, and query APIs unchanged.

Acceptance criteria

  • inspect and download return HTTP 400 for engine and platform runtimes without queueing work.
  • Engine install and update requests reach only their intended handlers.
  • CUDA and ROCm installs fail without invoking an upgrade; updates still invoke the platform handler.
  • An omitted type retains the documented update default.
  • Explicit upgrade routes map to update behavior.
  • Request-controlled commands and arguments are rejected before dispatch.
  • Effect cancellation remains effective for a running supported job.

Validation

  • Reviewed and published exact head: e4ec7a83498309c7ede8d23c02fc9094034f86fb.
  • Focused boundary suite: 31 tests, 83 assertions, 0 failures.
  • Controller typecheck, lint, dependency, duplicate, dead-code, and standards gates: passed.
  • npm --prefix frontend run check:quality: passed.
  • npm run check: passed, including contracts, structure, frontend production build, and controller gates.
  • Normal pre-push hook: passed again while publishing the exact reviewed head.
  • npm --prefix frontend run desktop:dist: passed.
  • Canonical /Applications/Local Studio.app reinstall: strict deep code-signature verification passed, bundle ID is org.local.studio.desktop, and GET /api/desktop-health returned HTTP 200.
  • A Developer ID identity was unavailable locally, so the verification bundle was ad-hoc signed with the repository entitlements; no release asset was signed or published.

Current main does not define npm run test:integration or a generic npm --prefix frontend run test script, so those unavailable commands are not represented as passing.

UI changes

None. The shared frontend client type is narrowed, but there are no visual or interaction changes.

Risks and rollout

  • External clients that still send inspect or download now receive an intentional 400 response instead of triggering an unintended mutation.
  • Supporting either operation in the future requires a dedicated handler and tests before its label is restored to the shared contract.
  • No persistence migration is required.
  • Merge [CI/CD] Gate every release on the exact commit that passed CI #244 first, then refresh this branch onto main if GitHub does not remove the stacked prerequisite automatically.

@fettpl
fettpl force-pushed the p1/issue-223-runtime-job-types branch from d6609bd to 1639cc6 Compare July 17, 2026 22:28
@fettpl

fettpl commented Jul 17, 2026

Copy link
Copy Markdown
Author

@0xSero This ready/non-draft fork PR now points to independently reviewed exact head e4ec7a8. Local focused, controller, full-repository, pre-push, production desktop, strict installed-signature, and live desktop-health validation passed. Its current-head workflows are waiting at GitHub’s fork approval gate: CI run 29731190757 and Security run 29731190634. Please approve these runs when convenient.

@fettpl
fettpl marked this pull request as ready for review July 18, 2026 04:59
@fettpl
fettpl requested a review from 0xSero as a code owner July 18, 2026 04:59
@fettpl
fettpl force-pushed the p1/issue-223-runtime-job-types branch from b1caabd to e4ec7a8 Compare July 20, 2026 09:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Security] Make runtime job types semantically safe

1 participant