Buckets:

AnonymousSpottedToad/securityPatternsRecovery / ground_truth /python /limit_request_rate__ctrl-gaurav_effGen.json
download
raw
4.72 kB
{
"role_mappings": [
{
"patternRole": "Entity",
"entity": "chat",
"file": "effgen/client/client.py",
"lines": "230",
"notes": "In-repo effGen client SDK; chat POSTs to the effGen server's /v1/chat/completions (client.py:256), which passes through the RateLimitMiddleware Enforcer; the client also retries/backs off on 429 (client.py:124).",
"status": "present",
"nodeId": null
},
{
"patternRole": "Enforcer",
"entity": "__call__",
"file": "effgen/api/middleware.py",
"lines": "293",
"notes": "__call__ of the pure-ASGI RateLimitMiddleware, registered via app.add_middleware in install_production_middleware (middleware.py:153), called from create_app (effgen/server/app.py:342). It keys on client IP, calls _check (middleware.py:302) and returns 429 with Retry-After when blocked; caveat: only installed when EFFGEN_RATE_LIMIT / --rate-limit is a positive integer (disabled by default).",
"status": "present",
"nodeId": null
},
{
"patternRole": "Limiter",
"entity": "_check",
"file": "effgen/api/middleware.py",
"lines": "269",
"notes": "Called by the Enforcer __call__ at middleware.py:302; implements a fixed-window per-IP counter, comparing the bucket count against self.limit and returning (allowed, remaining, reset), updating the bucket on allow.",
"status": "present",
"nodeId": null
},
{
"patternRole": "HistoryProvider",
"entity": "_buckets",
"file": "effgen/api/middleware.py",
"lines": "254",
"notes": "In-memory dict client-ip -> [window_start, count] field of RateLimitMiddleware, read and updated inline by _check (middleware.py:269-291); no dedicated accessor method exists, so the field is cited. Per-process only.",
"status": "present",
"nodeId": null
},
{
"patternRole": "PolicyProvider",
"entity": "_resolve_rate_limit",
"file": "effgen/api/middleware.py",
"lines": "26",
"notes": "Called in install_production_middleware (middleware.py:150); resolves requests/minute from the create_app/CLI parameter or EFFGEN_RATE_LIMIT env var and passes it to RateLimitMiddleware, stored as self.limit (middleware.py:250) and used by _check. Single global policy (with probe-path exemptions at middleware.py:213).",
"status": "present",
"nodeId": null
},
{
"patternRole": "System",
"entity": "chat_completions",
"file": "effgen/api/openai_compat.py",
"lines": "361",
"notes": "Allowed requests are forwarded by __call__ via self.app(...) (middleware.py:320) to the routed handlers; chat_completions is the /v1/chat/completions handler of the router mounted in effgen/server/app_runner.py:490.",
"status": "present",
"nodeId": null
}
],
"interaction_order": {
"available": true,
"language": "python",
"repo": "ctrl-gaurav_effGen",
"reason": "",
"entryRole": "Enforcer",
"entryRule": "behaviour",
"interactions": [
{
"rank": 1,
"interaction": "Enforcer \u2192 Limiter",
"from": "Enforcer",
"to": "Limiter",
"file": "effgen/api/middleware.py",
"line": 302,
"via": [],
"mechanism": "call",
"path": [
{
"caller": "effgen/api/middleware.py:<module>.RateLimitMiddleware.__call__",
"file": "effgen/api/middleware.py",
"line": 302,
"code": "self._check(self._client_ip(scope))",
"callee": "effgen/api/middleware.py:<module>.RateLimitMiddleware._check",
"mechanism": "call"
}
],
"parent": ""
},
{
"rank": 2,
"interaction": "Limiter \u2192 HistoryProvider",
"from": "Limiter",
"to": "HistoryProvider",
"file": "effgen/api/middleware.py",
"line": 277,
"via": [],
"mechanism": "data",
"path": [
{
"caller": "effgen/api/middleware.py:<module>.RateLimitMiddleware._check",
"file": "effgen/api/middleware.py",
"line": 277,
"code": "",
"callee": "_buckets",
"mechanism": "data"
}
],
"parent": "Enforcer \u2192 Limiter"
}
],
"anchoredRoles": [
{
"role": "Enforcer",
"kind": "METHOD"
},
{
"role": "HistoryProvider",
"kind": "MEMBER"
},
{
"role": "Limiter",
"kind": "METHOD"
},
{
"role": "PolicyProvider",
"kind": "METHOD"
}
],
"skippedRoles": [
"Entity",
"System"
]
}
}

Xet Storage Details

Size:
4.72 kB
·
Xet hash:
5de45397e6a2a931a736cdd39abc8ced8e8d910e0d658fcac77bfe8bd374f5a7

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.