AnonymousSpottedToad/securityPatternsRecovery / ground_truth /python /limit_request_rate__Helevon-Technologies-LTD_fabiplus.json
| { | |
| "role_mappings": [ | |
| { | |
| "patternRole": "Entity", | |
| "entity": "", | |
| "file": "", | |
| "lines": "", | |
| "notes": "Requests come from external HTTP clients outside the repo; no in-repo client targets RateLimitMiddleware (only tests, which do not count).", | |
| "status": "missing", | |
| "nodeId": null | |
| }, | |
| { | |
| "patternRole": "Enforcer", | |
| "entity": "dispatch", | |
| "file": "fabiplus/middleware/security.py", | |
| "lines": "272", | |
| "notes": "dispatch of RateLimitMiddleware (fabiplus/middleware/security.py:262) intercepts each request, derives the client IP via _get_client_ip (line 301) and returns a 429 JSONResponse (line 291) or forwards via call_next (line 299). Caveat: this framework middleware is opt-in and is NOT registered in _setup_middleware (fabiplus/core/app.py:91, which adds only CORS/Security/Logging/Activity middleware); unwired lookalikes are CustomAuthMiddleware.__call__ (fabiplus/core/custom_auth.py:105) and MediaSecurityMiddleware.dispatch (fabiplus/core/media/middleware.py), also never registered.", | |
| "status": "present", | |
| "nodeId": null | |
| }, | |
| { | |
| "patternRole": "Limiter", | |
| "entity": "dispatch", | |
| "file": "fabiplus/middleware/security.py", | |
| "lines": "272", | |
| "notes": "The allow/block decision is made inline in the Enforcer's dispatch (security.py:282-297): it counts the client's timestamps in the last 60 s and blocks when len >= requests_per_minute; Enforcer and Limiter are the same method. _cleanup_old_requests (line 314) only prunes history and does not decide.", | |
| "status": "present", | |
| "nodeId": null | |
| }, | |
| { | |
| "patternRole": "HistoryProvider", | |
| "entity": "requests", | |
| "file": "fabiplus/middleware/security.py", | |
| "lines": "270", | |
| "notes": "In-memory dict self.requests (client IP -> list of request timestamps), read and updated inline by dispatch (security.py:283, 295, 297) and pruned by _cleanup_old_requests (line 314); no dedicated getter method exists, so the field is cited. Not shared across processes (comment says 'use Redis in production').", | |
| "status": "present", | |
| "nodeId": null | |
| }, | |
| { | |
| "patternRole": "PolicyProvider", | |
| "entity": "requests_per_minute", | |
| "file": "fabiplus/middleware/security.py", | |
| "lines": "269", | |
| "notes": "Policy is the constructor parameter requests_per_minute (default 60) stored on the instance and read by dispatch at security.py:290, with a fixed 60 s window; no method supplies the policy, so the field is cited. Settings RATE_LIMITING_ENABLED / RATE_LIMIT_PER_MINUTE (fabiplus/conf/settings.py:61,64) exist but are never read.", | |
| "status": "present", | |
| "nodeId": null | |
| }, | |
| { | |
| "patternRole": "System", | |
| "entity": "", | |
| "file": "", | |
| "lines": "", | |
| "notes": "FABI+ is a framework and RateLimitMiddleware is not registered in any in-repo app (create_app/_setup_middleware in fabiplus/core/app.py:91 does not add it), so no in-repo handler is demonstrably reached via call_next (security.py:299); per rule 6.1.7 System is missing.", | |
| "status": "missing", | |
| "nodeId": null | |
| } | |
| ], | |
| "interaction_order": { | |
| "available": true, | |
| "language": "python", | |
| "repo": "Helevon-Technologies-LTD_fabiplus", | |
| "reason": "", | |
| "entryRole": "Enforcer", | |
| "entryRule": "behaviour", | |
| "interactions": [ | |
| { | |
| "rank": 1, | |
| "interaction": "Enforcer \u2192 Limiter", | |
| "from": "Enforcer", | |
| "to": "Limiter", | |
| "file": "fabiplus/middleware/security.py", | |
| "line": 272, | |
| "via": [], | |
| "mechanism": "co-located", | |
| "path": [], | |
| "parent": "" | |
| }, | |
| { | |
| "rank": 2, | |
| "interaction": "Enforcer \u2192 HistoryProvider", | |
| "from": "Enforcer", | |
| "to": "HistoryProvider", | |
| "file": "fabiplus/middleware/security.py", | |
| "line": 316, | |
| "via": [ | |
| "fabiplus/middleware/security.py:<module>.RateLimitMiddleware._cleanup_old_requests" | |
| ], | |
| "mechanism": "data", | |
| "path": [ | |
| { | |
| "caller": "fabiplus/middleware/security.py:<module>.RateLimitMiddleware.dispatch", | |
| "file": "fabiplus/middleware/security.py", | |
| "line": 279, | |
| "code": "self._cleanup_old_requests(current_time)", | |
| "callee": "fabiplus/middleware/security.py:<module>.RateLimitMiddleware._cleanup_old_requests", | |
| "mechanism": "call" | |
| }, | |
| { | |
| "caller": "fabiplus/middleware/security.py:<module>.RateLimitMiddleware._cleanup_old_requests", | |
| "file": "fabiplus/middleware/security.py", | |
| "line": 316, | |
| "code": "", | |
| "callee": "requests", | |
| "mechanism": "data" | |
| } | |
| ], | |
| "parent": "" | |
| }, | |
| { | |
| "rank": 3, | |
| "interaction": "Limiter \u2192 HistoryProvider", | |
| "from": "Limiter", | |
| "to": "HistoryProvider", | |
| "file": "fabiplus/middleware/security.py", | |
| "line": 316, | |
| "via": [ | |
| "fabiplus/middleware/security.py:<module>.RateLimitMiddleware._cleanup_old_requests" | |
| ], | |
| "mechanism": "data", | |
| "path": [ | |
| { | |
| "caller": "fabiplus/middleware/security.py:<module>.RateLimitMiddleware.dispatch", | |
| "file": "fabiplus/middleware/security.py", | |
| "line": 279, | |
| "code": "self._cleanup_old_requests(current_time)", | |
| "callee": "fabiplus/middleware/security.py:<module>.RateLimitMiddleware._cleanup_old_requests", | |
| "mechanism": "call" | |
| }, | |
| { | |
| "caller": "fabiplus/middleware/security.py:<module>.RateLimitMiddleware._cleanup_old_requests", | |
| "file": "fabiplus/middleware/security.py", | |
| "line": 316, | |
| "code": "", | |
| "callee": "requests", | |
| "mechanism": "data" | |
| } | |
| ], | |
| "parent": "" | |
| }, | |
| { | |
| "rank": 4, | |
| "interaction": "Enforcer \u2192 PolicyProvider", | |
| "from": "Enforcer", | |
| "to": "PolicyProvider", | |
| "file": "fabiplus/middleware/security.py", | |
| "line": 290, | |
| "via": [], | |
| "mechanism": "data", | |
| "path": [ | |
| { | |
| "caller": "fabiplus/middleware/security.py:<module>.RateLimitMiddleware.dispatch", | |
| "file": "fabiplus/middleware/security.py", | |
| "line": 290, | |
| "code": "", | |
| "callee": "requests_per_minute", | |
| "mechanism": "data" | |
| } | |
| ], | |
| "parent": "" | |
| }, | |
| { | |
| "rank": 5, | |
| "interaction": "Limiter \u2192 PolicyProvider", | |
| "from": "Limiter", | |
| "to": "PolicyProvider", | |
| "file": "fabiplus/middleware/security.py", | |
| "line": 290, | |
| "via": [], | |
| "mechanism": "data", | |
| "path": [ | |
| { | |
| "caller": "fabiplus/middleware/security.py:<module>.RateLimitMiddleware.dispatch", | |
| "file": "fabiplus/middleware/security.py", | |
| "line": 290, | |
| "code": "", | |
| "callee": "requests_per_minute", | |
| "mechanism": "data" | |
| } | |
| ], | |
| "parent": "" | |
| } | |
| ], | |
| "anchoredRoles": [ | |
| { | |
| "role": "Enforcer", | |
| "kind": "METHOD" | |
| }, | |
| { | |
| "role": "HistoryProvider", | |
| "kind": "MEMBER" | |
| }, | |
| { | |
| "role": "Limiter", | |
| "kind": "METHOD" | |
| }, | |
| { | |
| "role": "PolicyProvider", | |
| "kind": "MEMBER" | |
| } | |
| ], | |
| "skippedRoles": [ | |
| "Entity", | |
| "System" | |
| ] | |
| } | |
| } |
Xet Storage Details
- Size:
- 7.59 kB
- Xet hash:
- 8dd5f7bac04a665c5ef0d529d1bde224b57e40fd8e0b0216e8a2bed37c570f80
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.