v1.0.0

Temporary Blocking

Last updated


This page explains Block's exponentially growing duration, how repeated blocks accumulate on the record, and the risk when BlockTimeMin / BlockTimeMax are 0.

Duration


  1. if err := sentry.Manager.Block.Add("192.0.2.33", "manual review"); err != nil {
  2. log.Printf("block: %v", err)
  3. }

CallRecord countDuration
1st (not currently blocked)1BlockTimeMin
nth (still blocked, n ≥ 2)n2^n × BlockTimeMin, capped at BlockTimeMax

With BlockTimeMin = 5m and BlockTimeMax = 24h (the first 4 rows are measured):
CallRedis TTL
15m
220m
340m
41h20m
924h (cap)

Once a block expires the key disappears, and the next Add starts from the 1st call again.

Block Record


block:{ip} holds an IPItem as JSON:
Field1st callEach later call
reasonThis reasonAppends this reason after a newline
added_atNowUnchanged
count1Increments
lastNowUpdated to now

Zero-Value Risk


BlockTimeMin and BlockTimeMax have no defaults, and a Redis SET expiry of 0 means never expire:
SettingResult
BlockTimeMin = 0Every block is permanent
BlockTimeMin > 0, BlockTimeMax = 0The 1st block works; from the 2nd on the cap forces the duration to 0, making it permanent

Set both to positive values.
To query or lift a block, see Managing Blocks.
中文