Introducing The Sweep: OX’s New Live Security Research Series
Register Now
Breaking: The 2026 Vulnpocalypse Hits PHP: Four Critical RCEs, but How Dangerous Are They?
Read the Report
Are you exposed? Connect your apps in minutes.
Scan your apps free

crudman-fastapi

Latest version: v0.2.1

Overview

Last scanned
27 Nov 2026
Published
27 Nov 2026
PyPI package Publisher: jinujd
0 Stars
0 Forks
4 Versions
Python Repo language

Scan summary

crudman-fastapi was last scanned on 27 Nov 2026 at version 0.2.1. Risk score 0 of 100. No malicious behavior was detected.

  • Releases: 4 versions, all published on 27 Nov 2026.
  • Findings: No rules fired in version 0.2.1.

Versions

4 versions published
Versions and the rules that fired in each
VersionPublishedStatus
0.2.1 LATEST 27 Nov 2026 No rules fired
0.2.0 27 Nov 2026 No rules fired
0.1.1 27 Nov 2026 No rules fired
0.1.0 27 Nov 2026 Not shown

No rules fired in 0.2.1

Findings

Findings for v0.2.1. The score is a capped sum of the weights of the rules that fired — not CVSS, not exploitability, and not a probability. It is not comparable across packages with different scan coverage.

The score describes 0.2.1; other versions have their own rules, not their own score.

README

The publisher’s own README, as collected from the registry.

Status: 0.2.1 (alpha). Everything below is implemented and covered by end-to-end tests on SQLite and PostgreSQL, except the Redis cache and S3 storage adapters, which are built but not yet tested against live services.

Creating CRUD is so simple. This is a complete Companies CRUD:

from crudman import Crudman, CrudmanOptions, crud_router
from app.models import Company

Crudman.init(app, CrudmanOptions(session_dependency=get_session))
app.include_router(crud_router(Company))

That gives you (the path comes from Company.__tablename__):

  • GET /companies (with filters, sorting, pagination, keyword)
  • GET /companies/{id} (includes relations by default)
  • POST /companies
  • PATCH /companies/{id}
  • DELETE /companies/{id}

Plus OpenAPI docs at /docs, validation generated from your model, and CSV / Excel export (x-content-type: csv or excel).

Or define routes with decorators, like crudman-nestjs, and switch auth on per route:

from fastapi import Request
from crudman import Controller, Crud, CrudDelete, CrudList, Get, Private, Public, Roles

@Controller("/api/companies")
@Private()                               # signed-in users only...
@Crud(Company)                           # list, details, create, update, delete
class CompaniesController:
    @Public()                            # ...except the list
    @CrudList()
    async def list(self): ...

    @Roles("admin")                      # admins only
    @CrudDelete()
    async def remove(self): ...

    @Get("/{id}/summary")                # your own route
    async def summary(self, id: int, request: Request):
        return (await self.crud.details("companies", request)).body

app.include_router(CompaniesController.router)

crudman-fastapi is the Python port of crudman-nestjs. The HTTP contract (query parameters, response envelope, headers) is identical, so the same front-end works against either backend.

Features

  • 🔌 Launch-ready CRUD endpoints in one line
  • 🐙 Adapter-first design (SQLAlchemy 2.0 async today; ORM, validator, cache and storage are pluggable)
  • 🔎 Powerful querying: filters, sorting, pagination, keyword search
  • 🧭 Relations and attributes control (include/exclude, sensible defaults)
  • 🧪 Validation generated from your model with Pydantic v2, overridable per request
  • 🎬 Hooks at every step, with a typed per-request context
  • 🔧 Minimal config: global options, per-section and per-action settings
  • ✏️ OpenAPI-native: typed request bodies and response envelopes
  • 📦 File uploads: multipart/base64 with local/S3 storage and shorthand presets
  • 🧊 Per-endpoint caching with invalidation on writes
  • 📤 CSV/Excel export, bulk import and bulk delete

At-a-glance capabilities

Capability What you get
Auto CRUD endpoints List, details, create, update, delete from crud_router(Model)
Zero naming config Section name and URL default to the table name
PATCH-first updates Partial updates by default (configurable to PUT)
Relations by default All relations eager-loaded; refine with include/exclude
Attributes selection Separate read and write include/exclude
Powerful querying Filters, sorting, pagination, keyword search with safe whitelists
Validation built-in Pydantic models generated from SQLAlchemy columns
Uniqueness checks fields_for_uniqueness_validation with OR/AND semantics
Hooks Before/after action, query, fetch and validation
Access control required_roles, ownership, identity accessor
Caching TTL cache per endpoint, Redis optional
Save (upsert) One endpoint that creates or updates
Programmatic calls call_action across sections, inside the same transaction
Import / export CSV and Excel export; bulk import and delete

Installation

pip install crudman-fastapi
# optional extras
pip install "crudman-fastapi[uploads,images,excel,s3,redis]"

Requires Python 3.11+, FastAPI 0.136.3+, SQLAlchemy 2.0+, Pydantic 2.9+.

Quick start

1) Model
# app/models.py
from datetime import datetime
from sqlalchemy import String, func
from sqlalchemy.orm import DeclarativeBase, Mapped, mapped_column

class Base(DeclarativeBase): ...

class Company(Base):
    __tablename__ = "companies"
    id: Mapped[int] = mapped_column(primary_key=True)
    name: Mapped[str] = mapped_column(String(150))
    email: Mapped[str | None] = mapped_column(String(255))
    is_active: Mapped[bool] = mapped_column(default=True)
    created_at: Mapped[datetime] = mapped_column(server_default=func.now())
2) Register crudman once
# app/main.py
from fastapi import FastAPI
from sqlalchemy.ext.asyncio import async_sessionmaker, create_async_engine
from crudman import Crudman, CrudmanOptions, crud_router
from app.models import Company

engine = create_async_engine("sqlite+aiosqlite:///./app.db")
SessionLocal = async_sessionmaker(engine, expire_on_commit=False)

async def get_session():
    async with SessionLocal() as session:
        yield session

app = FastAPI()
Crudman.init(app, CrudmanOptions(session_dependency=get_session))
3) Mount the CRUD
app.include_router(crud_router(Company))                  # /companies
app.include_router(crud_router(Company), prefix="/api")   # /api/companies

crud_router

crud_router(
    model,              # required: SQLAlchemy model (or a list of models)
    section=None,       # optional: defaults to the model's table name
    config=None,        # optional: Section(...) or dict with settings
    *,
    path=None,          # default "/{section}"; "" for no segment
    actions=None,       # default ["list", "details", "create", "update", "delete"]
    tags=None,          # default [section]
)
crud_router(Company)                              # section "companies" → /companies
crud_router(Company, "orgs")                      # section "orgs"      → /orgs
crud_router(Company, config=companies)            # with settings
crud_router(model=Company, section="orgs")        # keyword form
crud_router(Company, path="/organisations")       # custom URL, section stays "companies"
crud_router(UserProfile, path_style="kebab")      # table user_profiles → /user-profiles

crud_router(model=Company, "orgs") is a Python SyntaxError (positional after keyword). Use crud_router(Company, "orgs") or crud_router(model=Company, section="orgs").

Several models in one router (each entry is Model, (Model, "name"), (Model, config) or (Model, "name", config)):

app.include_router(
    crud_router([Tag, Category, (Company, companies), (State, "regions", {"relations": ["country"]})]),
    prefix="/api",
)
# → /api/tags, /api/categories, /api/companies, /api/regions

Extra endpoints are opt-in: actions=["*", "save", "bulk_import", "bulk_delete"].

Controllers (decorators)

Routes can be defined on a class with decorators instead of crud_router(...). Both styles use the same engine and section settings.

Decorator Meaning
@Controller(prefix, tags=None, dependencies=None) URL prefix for the class
@Crud(Model, section=None, config=None, path=None, actions=None) Register a section and generate its routes (actions=[]: only decorated methods)
@CrudList(path=None, section=None), @CrudDetails, @CrudCreate, @CrudUpdate, @CrudDelete, @CrudSave, @CrudBulkImport, @CrudBulkDelete Place or override a generated route. An empty body lets crudman handle it; a result: CrudResult parameter receives the result to change
@Get(path), @Post, @Put, @Patch, @Delete Custom routes with normal FastAPI parameters; self.crud is the service
@Controller("/api/companies")
@Crud(Company, config=companies)
class CompaniesController:
    def __init__(self, mailer: Mailer = Depends(get_mailer)):   # constructor injection
        self.mailer = mailer

    @CrudDetails("/{id}/full")                                 # new path for a generated route
    async def details(self, result: CrudResult) -> CrudResult:
        result.body["data"]["display"] = result.body["data"]["name"].upper()
        return result

Crudman.init(app, CrudmanOptions(session_dependency=get_session, controllers=[CompaniesController]))

Authentication

Routes are public by default. Tell crudman how to find the user, then mark routes with @Private():

async def current_user(creds = Depends(HTTPBearer(auto_error=False))):
    user = decode_jwt(creds.credentials) if creds else None
    if user is None:
        raise HTTPException(401)
    return {"id": user.id, "role": user.role}        # becomes ctx.identity

Crudman.init(app, CrudmanOptions(session_dependency=get_session, auth=AuthOptions(dependency=current_user)))
Decorator Meaning
@Private() signed-in user required (401)
@Roles("admin") signed in and one of the roles (403); implies @Private()
@Public() no auth; opens one route inside a @Private controller

They work on controller classes, controller methods and plain FastAPI routes. Without decorators: crud_router(Company, auth="private", public=["list"], roles={"delete": ["admin"]}), or section config auth. AuthOptions(dependency=..., default="private") protects everything except @Public() routes. Private routes show a lock and the Authorize button in Swagger.

Sections

A section is a named CRUD resource: a model plus settings. Settings resolve in three layers, and the later layer wins:

CrudmanOptions.defaults  →  section top-level keys  →  section.<action> block

Write a section as a typed object (IDE autocompletion) or a plain dict. Both are validated at startup.

# app/crud/companies.py
from crudman import Section, ListAction, DetailsAction, WriteAction, Keyword, Pagination

companies = Section(
    title="Company",
    attributes={"read": {"exclude": ["secret"]}},           # every action
    required_roles=["admin"],
    list=ListAction(
        filters_whitelist=["name", "is_active", "created_at"],
        sorting_whitelist=["name", "created_at"],
        order_by=[("created_at", "DESC")],
        keyword=Keyword(searchable_fields=["name", "contacts.email"], min_length=2),
        pagination=Pagination(max_per_page=100),
        enable_cache={"ttl": 60},
    ),
    details=DetailsAction(relations=["contacts"]),
    create=WriteAction(fields_for_uniqueness_validation=["name"]),
    update=WriteAction(fields_for_uniqueness_validation=["name"]),
)

Section keys (any of these can also go inside an action block):

Key Meaning
relations / get_relations(ctx) "*" (default) · list · {"include": [...]} · {"exclude": [...]}
attributes {"read": ..., "write": ...}, each "*" / list / include / exclude
filters_whitelist, sorting_whitelist default: all readable root columns
order_by default sort when the request sends none
conditions fixed where added to every query
keyword, keyword_param_name keyword search
query_param_names, pagination renames and pagination toggles
record_selection_field default "id"; also names the path param
fields_for_uniqueness_validation, condition_type_for_uniqueness_validation uniqueness checks ("or" / "and")
required_roles, ownership access control
hooks see Hooks
context per-request context builder
additional_response / get_additional_response extra keys merged into meta
response_handler, custom_implementation output shaping / full override
enable_cache True or {"ttl": int, "key": fn}
uploadable, upload, upload_defaults file uploads
session, orm, validator per-section overrides

List APIs and pagination (quick reference)

  • Pagination: page (default 1), perPage (default 30, max 100; alias per_page). paginate=false|0|no or perPage=0 return everything only when the section sets pagination={"is_disable_allowed": True}
  • Sorting: sort.<field>=asc|desc (repeatable). Default: created_at DESC, then primary key
  • Filters:
    • Equals: field=value
    • Like: field.like=value (case-insensitive)
    • Ranges: field.min, field.max, field.gt, field.lt (numbers or ISO dates)
    • Between: field.between=start,end
  • Keyword: keyword=acme

Field names can be sent in camelCase or snake_case: sort.createdAt and sort.created_at both reach the created_at column.

GET /api/companies?page=2&perPage=20
GET /api/companies?sort.created_at=desc&sort.name=asc
GET /api/companies?name.like=air&created_at.between=2024-01-01,2024-12-31
GET /api/companies?keyword=acme&is_active=true

Rename any parameter per action:

OX Radar and Response Center

Find threats in your stack.

OX Radar can check high-priority threats, like critical package CVEs, against your context.

Each incident is marked Detected or Not Detected with a remediation plan and proof all tracked in the Response Center.

Where it’s listed

The probe returned only these fields for this server — auth requirement, protocol and tool list weren’t observed, so they’re not shown (never guessed).

  • pypi-releases crudman-fastapi

References

The publisher’s own links, as the registry reports them. These are not sources for the assessment on this page.

Powered by Read the latest findings

Scan your whole stack

Group 1261154050 1
Group 1261154050
 

From OX Research Newsroom

Plug and Pray: Your AI Agents Are Taking Orders From Strangers
Research

Plug and Pray: Your AI Agents Are Taking Orders From Strangers

The 2026 Vulnpocalypse Hits PHP: Four Critical RCEs, but How Dangerous Are They?
Vulnerability Insights

The 2026 Vulnpocalypse Hits PHP: Four Critical RCEs, but How Dangerous Are They?

Vulnerability Insights

Compromised Claude Code extensions (versions 2.1.312 & 2.1.313) in Cursor try to install a backdoor

Frame 2085668439 (1)
Group 1261154229