INNER CODE UNIT · Python

DynamicCORSProcessor

SHAdd0WTAka/Zen-Ai-Pentest · api/main.py:549

class DynamicCORSProcessor:
    """Middleware um CORS für dynamische Origins zu ermöglichen"""

    def __init__(self, app):
        self.app = app

    async def __call__(self, scope, receive, send):
        if scope["type"] == "http":
            headers = dict(scope.get("headers", []))
            origin = headers.get(b"origin", b"").decode() if b"origin" in headers else None
            if origin and is_origin_allowed(origin):
                scope["cors_origin"] = origin
        await self.app(scope, receive, send)


app.add_middleware(
    CORSMiddleware,
    allow_origins=ALL_ALLOWED_ORIGINS,

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…