- Home
- Skills
- APIs & Backend
- FastAPI Safety Check
More screenshots
Works with the AI Agents you already use
FastAPI Safety Check
A SECRET_KEY written in main.py lets anyone forge tokens; verify_signature False lets anyone pick their own user ID.
$5
FastAPI Safety Check
Example session with this skill installed
Check this project with fastapi-safety-check.
- Read your context and instructions
- Compiled the fastapi safety check
$ python3 scripts/check_fastapi.py examples/risky
BLOCK app/auth.py:6 A01 HARDCODED_SECRET
SECRET_KEY = "<redacted>"
Why: A JWT SECRET_KEY, a settings default (secret_key: str = '...'), a key passed straight to jwt.encode or jwt.decode, or a database password in a connection URL is written in the code. Anyone with the code can sign tokens for any user or reach the database.
Safer: Declare the field with no default in a pydantic BaseSettings class (secret_key: str) so it must come from the environment or a .env file kept out of git, and rotate the exposed secret.
BLOCK app/auth.py:15 A02 JWT_NOT_VERIFIED
BLOCK app/db.py:4 A01 HARDCODED_SECRET
BLOCK app/main.py:14 A04 CORS_ANY_ORIGIN_WITH_CREDENTIALS
BLOCK app/main.py:21 A03 SQL_INJECTION
REVIEW app/auth.py:11 A14 TOKEN_WITHOUT_EXPIRY
REVIEW app/auth.py:19 A13 WEAK_PASSWORD_HANDLING
REVIEW app/main.py:13 A11 DOCS_PUBLIC
REVIEW app/main.py:13 A12 DEBUG_OR_RELOAD_ON
REVIEW app/main.py:15 A16 ANY_HOST_ALLOWED
REVIEW app/main.py:26 A15 FILE_PATH_FROM_REQUEST
REVIEW app/main.py:34 A17 ERROR_DETAILS_TO_CLIENT
REVIEW app/main.py:38 A13 WEAK_PASSWORD_HANDLING
REVIEW app/main.py:42 A12 DEBUG_OR_RELOAD_ON
(Each finding also has Why and Safer lines, as in the first one.)
Verdict: BLOCK. Checked 3 files, 3 with FastAPI content.
This is a static check of file text. NOT FLAGGED is not a guarantee.
Connects securely to your tools. The creator never sees your data.
About this skill
A SECRET_KEY written in main.py lets anyone forge tokens; verify_signature False lets anyone pick their own user ID. This skill finds those and nine other FastAPI mistakes before you deploy, and tells you how to fix each one.
Your agent runs a scanner on your Python files. It reads Python with Python's own parser, follows route and query parameters through your code, and knows the safe patterns: settings read from the environment, Pydantic settings without defaults, bound SQL parameters, passlib with bcrypt or argon2, and os.path.basename. It never runs your app. It returns BLOCK, REVIEW, or NOT FLAGGED, with the file, line, reason, and a safer approach. Secrets are never printed.
What it checks
BLOCK
- A01: a hard-coded secret key, JWT key, password, token or API key
- A02: jwt.decode without signature checks, or the none algorithm
- A03: SQL built with f-strings, %, .format() or + and run with execute or text()
- A04: CORS with * (or .*) and allow_credentials=True
REVIEW
- A11: /docs and /openapi.json left public (FastAPI() without docs_url or openapi_url)
- A12: debug=True or uvicorn reload=True
- A13: md5, sha1 or sha256 on passwords, weak CryptContext schemes, or passwords compared with ==
- A14: JWTs created without an exp claim
- A15: file paths from route or query parameters
- A16: TrustedHostMiddleware with allowed_hosts ['*']
- A17: exception text or tracebacks sent in responses
What's included
- The scanner (Python 3.9+, standard library only)
- A rules guide with the reason and safer approach for each rule
- A risky and a safe example FastAPI app, and the real report the scanner produces on the risky one
Limits It follows values within one file. Dependencies, your ASGI server, reverse proxy and authentication logic spread across files are not checked. NOT FLAGGED is not a guarantee.
Find more skills like this on the Claude Skills Marketplace, the Codex Skills Marketplace and the Gemini Skills Marketplace, or browse Claude Skills for APIs & Backend.
Static check of Python text. Values are followed within one file only; the server, proxy and dependencies are not seen. NOT FLAGGED is not a guarantee.
How to use
- 1
Connect your agent to the Agensi MCP
Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup
- 2
Sign in to Agensi
Your agent shows a sign-in link. Sign in and click Allow.
- 3
Ask for what you need
Your agent loads this skill and uses it on your task. It always asks before buying a skill.
Reviews
No reviews yet
Be one of the first to try it. Every listed skill goes through the trust checks below.
Security scanned
Checked by our 8-point scan before listing
Fresh listing
Recently published to Agensi
Money-back guarantee
Doesn't do what its page promises? You get your money back.
Trust & safety
Security scan
Security scan passed 5 days ago
Permissions
Runs one local Python script in the terminal. It reads your project's files, writes nothing, and makes no network calls. The example app includes a clearly fake, inert secret key (not-a-real-...) for the scanner to find. It is never run.