This release is a pre-release and may not be stable for production use.
Ushka
Website and docs: ushka.satela.com.br
0.8 is in beta. The 0.7 line is the stable release:
pip install ushka. To try 0.8:pip install "ushka==0.8.0b4"(pin it:--prewould also accept unfinished versions of your other dependencies). See what is settled and what is new.
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 withguard.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.
- Untrusted by default. Query, form, JSON, headers, cookies and path parameters are
- Security middleware, on by default. CSRF protection without tokens, CSP, HSTS and
nosniff, CORS and trusted hosts. - Typed parameters and validation. Annotations convert and validate path, query, header, cookie and JSON bodies (422 with every error),
Dependsas in FastAPI, and OpenAPI generated from the same signatures. No pydantic. - Real time. WebSockets (cross-site hijacking refused) and Server-Sent Events.
- Routes as agent tools. Expose chosen routes over MCP with declared capabilities and human approval.
ushka verify. Sends attack payloads to your own routes and reports what got through.- Guard for FastAPI, Starlette and Django. The same
Untrustedprotection in an app you already have. - Python 3.14 t-strings.
t"<h1>{name}</h1>"anddb.execute(t"... {id}")are safe by construction. - Routing. Filesystem routing (
routes/users/[user_id].py) plus decorators (@app.get(...)). - Responses. Return a
str, adict, a(body, status)tuple,None(204) or aResponse.HEADand405 Alloware handled for you. - Data, sessions and templates:
- Async Active Record ORM on SQLAlchemy, with migrations in
ushka db(extraushka[orm]). - Jinja2 templates, signed sessions, cookies, flash messages, file uploads and request size limits.
- Async Active Record ORM on SQLAlchemy, with migrations in
- SEO and PWA, from
ushka.toml.{{ seo() }}writes the meta, Open Graph and structured-data tags (a page can override them),robots.txtandsitemap.xmlare served for you, and[pwa] enable = trueadds a manifest, a service worker and an offline page. - Config, with nothing hidden. Defaults, then
ushka.toml, then.env, then environment variables, all without extra packages.ushka newwrites every setting into yourushka.tomlwith its meaning,ushka configshows what is in use and where it came from, andushka checkcatches typos.DATABASE_URLworks out of the box. - Static files.
app.mount_static("/assets", "public")serves any folder, withETag/304and your choice ofCache-Control. - Ushka Docs. A Markdown folder becomes a searchable docs site with an API reference, served by your app (
ushka[docs]), with a cache you can build into your Docker image. - CLI.
new,dev,run,checkandverify(CI-friendly security checks),docs,routesanddb. - Fast without tuning.
uvloopandhttptoolsare installed by default (not on Windows or PyPy) and Uvicorn uses them on its own: about 2.3x the requests per second of the pure-Python stack (the hello route on one worker went from about 3,200 to 7,600), and ahead of FastAPI on the same loop and parser.ushka runalso stays asleep when idle: about 0.04 s of CPU per minute for two workers. - Low dependency. The core is 9 packages and 20 MB:
uvicorn,jinja2,python-multipartand the two accelerators (plustomlion 3.10). The ORM, the docs engine and the database drivers are extras. - Ready to deploy.
ushka check --productionfor your CI, settings from environment variables,[server] workers, and a deploy guide with a Dockerfile.
Quick start
pip install ushka # or: uv add ushka (Python 3.10+)
ushka new hello
cd hello
ushka dev # http://127.0.0.1:8000, reloads on change
Extras are opt-in: pip install "ushka[orm]" (SQLAlchemy and migrations),
"ushka[postgres]", "ushka[mysql]" and "ushka[docs]".
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 = falsein config (ushka devturns debug on by itself)- a generated secret in
.env - a
.gitignore - an
AGENTS.mdthat 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...
ushka verify app:app # attacks your own routes and reports what got through
ushka run # the production server (see "workers" in ushka.toml)
Documentation
Everything is at ushka.satela.com.br/docs. The site is built with Ushka itself, and its docs are rendered by Ushka Docs.
- Installation and the Quickstart
- Ushka Guard, with the error codes
USHKA-G001toG005 - Validation and typed parameters and the Security middleware
- Deploy and Performance
- CLI, Configuration and the API reference
For AI tools there is llms.txt. The
changelog lists every change.
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
Metadata
Release files for ushka 0.8.0b4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| ushka-0.8.0b4.tar.gz | 297.2 kB | With provenance | Details for ushka-0.8.0b4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| ushka-0.8.0b4-py3-none-any.whl | Python 3 | none | any | Details for ushka-0.8.0b4-py3-none-any.whl |
Total release size: 545.7 kB
Release files / ushka-0.8.0b4.tar.gz
| Download URL | ushka-0.8.0b4.tar.gz |
|---|---|
| Size | 297.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ab3b81598d791167b8469990c51c1e0d2f6cd095560fb03ef0100ec22c1bdc22
|
|
BLAKE2b-256 checksum How to use checksums |
a81b666e4a96da3b884aa4733d49bd57c96fa4308b7382711b043df277dfb260
|
| 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 17, 2026.
Transparency logRelease files / ushka-0.8.0b4-py3-none-any.whl
| Download URL | ushka-0.8.0b4-py3-none-any.whl |
|---|---|
| Size | 248.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
04342ff52c237afa423379ce44c052a3265316a8694dc55cda8a1e093dc31225
|
|
BLAKE2b-256 checksum How to use checksums |
8855dfc493c2b8426268fff0cae72e2d7514f4ae4383d10d7b0f6b741ae9e135
|
| 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 17, 2026.
Transparency logSecurity for ushka 0.8.0b4
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.
Attestation for ushka-0.8.0b4.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 17, 2026.
Transparency logA 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.