Skip to content

fix(scheduler): harden provenance trust boundary and push recent-runs query into SQL#6125

Merged
bug-ops merged 1 commit into
mainfrom
fix/6114-scheduler-provenance-trust
Jul 12, 2026
Merged

fix(scheduler): harden provenance trust boundary and push recent-runs query into SQL#6125
bug-ops merged 1 commit into
mainfrom
fix/6114-scheduler-provenance-trust

Conversation

@bug-ops

@bug-ops bug-ops commented Jul 12, 2026

Copy link
Copy Markdown
Owner

Summary

  • Force TaskProvenance::External on all DB-hydrated jobs at Scheduler::init() instead of trusting the writer-controllable provenance column verbatim. Closes a latent (currently unreachable) trust-model gap where a direct-SQL actor could self-label a row as UserAdded/Static to dodge the RTW-A re-entry defenses. Hardening / defense-in-depth, not a fix for an active exploit.
  • 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.

Closes #6114
Closes #6115
Closes #6098

Test plan

  • cargo +nightly fmt --check
  • cargo clippy --profile ci --workspace --all-targets --features "desktop,ide,server,chat,pdf,scheduler,testing" -- -D warnings
  • cargo 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 tests
  • RUSTFLAGS="-D warnings" RUSTDOCFLAGS="--deny rustdoc::broken_intra_doc_links" cargo doc --no-deps -p zeph-scheduler --features daemon
  • Rebased onto latest origin/main (three unrelated upstream commits), clean rebase, full check suite re-run post-rebase

… 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.
@github-actions github-actions Bot added bug Something isn't working size/L Large PR (201-500 lines) labels Jul 12, 2026
@bug-ops
bug-ops enabled auto-merge (squash) July 12, 2026 01:13
@github-actions github-actions Bot added documentation Improvements or additions to documentation rust Rust code changes dependencies Dependency updates labels Jul 12, 2026
@bug-ops
bug-ops merged commit 416d178 into main Jul 12, 2026
43 checks passed
@bug-ops
bug-ops deleted the fix/6114-scheduler-provenance-trust branch July 12, 2026 01:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working dependencies Dependency updates documentation Improvements or additions to documentation rust Rust code changes size/L Large PR (201-500 lines)

Projects

None yet

1 participant