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.
Well-Architected FastAPI/Starlette library for JWT authentication, throttling, caching, logging, and utilities.
pip install webtool
poetry add webtool
JWT token management system with Redis-backed refresh tokens.
from webtool.auth import JWTService
from webtool.cache import RedisCache
cache_client = RedisCache("redis://localhost:6379/0")
jwt_service = JWTService(cache_client)
async def get_token():
access, refresh = jwt_service.create_token({"sub": 123, "scope": ["write"]})
return access, refresh
Rate limiting system for FastAPI/Starlette applications.
from fastapi import FastAPI
from starlette.middleware import Middleware
from webtool.auth import JWTService
from webtool.cache import RedisCache
from webtool.throttle import limiter, LimitMiddleware, JWTBackend
cache = RedisCache("redis://127.0.0.1:6379/0")
jwt_backend = JWTBackend(JWTService(cache, secret_key="test"))
app = FastAPI(
middleware=[
Middleware(
LimitMiddleware,
cache=cache,
auth_backend=jwt_backend,
),
],
)
@app.get("/api/resource")
@limiter(max_requests=50, interval=3600, scopes=["user"])
@limiter(max_requests=10, interval=3600, scopes=["anno"])
async def get_resource():
return {"status": "success"}
MessagePack-based response.
from webtool.utils import MsgSpecJSONResponse
from fastapi import FastAPI
app = FastAPI(
default_response_class=MsgSpecJSONResponse,
)
@app.get("/api/resource")
async def get_resource():
return {"status": "success"}
This project is licensed under the Apache-2.0 License.
FAQs
FastAPI/Starlette library for authentication, throttling, caching.
We found that webtool 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.