Skip to main content

library to protect your fastapi applications

Project description

FastShield

FastShield Web application firewall, easy to integration, fast to code

Package version Supported Python versions


Installation

pip install fastshield

Example

  • code with a simple vulnerability
from fastapi import FastAPI
from fastapi.responses import HTMLResponse

from fastshield.middleware import FSHackMiddleware

app = FastAPI()

app.add_middleware(FSHackMiddleware) # security middleware

@app.get("/redirect_endpoint")
def read_root(redirect_url: str):
    return HTMLResponse(
        f"""
        <!DOCTYPE html>
        <html lang="en">
        <head>
            <meta charset="UTF-8">
            <meta name="viewport" content="width=device-width, initial-scale=1.0">
            <title>xss hack test</title>
        </head>
        <body>
            <script>window.location="{redirect_url}"</script>
        </body>
        </html>
        """
    )
 

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fastshield-0.0.5.tar.gz (7.0 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

fastshield-0.0.5-py3-none-any.whl (7.1 MB view details)

Uploaded Python 3

File details

Details for the file fastshield-0.0.5.tar.gz.

File metadata

  • Download URL: fastshield-0.0.5.tar.gz
  • Upload date:
  • Size: 7.0 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.11

File hashes

Hashes for fastshield-0.0.5.tar.gz
Algorithm Hash digest
SHA256 96d7a24be8fc446ecd67966e165ead83d11e1df8421cc7b7b845e16bee3e2610
MD5 7dc1d0ea8f7255f1f0536dc1e71d6616
BLAKE2b-256 1814fdb00c5e3dd54c6f1e79cd3610586932366688fbbe29161ed8082b0cc473

See more details on using hashes here.

File details

Details for the file fastshield-0.0.5-py3-none-any.whl.

File metadata

  • Download URL: fastshield-0.0.5-py3-none-any.whl
  • Upload date:
  • Size: 7.1 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.11

File hashes

Hashes for fastshield-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 d60ac506629f9afa93970288220abc2d8445df6306306ee38cca2106dd7940ec
MD5 5bd2dd67fb8ac01fce25e3fa4c3c60ac
BLAKE2b-256 ffdbe5712af875f5a940e8c06299f500dd74dd0e4331de775ddb8c0c5593222a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page