auditcmd: rate-limit burst tracking has no locking, letting concurrent calls race and undercount
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 76/100
Research direction
Start at guard/auditcmd/ratelimit_observe.go:33 and trace how concurrent calls update the burst and observation counters. Run the relevant Go tests with -race, then check that concurrent updates are synchronized and the final count matches the number of calls.
Written by the indexing model from the issue text.
Description
Problem
In packages/guard/auditcmd/ratelimit_observe.go:33, the read-modify-write sequence that updates burst/observation counters is not protected by any mutex or atomic operation, despite being reachable from concurrent goroutines handling simultaneous requests.
Impact
Concurrent calls can race on the same counter: two goroutines can both read the same pre-update value and each write back an increment based on it, losing one of the two updates. Under load this causes the rate-limit observation counts to undercount actual activity, which can let bursts that should have been flagged slip through analysis or alerting.
Repro
- Drive many concurrent calls into the code path that updates the observation counter (e.g. with
go test -raceexercising it from multiple goroutines, or a load test hitting the same action concurrently). - Compare the final counter value to the known number of calls made; observe it undercounts when run under
-raceor high concurrency, andgo test -raceflags the unsynchronized access.
Suggested fix
Protect the counter's read-modify-write with a sync.Mutex (or switch the counter to atomic.Int64/atomic.AddInt64) so concurrent updates cannot interleave and lose increments.
- Dominant language
- Go
- Stars
- 157
- Forks
- 19
- Avg merge
- 4h 32m
- Merged PRs (30d)
- 96
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from solongate/agent-security
-
bug
Difficulty 1/5 Under an hour Newbie friendliness 91/100
solongate/agent-security#226 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
solongate/agent-security#223 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
solongate/agent-security#220 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
solongate/agent-security#215 ·
Maintainers usually reply within 1 day
-
hooks: baked guard-binary path isn't quote-escaped, can produce invalid JS for the OpenCode pluginOpenbug help wanted
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
solongate/agent-security#207 ·
Maintainers usually reply within 1 day
All issues in solongate/agent-security
Similar issues
-
ux
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
evcc-io/evcc#35605 · 1 comment ·
Maintainers usually reply within 1 day
-
bug report
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
Maintainers usually reply within 1 day
-
type:bug
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
nightgauge/nightgauge#2732 ·
Maintainers usually reply within 1 day
-
fix below CVEsOpenbug
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 5 days
-
good first issue help wanted
Difficulty 2/5 1-3 hours Newbie friendliness 78/100