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.
Full-stack, asynchronous Python3 framework.
from fastapi import FastAPI, Request
from apitoolbox import crud, db_registry
from apitoolbox.middleware import SessionMiddleware
from apitoolbox.models import BASE, Session, User
DATABASE_URL = "sqlite:///sqlite.db?check_same_thread=False"
# Define our model
class MyUser(User):
pass
# Instantiate the application
app = FastAPI()
app.add_middleware(SessionMiddleware, bind=DATABASE_URL)
# Create all tables
bind = db_registry.get_or_create(DATABASE_URL)
BASE.metadata.create_all(bind=bind)
# Load some data
session = Session()
for name in ["alice", "bob", "charlie", "david"]:
user = MyUser.get_by_username(session, name)
if user is None:
user = MyUser(username=name)
session.add(user)
session.commit()
# Add an endpoint
@app.get("/users")
async def list_users(
request: Request
):
return await crud.list_instances(MyUser, request.state.session)
Assuming the above code is stored in the file main.py
, then run it via:
uvicorn main:app --reload
Call the endpoint:
curl -s localhost:8000/users | jq .
The output should contain a list of 4 users,
each with the attributes id
, username
, updated_at
and created_at
.
FAQs
Full-stack async framework for Python.
We found that apitoolbox 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.