Dodaios is an open-source agent OS for your desktop: it runs your coding agents, browser and apps by voice or chat, on your own machine. Formerly Personal Jarvis.
Python agent-orchestrationai-agentai-coding-assistantclaude-codecoding-agentcomputer-usedesktop-applocal-firstmcppersonal-jarvisvoice-assistantvoice-coding
fix(security): disable the demo webhook and force-regenerate its predictable seed token
Ruben Lütkefd2ed6a4fdaf
diff --git a/conductor/api/routes.py b/conductor/api/routes.pyindex 7ae9da54a2..63e3f278ff 100644--- a/conductor/api/routes.py+++ b/conductor/api/routes.py@@ -10,12 +10,11 @@ Without a store: 503.from __future__ import annotationsimport json-import secretsfrom typing import Anyfrom fastapi import APIRouter, Body, HTTPException, Request-from ..core.schema import Job+from ..core.schema import Job, regenerate_weak_webhook_tokenrouter = APIRouter(prefix="/api/conductor", tags=["conductor"])@@ -95,12 +94,9 @@ async def list_jobs(request: Request) -> dict[str, Any]:@router.post("/jobs", status_code=201)async def create_job(job: Job, request: Request) -> dict[str, Any]:store = _require_store(request)- # If the schedule is a webhook without a token: generate one.- if job.schedule.type == "webhook" and len(job.schedule.token) < 16:- new_token = secrets.token_urlsafe(24)- job = job.model_copy(- update={"schedule": job.schedule.model_copy(update={"token": new_token})}- )+ # If the schedule is a webhook with a weak (too-short or known-shipped)+ # token: generate a fresh one.+ job = regenerate_weak_webhook_token(job)jid = await store.upsert_job(job)return {"id": jid}diff --git a/conductor/core/schema.py b/conductor/core/schema.pyindex 9c071d9ced..84c951aba4 100644--- a/conductor/core/schema.py+++ b/conductor/core/schema.py@@ -16,6 +16,7 @@ Three central design decisions:"""from __future__ import annotations+import secretsfrom typing import Annotated, Any, Literalfrom uuid import UUID, uuid4@@ -165,6 +166,34 @@ class Job(BaseModel):tags: tuple[str, ...] = Field(default_factory=tuple)+# The seed catalog (``conductor/seed/webhook_demo.yaml``) ships this exact+# literal as a placeholder. It is 38 characters, so it passes+# ``WebhookSchedule.token``'s ``min_length=16`` untouched — length alone+# cannot flag it as weak, it must be matched by value.+_KNOWN_WEAK_WEBHOOK_TOKENS = frozenset({+ "demo_token_change_me_in_production_1234",+})+++def regenerate_weak_webhook_token(job: Job) -> Job:+ """Replaces a job's webhook token with a fresh random one if it is weak.++ "Weak" covers both a too-short token and a token equal to a known,+ publicly-shipped literal (which a length check alone would miss).+ Non-webhook jobs are returned unchanged. Shared by the create-job API+ route and the seed loader so both regenerate through the same path.+ """+ if job.schedule.type != "webhook":+ return job+ token = job.schedule.token+ if len(token) >= 16 and token not in _KNOWN_WEAK_WEBHOOK_TOKENS:+ return job+ new_token = secrets.token_urlsafe(24)+ return job.model_copy(+ update={"schedule": job.schedule.model_copy(update={"token": new_token})}+ )++class Run(BaseModel):"""One concrete run of a job."""model_config = ConfigDict(frozen=True, extra="forbid")diff --git a/conductor/core/seed.py b/conductor/core/seed.pyindex 998f969c6c..a6a26025c3 100644--- a/conductor/core/seed.py+++ b/conductor/core/seed.py@@ -15,7 +15,7 @@ from typing import Anyimport yaml-from .schema import Job+from .schema import Job, regenerate_weak_webhook_tokenfrom .store import ConductorStorelog = logging.getLogger(__name__)@@ -24,9 +24,15 @@ SEED_YAML_DIR = Path(__file__).resolve().parent.parent / "seed"async def load_job_from_yaml(yaml_path: Path) -> Job:- """Parses a YAML file into a validated ``Job`` model."""+ """Parses a YAML file into a validated ``Job`` model.++ Any webhook token equal to a known, publicly-shipped placeholder (or+ otherwise too short) is force-regenerated — a seed YAML is checked+ into a public repo, so its committed token is never a secret.+ """data: dict[str, Any] = yaml.safe_load(yaml_path.read_text(encoding="utf-8"))- return Job.model_validate(data)+ job = Job.model_validate(data)+ return regenerate_weak_webhook_token(job)async def ensure_seed_jobs(diff --git a/conductor/seed/webhook_demo.yaml b/conductor/seed/webhook_demo.yamlindex a895dbae3e..531d21740a 100644--- a/conductor/seed/webhook_demo.yaml+++ b/conductor/seed/webhook_demo.yaml@@ -5,9 +5,11 @@ name: Webhook-Pingdescription: >Example of an externally-triggered job. Call the webhook URL fromwherever (GitHub Action, Zapier, Shortcuts.app, curl) — this- job fires once. The token is set to the one stored here during- seeding; regenerate it for production.-enabled: true+ job fires once. Ships disabled: enable it explicitly once you have+ reviewed the shell step. The token below is a placeholder only —+ the seed loader always replaces it with a fresh random one, so the+ literal here is never the one actually stored.+enabled: falsetags: [demo, webhook]spec:type: shelldiff --git a/tests/unit/conductor/test_core.py b/tests/unit/conductor/test_core.pyindex db8f7a2700..52532bb580 100644--- a/tests/unit/conductor/test_core.py+++ b/tests/unit/conductor/test_core.py@@ -376,3 +376,70 @@ async def test_seed_dir_exists() -> None:assert SEED_YAML_DIR.exists()yamls = list(SEED_YAML_DIR.glob("*.yaml"))assert len(yamls) >= 3+++# ---------------------------------------------------------------------+# Seed security: demo webhook must not ship enabled with a known token+# (AP-23 wave-2 audit, finding 4).+# ---------------------------------------------------------------------++_DEMO_WEBHOOK_TOKEN = "demo_token_change_me_in_production_1234"+++async def test_webhook_demo_seed_ships_disabled() -> None:+ """A demo job on a shell-exec webhook path must not ship live."""+ from conductor.core.seed import load_job_from_yaml+ job = await load_job_from_yaml(SEED_YAML_DIR / "webhook_demo.yaml")+ assert job.enabled is False+++async def test_load_job_from_yaml_regenerates_known_demo_webhook_token() -> None:+ """The shipped, publicly-known demo token must never survive loading,+ even though it is 38 characters and would pass the min_length=16+ guard as-is."""+ from conductor.core.seed import load_job_from_yaml+ job = await load_job_from_yaml(SEED_YAML_DIR / "webhook_demo.yaml")+ assert job.schedule.type == "webhook"+ assert job.schedule.token != _DEMO_WEBHOOK_TOKEN+ assert len(job.schedule.token) >= 16+++async def test_load_job_from_yaml_generates_a_fresh_token_every_call() -> None:+ """Each load must mint a new random token, not one cached/fixed value —+ proving the fix truly regenerates rather than swapping in a second+ hardcoded constant."""+ from conductor.core.seed import load_job_from_yaml+ job_a = await load_job_from_yaml(SEED_YAML_DIR / "webhook_demo.yaml")+ job_b = await load_job_from_yaml(SEED_YAML_DIR / "webhook_demo.yaml")+ assert job_a.schedule.token != job_b.schedule.token+++async def test_ensure_seed_jobs_never_persists_known_demo_webhook_token(+ store: ConductorStore,+) -> None:+ """End-to-end: a fresh boot's seeding must not leave the shipped+ literal in the store, and the demo job must be disabled."""+ await ensure_seed_jobs(store)+ rows = await store.list_jobs()+ hook_row = next(r for r in rows if r["name"] == "Webhook-Ping")+ assert hook_row["webhook_token"] != _DEMO_WEBHOOK_TOKEN+ assert hook_row["webhook_token"] is not None+ assert len(hook_row["webhook_token"]) >= 16+ assert not hook_row["enabled"]+++async def test_ensure_seed_jobs_regenerates_token_after_forced_reseed(+ store: ConductorStore,+) -> None:+ """Forced re-seed (e.g. after the demo job was deleted) must not+ recreate it with the shipped literal token either."""+ await ensure_seed_jobs(store)+ rows = await store.list_jobs()+ hook_row = next(r for r in rows if r["name"] == "Webhook-Ping")+ await store.delete_job(hook_row["id"])++ await ensure_seed_jobs(store, force=True)++ rows = await store.list_jobs()+ hook_row_2 = next(r for r in rows if r["name"] == "Webhook-Ping")+ assert hook_row_2["webhook_token"] != _DEMO_WEBHOOK_TOKEN