Buckets:
AnonymousSpottedToad/candidate_bucket / preliminary /mappings /python /limit_request_rate /SHAdd0WTAka_Zen-Ai-Pentest.json
| { | |
| "role_mappings": [ | |
| { | |
| "role": "Entity", | |
| "status": "present", | |
| "symbol": "scan", | |
| "file": "cli/src/kimi_pentest/main.py", | |
| "lines": "200", | |
| "notes": "In-repo CLI command `scan` sends POST /scans via APIClient.post (main.py:217) to default api_url http://localhost:8000/api/v1 (config.py:21), so every request passes through the global RateLimitMiddleware (Enforcer, api/rate_limiter.py:447). Requests are sent by APIClient._make_request (cli/src/kimi_pentest/api/client.py:39)." | |
| }, | |
| { | |
| "role": "Enforcer", | |
| "status": "present", | |
| "symbol": "__call__", | |
| "file": "api/rate_limiter.py", | |
| "lines": "447", | |
| "notes": "ASGI middleware RateLimitMiddleware.__call__, registered globally in api/main.py:574 via app.add_middleware; derives id from scope client IP, fetches the client's bucket (line 457), calls bucket.consume() (line 459) and returns 429 with Retry-After on block, otherwise forwards with self.app(...) (line 484)." | |
| }, | |
| { | |
| "role": "Limiter", | |
| "status": "present", | |
| "symbol": "consume", | |
| "file": "api/rate_limiter.py", | |
| "lines": "309", | |
| "notes": "Called by Enforcer __call__ at api/rate_limiter.py:459; TokenBucket.consume refills tokens via _add_tokens (line 300) from rate/burst policy and returns True/False (allow/block)." | |
| }, | |
| { | |
| "role": "HistoryProvider", | |
| "status": "present", | |
| "symbol": "get_bucket", | |
| "file": "api/rate_limiter.py", | |
| "lines": "348", | |
| "notes": "Called by Enforcer at api/rate_limiter.py:457 on the global in-memory rate_limit_storage (RateLimitStorage, line 366); returns the per-client-IP TokenBucket whose tokens/last_update are the request history. The history update (tokens -= 1, last_update) happens inside consume (line 309); in-memory only, despite Redis mention in docstring." | |
| }, | |
| { | |
| "role": "PolicyProvider", | |
| "status": "present", | |
| "symbol": "__init__", | |
| "file": "api/rate_limiter.py", | |
| "lines": "442", | |
| "notes": "RateLimitMiddleware.__init__ sets the policy self.rpm/self.burst from constructor args supplied in api/main.py:576-577 (env RATE_LIMIT_ANONYMOUS_RPM default 20, RATE_LIMIT_ANONYMOUS_BURST default 5) with fallback to module constants (lines 48-53); the policy is passed to get_bucket at line 457 and stored in the TokenBucket. Single global policy, no per-id differentiation." | |
| }, | |
| { | |
| "role": "System", | |
| "status": "present", | |
| "symbol": "create_new_scan", | |
| "file": "api/routes/v1/scans.py", | |
| "lines": "79", | |
| "notes": "Reached after Enforcer forwards with self.app(scope, receive, send) at api/rate_limiter.py:484; POST /api/v1/scans handler (router included via api_v1_router at api/main.py:1377) creates the scan requested by the CLI Entity. The middleware guards all routes; this is the concrete handler on the CLI path." | |
| } | |
| ] | |
| } | |
Xet Storage Details
- Size:
- 2.91 kB
- Xet hash:
- c8d23488f548052e896f472648de030e50114eb4d4e38317b092cf589a404aeb
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.