Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
The cors middleware that enables a FastAPI server to handle cors requests, specifically, on the router and individual route level. It also handles preflight requests :)
The cors middleware that enables a FastAPI server to handle cors requests. It also handles preflight requests 😃.
pip install pyzeus
or
pip3 install pyzeus
If no options are provided, the response headers will be as follows:
Access-Control-Allow-Origin: *
Access-Control-Allow-Methods: GET,HEAD,PUT,PATCH,POST,DELETE
Access-Control-Allow-Headers: Content-Type,Origin
Access-Control-Max-Age: 5
Content-Type
and Origin
to your response headers so no need to add it to the list@router.options(...)
to your routerThis implementation is equally
from pyzeus import zeus
from fastapi import APIRouter, Depends
router = APIRouter(dependencies=[Depends(zeus().thunder)])
@router.get("/")
async def hander():
return { "message": "lorem ipsum" }
@router.options("/")
async def options_hander():
return None
This implements a sync or async agnostic decorator that requires you to add request and response parameters in your route handler. Worry not, it works if you have pydanyic classes too! Needs python 3.8+ or run pip install typing_extensions
from pyzeus import zeus
from fastapi import APIRouter, Depends
router = APIRouter()
# Synchronous example
@router.get("/")
@zeus().smite
def synchronous_handler(request: Request, response: Response):
return { "message": "lorem ipsum" }
# Asynchronous example
@router.get("/")
@zeus().smite
async def asynchronous_handler(request: Request, response: Response):
return { "message": "lorem ipsum" }
# Pydantic example
class Item(BaseModel):
name: str
@router.post("/")
@zeus().smite
async def asynchronous_handler(request: Request, response: Response, item: Item):
return { "message": item }
functools
, and typing_extensions
from dependenciesFAQs
The cors middleware that enables a FastAPI server to handle cors requests, specifically, on the router and individual route level. It also handles preflight requests :)
We found that pyzeus demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.