antsilk
Drop-in security middleware for Python ASGI apps.
antsilk is a small, zero-dependency middleware that sits in front of
your FastAPI / Starlette / Litestar app and does the boring half of web
security for you. Two lines of glue and every incoming request gets
rate-limited, scanned for SQL injection / XSS / path traversal, checked
against an IP threat-intel blocklist, and inspected for suspicious
headers. Blocks are recorded as structured events in a local SQLite
ledger.
Install
pip install antsilk
Two-line install
from fastapi import FastAPI
from antsilk import AntsilkMiddleware
app = FastAPI()
app.add_middleware(AntsilkMiddleware)
Restart your server. Antsilk is now active with defaults:
- 60 requests per minute per IP
- threat-intel from FireHOL Level 1 + Spamhaus DROP, refreshed every 6h
- SQLi / XSS / path-traversal regex over URL, query, non-UA headers
- structural header check (missing UA, bad UA, malformed Cookie)
- events written to
./antsilk_events.db(SQLite, WAL mode)
What it catches
| Layer | What it catches | Response |
|---|---|---|
| threat-intel | Traffic from IPs on FireHOL Level 1 or Spamhaus DROP | 403 |
| rate limit | Per-IP token bucket; default 60 req/min | 429 |
| headers | Missing User-Agent, sqlmap/nikto/masscan/nmap, malformed Cookie |
403 |
| patterns | SQLi, XSS, path traversal regex over path / query / non-UA headers | 403 |
Why
- Zero runtime dependencies. Standard library only. Every dep is friction for adopters and a supply-chain risk.
< 1msp99 latency overhead on a typical FastAPI route.- Sensible defaults. Two-line install gives you a real WAF on day one.
- Pluggable. Swap
SQLiteSinkforJSONLinesSink, or write your own. - Carve-outs that match how apps actually look. Webhooks bypass rate
limit; user-content endpoints bypass pattern scan; payment endpoints
bypass threat-intel — all wired through
RouteRule.
Docs
Full docs site: docs.antsilk.com (coming online with the v0.1.0 launch).
Status
v0.1.0 — first published release. Public API frozen during the
v0.1.x line; breaking changes wait for v0.2.0 after a deprecation
warning. Body scanning is deferred to v0.3.0.
License
MIT
Metadata
Release files for antsilk 0.1.0
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 |
|---|---|---|---|---|
| antsilk-0.1.0.tar.gz | 27.2 kB | With provenance | Details for antsilk-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| antsilk-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for antsilk-0.1.0-py3-none-any.whl |
Total release size: 44.9 kB
Release files / antsilk-0.1.0.tar.gz
| Download URL | antsilk-0.1.0.tar.gz |
|---|---|
| Size | 27.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f61374a3703e7481c0afc14147f54fd9e0f82c98400cf507bbeef20090539722
|
|
BLAKE2b-256 checksum How to use checksums |
d4ac1f9c78598731f7219cb8c9d34bf83446bf66bcbdb22adba84c92d506dff7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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 May 19, 2026.
Transparency logRelease files / antsilk-0.1.0-py3-none-any.whl
| Download URL | antsilk-0.1.0-py3-none-any.whl |
|---|---|
| Size | 17.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
797fd1f7415f61754b6a89b3268a3aa16afb73e79d8f2d225cb7fe7ddc1c1f9d
|
|
BLAKE2b-256 checksum How to use checksums |
da18b1d3e086be096bec479192adad6d8a4212ed04ff4e812b72c8f05bd652c1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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 May 19, 2026.
Transparency logSecurity for antsilk 0.1.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
All 2 files in this release have been uploaded with provenance metadata.
Attestation for antsilk-0.1.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 May 19, 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.