Skip to main content

Ushka, the maned-wolf guardian mascot, giving a thumbs up

Ushka

PyPI Version Documentation Python Versions License

Website and docs: ushka.satela.com.br

Ushka is the Python web framework where insecure code, whether you or an AI wrote it, does not run silently. It stops and tells you how to fix it.

It is an async (ASGI) framework with filesystem routing, and it is small on purpose. It needs few dependencies, but it ships everything a web app needs. Its main feature is Ushka Guard: anything that comes from outside your program arrives as an Untrusted string, and the places where such a string could do harm refuse it.

# routes/login.py
from ushka.guard import safe
from ushka.http import redirect

async def get(request):
    target = request.query.get("next", "/")      # Untrusted
    # return redirect(target)                    # ✗ USHKA-G003 open redirect, with the fix
    return redirect(safe.url(target, allow=["/"], default="/"))   # ✓

Why

AI assistants write a growing share of web code, and studies keep finding OWASP Top 10 flaws in around 45% of generated samples. Apps also pass model output into HTML, redirects and SQL, where prompt injection can steer it. Ushka puts the check where it cannot be skipped: in the framework, at runtime, on your real code. Read Why Ushka changed.

What's in the box

  • Ushka Guard:
    • Untrusted by default. Query, form, JSON, headers, cookies and path parameters are Untrusted, and so is model output once marked with guard.llm().
    • Guarded sinks. HTML, redirects, file paths and raw SQL refuse those values.
    • Sanitisers and errors. The way out is through explicit sanitisers. Errors give the risk and the fix, as text and as JSON for coding agents.
  • Python 3.14 t-strings. t"<h1>{name}</h1>" and db.execute(t"... {id}") are safe by construction.
  • Routing. Filesystem routing (routes/users/[user_id].py) plus decorators (@app.get(...)).
  • Responses. Return a str, a dict, a (body, status) tuple, None (204) or a Response. HEAD and 405 Allow are handled for you.
  • Data, sessions and templates:
    • Async Active Record ORM on SQLAlchemy, with migrations in ushka db (extra ushka[orm]).
    • Jinja2 templates, signed sessions, cookies, flash messages, file uploads and request size limits.
  • Config. Defaults, then ushka.toml, then .env, then environment variables, all without extra packages. DATABASE_URL works out of the box.
  • Static files. app.mount_static("/assets", "public") serves any folder, with ETag/304 and your choice of Cache-Control.
  • Ushka Docs. A Markdown folder becomes a searchable docs site with an API reference, served by your app (ushka[docs]).
  • CLI. new, dev, run, check (CI-friendly security check), docs, routes and db.
  • Low dependency. The core needs only uvicorn, jinja2 and python-multipart (plus tomli on 3.10).

Quick start

pip install ushka        # or: uv add ushka
ushka new hello
cd hello
ushka dev

Prefer a script? It installs the ushka command for your user, with no sudo. Read it first and check it against the published SHA-256:

curl -LsSf https://ushka.satela.com.br/install.sh -o install.sh
curl -LsSf https://ushka.satela.com.br/install.sh.sha256 | sha256sum -c -
sh install.sh

ushka new creates a project that is safe from the first commit:

  • debug = false in config (ushka dev turns debug on by itself)
  • a generated secret in .env
  • a .gitignore
  • an AGENTS.md that teaches coding agents the rules

Or write a single-file app:

from ushka import Ushka

app = Ushka()

@app.get("/greet/[name]")
async def greet(name):
    return f"Hello, {name}!"          # plain text: safe

@app.post("/items")
async def create(request):
    data = await request.json()
    return {"created": data["name"]}, 201

if __name__ == "__main__":
    app.run()

Before deploying:

ushka check --production   # fails (exit 1) on debug on, missing secret, guard off...

Documentation

Guides, the Ushka Guard reference and the API reference are at https://ushka.satela.com.br/docs/. The site is built with Ushka itself and its docs are rendered by Ushka Docs. For AI tools there is llms.txt.

Meet Ushka

The mascot is Ushka, a guardian with the ears and tail of a lobo-guará (maned wolf), Brazil's tall red wolf. Her shield pin is the mint diamond you see whenever the guard stops something.

Contributing

Bug reports, ideas and pull requests are welcome. See the contributing guidelines and the security policy.

License

MIT

Metadata

Release files for ushka 0.6.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ushka 0.6.0
File Size Uploaded Provenance Actions
ushka-0.6.0.tar.gz 119.3 kB With provenance Details for ushka-0.6.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for ushka 0.6.0
File Interpreter ABI Platform Actions
ushka-0.6.0-py3-none-any.whl Python 3 none any Details for ushka-0.6.0-py3-none-any.whl

Total release size: 237.2 kB

Release files / ushka-0.6.0.tar.gz

Download URL ushka-0.6.0.tar.gz
Size 119.3 kB
Tags Source
SHA-256 checksum
How to use checksums
2054e0b6bd3a138d8a08fd712c52c79373f209c1268263271a90dd8111845ca8
BLAKE2b-256 checksum
How to use checksums
75d084d00a70e31ed3d06ef692e047ad5c5ed31bdeb62f2bcbcc81b9dda43da6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 14, 2026.

Transparency log

Release files / ushka-0.6.0-py3-none-any.whl

Download URL ushka-0.6.0-py3-none-any.whl
Size 117.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c01fb711c6becbccf06836081cd29fbaf0e9936e3f8e4eb2fbd89614ee7040d4
BLAKE2b-256 checksum
How to use checksums
d4a493ddeea41259c45866b01e8a1102ea628c879263a40e88ed6420ee8d1270
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 14, 2026.

Transparency log

Security for ushka 0.6.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for ushka-0.6.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 14, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page