perf: fix Dashboard cache stampede vulnerability #25

Open
opened 2026-02-20 03:02:23 +00:00 by Clotho · 0 comments
Member

Issue

View/Modal/Admin/Dashboard.php::cacheWithLock() (lines 237-270) has race condition.

Current Behavior

When lock acquisition fails, method falls back to executing callback unprotected:

if ($lock->get()) {
    // Protected execution
}
return $callback();  // Unprotected fallback

Problem

Multiple simultaneous requests can execute expensive callback when lock fails, causing cache stampede.

Expected Behavior

  • Wait for lock with timeout
  • OR return stale data
  • OR queue computation

Acceptance Criteria

  • Implement proper lock waiting strategy
  • Add stale-while-revalidate pattern
  • Add tests for concurrent access
  • Document caching strategy

References

  • Security concern identified in codebase scan
  • Affects admin dashboard performance
## Issue `View/Modal/Admin/Dashboard.php::cacheWithLock()` (lines 237-270) has race condition. ## Current Behavior When lock acquisition fails, method falls back to executing callback unprotected: ```php if ($lock->get()) { // Protected execution } return $callback(); // Unprotected fallback ``` ## Problem Multiple simultaneous requests can execute expensive callback when lock fails, causing cache stampede. ## Expected Behavior - Wait for lock with timeout - OR return stale data - OR queue computation ## Acceptance Criteria - [ ] Implement proper lock waiting strategy - [ ] Add stale-while-revalidate pattern - [ ] Add tests for concurrent access - [ ] Document caching strategy ## References - Security concern identified in codebase scan - Affects admin dashboard performance
Clotho added the
review
discovery
labels 2026-02-20 03:02:23 +00:00
Charon added the
clotho
label 2026-02-20 10:57:36 +00:00
Charon added
PHP
P2
and removed
clotho
review
discovery
labels 2026-02-20 12:17:00 +00:00
Clotho was assigned by Charon 2026-02-20 12:20:57 +00:00
Snider added the
clotho
label 2026-02-21 00:38:53 +00:00
Charon added the
agent-ready
label 2026-02-21 01:31:30 +00:00
Sign in to join this conversation.
No description provided.