grithdocs

17. Rate limiting

Per-category call volume, gated so that only risk-bearing operations can escalate.

Phase3, context
Score1.0, 2.0 or 3.0
Sourcecrates/grith-proxy/src/filters/rate_limit.rs
Configproxy.filters.rate_limit.enabled and proxy.rate_limit.risk_gated_burst - both default true

Per-session, per-category counters over a rolling minute and a 5-second burst window.

RuleFires whenScore
burst-detectedthe burst threshold is hit inside 5 seconds3.0
rate-exceededthe per-minute limit is passed2.0
rate-approachingover 80% of the per-minute limit1.0

The burst check runs first and wins.

The limits

Only seven categories have limits. A call in any other category is not counted and never scores here.

CategoryPer minuteBurst in 5s
file_read6015
dir_list6015
http_request6015
file_write3010
file_append3010
file_delete205
shell_exec205

Risk-gated bursting

proxy.rate_limit.risk_gated_burst defaults to true. With it on, a call is only counted - and only scored - when the operation itself bears risk:

  • the call arrives with taint attached, or
  • it is an HttpRequest or NetConnect, or
  • it is a ProcessSpawn the supervisor marked outbound-capable.

Everything else is skipped before it is even recorded, so a burst of routine churn - a build writing object files, .git metadata, ~/.cache - never inflates the window that a later risky call of the same category is measured against.

⚠️What that gives up

With the gate on, a fast untainted delete spree does not score here. That case is covered by the supervisor's target-aware mass-destruction signal instead. Setting proxy.rate_limit.risk_gated_burst = false restores the legacy behaviour, where every category's volume counts - and with it the routine-churn false positives the gate exists to remove.

Scope

Counters are keyed by supervised session and category, so a burst in one session does not raise the counter for the next. Unlike taint, rate limiting does not follow a conversation across sessions - a rate window is per-process-lifetime, and a new session correctly starts with a fresh budget.

Timestamps older than a minute are pruned on every call, so the window is genuinely rolling.

See also

Last updated: 2026-08-24Edit this page on GitHub →