fix(scheduler): harden provenance trust boundary and push recent-runs query into SQL#6125
Merged
Merged
Conversation
… query into SQL Force TaskProvenance::External on all DB-hydrated jobs at init() instead of trusting the writer-controllable provenance column verbatim. This closes a latent (currently unreachable) spoofing gap where a direct-SQL actor could self-label a row as UserAdded or Static to dodge the RTW-A re-entry defenses added in a prior fix. Push daemon_status's recent-runs ordering and limit into SQL via new JobStore::list_recent_runs/count_active_jobs methods, replacing the fetch-all-then-sort-in-Rust approach, using a dual-backend-safe `ORDER BY last_run IS NULL, last_run DESC LIMIT ?` in place of Postgres-only NULLS LAST syntax. Remove unused blake3 and uuid dependencies from zeph-scheduler.
bug-ops
enabled auto-merge (squash)
July 12, 2026 01:13
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.
Summary
TaskProvenance::Externalon all DB-hydrated jobs atScheduler::init()instead of trusting the writer-controllableprovenancecolumn verbatim. Closes a latent (currently unreachable) trust-model gap where a direct-SQL actor could self-label a row asUserAdded/Staticto dodge the RTW-A re-entry defenses. Hardening / defense-in-depth, not a fix for an active exploit.daemon_status's recent-runs ordering and limit into SQL via newJobStore::list_recent_runs/count_active_jobsmethods, replacing the fetch-all-then-sort-in-Rust approach, using a dual-backend-safeORDER BY last_run IS NULL, last_run DESC LIMIT ?in place of Postgres-onlyNULLS LASTsyntax.blake3anduuiddependencies fromzeph-scheduler.Closes #6114
Closes #6115
Closes #6098
Test plan
cargo +nightly fmt --checkcargo clippy --profile ci --workspace --all-targets --features "desktop,ide,server,chat,pdf,scheduler,testing" -- -D warningscargo nextest run --config-file .github/nextest.toml --workspace --features "desktop,ide,server,chat,pdf,scheduler" --lib --bins -E 'package(zeph-scheduler)'— 116/116 passed, including two new regression testsRUSTFLAGS="-D warnings" RUSTDOCFLAGS="--deny rustdoc::broken_intra_doc_links" cargo doc --no-deps -p zeph-scheduler --features daemonorigin/main(three unrelated upstream commits), clean rebase, full check suite re-run post-rebase