Skip to content

fix: run only the exact job the data owner approved - #9536

Merged
rasswanth-s merged 4 commits into
devfrom
rasswanth/job_hash
Oct 1, 2026
Merged

rasswanth-s merged 4 commits into
devfrom
rasswanth/job_hash

Conversation

@rasswanth-s

@rasswanth-s rasswanth-s commented Sep 30, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

A data owner approves a job after reviewing its code, but the runner read the code from the
data scientist's inbox folder at run time — and the data scientist can keep writing there.
So a data scientist could swap in different code after approval, and it would run against
private data. Now a job is fingerprinted (hashed) when it arrives and when it is approved,
and only a copy that matches the approved fingerprint ever runs.

What changes for users

  • Data scientists: nothing to do. Submissions now carry a fingerprint of the code, so the
    data owner can tell when every file has arrived.
  • Data owners: a job shows up as pending only once all its files have arrived. If the
    data scientist changes a job after it arrived, approval is refused; if it changes after
    approval, the job fails instead of running the new code.
  • Jobs approved before this upgrade (but not yet run) go back to pending and need approving again.

How it works

  1. Received — the data scientist declares a hash of run.sh + code/. The data owner
    receives the job only when the files match it, records the hash, and makes that job's inbox
    folder read-only for the data scientist.
  2. Approved — approval checks the job is unchanged since it arrived and records the
    approved hash (in staging/…/submission.json, which only the data owner can write).
  3. Run — the runner copies the job to a temporary folder outside the SyftBox, checks the
    copy against the approved hash, and runs it there. Outputs still land in review/.

Also fixed along the way: job outputs and .venv are no longer created in the data
scientist's readable inbox, and the enclave no longer distributes jobs that are still
arriving or were rejected.

Testing

  • New tests: an edit after approval does not run; approval is refused for a changed job;
    jobs without an approved hash go back to pending; a job is received only when complete
    (with and without a declared hash); symlinks are rejected; the inbox is read-only after receipt.
  • Updated three existing tests that relied on the old behaviour.
  • syft-job, syft-enclave, syft-rds and tests/unit pass (apart from existing macOS path tests).

Asana task

🤖 Generated with Claude Code

rasswanth-s and others added 2 commits September 30, 2026 18:28
Pulls the new-receipt work out of JobClient.receive_job() into
_claim_receipt(), and the run reporting out of
SyftJobRunner._run_approved_job() into _report_result() and
_mark_running(). The expected-digest check now lives once, in
submission.py: check_expected_digest(), for both approve() paths.
Renames _record_pending_job() to _record_received_hash().

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Brings in #9515 (Tinfoil deployment, signed job receipts) and #9533
(narrow DS read grant on review/). Conflicts were only in imports:
syft_job client.py and job_runner.py keep both the review_grants and the
submission imports. Also drops the duplicate module logger in the enclave
client that both sides added.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

@pjwerneck pjwerneck left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great PR. Left two comments with suggestions, not blockers.

… older pending jobs

An OSError while copying a job to its run folder is a problem on the data
owner's machine, not a changed submission. The runner now logs a warning,
removes the run folder and leaves the job approved, so the next cycle
retries it; a hash mismatch or invalid submission still fails the job, and
nothing unverified runs.

A pending job received before submission hashes existed now gets the same
read-only inbox lock as a new job, once, when its received hash is recorded.

Addresses review comments on #9536.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@rasswanth-s
rasswanth-s merged commit 36e6516 into dev Oct 1, 2026
20 checks passed
@rasswanth-s
rasswanth-s deleted the rasswanth/job_hash branch October 1, 2026 12:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants