fix(cron): normalize flat legacy job rows#71534
Conversation
🔒 Aisle Security AnalysisWe found 1 potential security issue(s) in this PR:
1. 🟠 DoS risk: legacy flat schedule hydration enables extremely frequent schedules (everyMs/cron) without minimum interval validation
DescriptionThe new legacy hydration path This makes it possible for attacker-controlled or corrupted stored job rows using legacy flat fields (e.g., Key points:
Vulnerable code: for (const field of ["at", "atMs", "everyMs", "anchorMs", "expr", "cron", "tz", "staggerMs"]) {
if (field in next) {
schedule[field] = next[field];
}
}
...
next.schedule = inferredSchedule;If cron job definitions can be influenced by untrusted users (API input) or by tampering with persisted job specs (store), this can be used to trigger resource exhaustion by creating jobs that are due continuously. RecommendationEnforce schedule safety constraints during normalization (and ideally also at persistence boundaries):
Example (enforce a minimum interval in const MIN_EVERY_MS = 1000;
...
if (next.kind === "every") {
const everyMsRaw = coerceFiniteScheduleNumber(schedule.everyMs);
if (everyMsRaw === undefined || everyMsRaw < MIN_EVERY_MS) {
throw new Error(`invalid everyMs: must be >= ${MIN_EVERY_MS}`);
}
next.everyMs = Math.floor(everyMsRaw);
}And for cron, compute the next two run times and enforce that the delta is >= the minimum cadence, rejecting expressions that violate the policy. Analyzed PR: #71534 at commit Last updated on: 2026-04-25T10:30:43Z |
Greptile SummaryThis PR adds normalization for legacy flat cron job rows (where Confidence Score: 5/5This PR is safe to merge — no logic errors or regressions found. The normalization pipeline is correct: No files require special attention. Reviews (1): Last reviewed commit: "fix(cron): normalize flat legacy job row..." | Re-trigger Greptile |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c0b8596051
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| - Google video generation: download direct MLDev Veo `video.uri` results instead of passing them through the Files API path, fixing 404s after successful generation/polling. Fixes #71200. Thanks @panhaishan. | ||
| - Google video generation: fall back to the REST `predictLongRunning` Veo endpoint for text-only SDK 404s while keeping reference image/video generation on the SDK path. Fixes #62309 and #63008. (#62343) Thanks @leoleedev. | ||
| - MiniMax music generation: switch the bundled default model from the unsupported `music-2.5+` id to the current `music-2.6` API model. Fixes #64870 and addresses the music default from #62315. Thanks @noahclanman and @edwardzheng1. | ||
| - Cron: hydrate flat legacy job rows with top-level `cron`, `tz`, `session`, and `message` fields into canonical schedule, target, and payload objects before startup recomputes run times. Fixes #43351. |
There was a problem hiding this comment.
Add "Thanks @author" attribution to changelog entry
The new changelog bullet is missing contributor attribution, which violates the repo rule in AGENTS.md that says every added entry must include at least one Thanks @author. This is likely to be flagged during maintainer review and makes the release note inconsistent with the required changelog format.
Useful? React with 👍 / 👎.
| delete next.cron; | ||
| delete next.tz; | ||
| delete next.at; | ||
| delete next.atMs; | ||
| delete next.everyMs; |
There was a problem hiding this comment.
Strip top-level
expr when normalizing legacy cron rows
inferTopLevelSchedule now accepts flat legacy expr values, but the legacy-field stripping block does not remove next.expr. That leaves an extra top-level expr after normalization, so cron.add/cron.update requests using flat legacy expr still fail schema validation (additionalProperties: false) even though a canonical schedule.expr was produced.
Useful? React with 👍 / 👎.
Summary
cron,tz,session, andmessageinto canonicalschedule,sessionTarget, andpayloadtoolsaspayload.toolsAllowand remove the obsolete top-level flat fields from the normalized in-memory shape.kindFixes #43351.
Related to #38766 and #57640.
Validation
pnpm test src/cron/normalize.test.ts src/cron/service/store.load-missing-session-target.test.ts src/cli/cron-cli/shared.test.tsOPENCLAW_LOCAL_CHECK=0 pnpm check:changed