Skip to main content
Glama

cronlint

CI tests-189%20passing dependencies-0 license-MIT

Crontab security audit with the byte offsets that prove each finding. 35 rules over three passes — expression, task, file — zero dependencies, SARIF for CI, MCP server. Reads the 5-field standard, 6-field cronie (leading seconds), 7-field Quartz (trailing year), @special names, and the /etc/crontab user column.

中文文档:README_CN.md

uvx --from "git+https://github.com/xuange-hu/cronlint" cronlint demo

Contents

Related MCP server: civet

Why a cron linter

Crontab entries fail quietly. Four failure modes a shell never warns you about:

  1. A six-field schedule is read three different ways. cronie reads a leading seconds field, Quartz reads a trailing year, and /etc/crontab reads a user column between the schedule and the command. Get the shape wrong and the command you think you scheduled runs at a different time — or under a different user. cronlint decides the shape per line, tells you which one it chose, and flags the ambiguous ones (CRN002/CRN003).

  2. DOM and DOW together are an OR, not an AND. 0 0 1 * mon fires on the 1st and every Monday. Almost everyone reads it as "the Monday that is the 1st" (CRN006).

  3. The command line is a credential display. --password=hunter2 is visible in ps to every user on the box for the whole run (CRN014).

  4. Nothing warns you that two jobs write the same log in the same minute, or that an every-minute job has no lock and stacks copies of itself (CRN050–CRN058).

Pass

Reads

Catches

1

one schedule

unparseable fields, seconds/year shapes, unknown @special, out-of-range values, DOM+DOW OR, weekday 7, no command

2

one task line

relative paths, world-writable dirs, unquoted expansion, command substitution, credentials, curl | sh, device redirects, rm -rf, no shebang, interactive-only tools

3

the whole file

duplicate schedules, same script twice, two jobs in the same minute, shared log files, every-minute jobs without flock, file with no tasks

Every finding carries file:line, a byte offset, the offending slice, and a fix.

3-step start

pip install "cronlint @ git+https://github.com/xuange-hu/cronlint"

# 1. the built-in broken corpus — proves the tool works in 5 seconds
cronlint demo

# 2. audit every crontab in your repo
cronlint scan .

# 3. gate CI on it
cronlint scan /etc/cron.d --sarif > cronlint.sarif --fail-on high

Expected demo output (185 findings, all 35 rules exercised):

=== cron.d ===
cron.d
  170 finding(s)  critical=3  high=27  medium=112  low=28  note=0  risk=100/100

[critical] CRN014  Credential on the command line
           credential is passed as an argument and is visible in the process list
           line 10, offset 0x10a+18  (line 10: /opt/backup/nightly.sh --password=hunter2)
           saw:   --password=hunter2
           fix:   Read the secret from a root-only file or a keyring; never put it in the command.

[high    ] CRN054  Every-minute job with no lock
           fires every minute with nothing preventing a second copy
           line 9, offset 0xc5+9  (line 9: /tmp/refresh.sh)
           saw:   * * * * *
           fix:   Wrap it: `flock -n /run/job.lock /path/to/job`.

corpora: 3, findings: 185
rules fired: 35/35

demo ends with rules fired: 35/35 — every rule in docs/rules.md has a sample line in the corpus that triggers it, so the demo doubles as the rule regression suite.

Shapes it understands

Line

Shape

How cronlint decides

*/5 * * * * /usr/bin/job

standard

five fields

*/5 * * * * * /usr/bin/job

six fields

sixth token not a schedule field → command

0 0 12 * * ? 2026 /job

year

two field-shaped tokens after five

@daily /job

special

@ name, @reboot allowed

* * * * * root /job

user column

path is /etc/crontab or /etc/cron.d/

Unsure which shape your six fields are? Say so:

cronlint scan file --assume-seconds   # force leading-seconds reading
cronlint scan file --standard         # force 5 fields + command
cronlint scan file --assume-user      # force the /etc/crontab user column

Exit codes gate CI

Code

Meaning

0

nothing at or above --fail-on (default high)

1

something was

2

input could not be read

cronlint scan . --fail-on critical --json | jq '.findings[].rule_id'

MCP server

pip install "cronlint[mcp] @ git+https://github.com/xuange-hu/cronlint"
cronlint-mcp

Six tools: cronlint_scan, cronlint_text, cronlint_rules, cronlint_explain, cronlint_sarif, cronlint_demo. The mcp package is imported inside build_server() only — the CLI never loads it (tests/test_packaging.py asserts this statically).

Install from a clone

git clone https://github.com/xuange-hu/cronlint
cd cronlint
pip install -e ".[mcp]" pytest ruff
pytest          # 189 tests
ruff check src tests

No install is needed to run the tests after a clone — the root conftest.py puts src/ on sys.path.

License

MIT. See LICENSE.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      B
      maintenance
      Static compliance-controls checker that verifies regulatory required controls exist in code, running deterministic rule packs via MCP tools for compliance checks, rule listing, and explanation.
      112 npm
      1
      MIT
    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables auditing GitHub Actions workflows for security problems directly from an MCP client, returning a risk score and findings with file:line evidence, attack narratives, and fixes. Also exposes the full rule catalog and a one-call demo that writes and scans a deliberately broken workflow.
      MIT
    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables scanning paths and pasted snippets for credential leaks, building and diffing baselines, listing rules, assessing entropy, producing SARIF, and running a demo through MCP tools.
      MIT
    • A
      license
      Not graded
      quality
      B
      maintenance
      Lets an agent inspect and audit MCP servers before connecting to them, checking their exposed tools, prompts and resources for tool poisoning, shadowing, excessive permissions, leaked secrets and unsafe transports against 24 deterministic rules. Results are returned as findings with evidence, remediation and CWE/OWASP references, and can fail CI with SARIF, Markdown or standalone HTML reports.
      Apache 2.0