]> Piment Noir Git Repositories - e-mobility-charging-stations-simulator.git/commit
feat(ocpp2): implement in-memory auth cache with rate limiting and TTL
authorJérôme Benoit <jerome.benoit@sap.com>
Tue, 18 Nov 2025 18:14:47 +0000 (19:14 +0100)
committerJérôme Benoit <jerome.benoit@sap.com>
Tue, 18 Nov 2025 18:14:47 +0000 (19:14 +0100)
commitaee1e3db9b3d277c43a10e1cbb14ada1622f116f
tree0cc331df14ef503eddbdc287f8b4f4960433536a
parent53abd803555e72facb73db72f571a98902ab0bb5
feat(ocpp2): implement in-memory auth cache with rate limiting and TTL

Add InMemoryAuthCache with comprehensive security features:
- LRU eviction when cache reaches capacity
- TTL-based automatic expiration (configurable, default 1h)
- Built-in rate limiting (10 req/min per identifier, configurable)
- Memory usage tracking and comprehensive statistics
- 45 conformance tests covering G03.FR.01 requirements

Security improvements:
- Mitigates S2 (rate limiting prevents DoS on auth endpoints)
- Mitigates S3 (TTL prevents stale authorization persistence)
- Tracks evictions, hits, misses, expired entries

Completes Phase 2.3 (Security Hardening) and G03.FR.01 cache tests.
src/charging-station/ocpp/auth/cache/InMemoryAuthCache.ts [new file with mode: 0644]
src/charging-station/ocpp/auth/cache/index.ts [new file with mode: 0644]
tests/charging-station/ocpp/auth/cache/InMemoryAuthCache.test.ts [new file with mode: 0644]