Backend Python Expert

Pass

Audited by Gen Agent Trust Hub on Mar 21, 2026

Risk Level: SAFEPROMPT_INJECTION
Full Analysis
  • [PROMPT_INJECTION]: The initialization script scripts/init_fastapi_project.py is vulnerable to indirect prompt injection. It takes a user-supplied project_name argument and interpolates it directly into generated Python source files (like app/main.py) and configuration files (like pyproject.toml) without sanitization. An attacker providing a project name with code-breaking sequences could inject arbitrary Python code or instructions into the generated project files.\n
  • Ingestion points: The project_name command-line argument in scripts/init_fastapi_project.py.\n
  • Boundary markers: None; the user input is directly embedded within docstrings and configuration keys.\n
  • Capability inventory: The script has the capability to write multiple files to the local file system using Path.write_text.\n
  • Sanitization: No input validation, filtering, or escaping is performed on the provided project name before it is used in file generation.\n- [SAFE]: The FastAPI templates provided in references/FastAPI模板.md default to allow_origins=["*"] in the CORS middleware. While this is a common and helpful setting for local development, it is a security best practice violation for production environments. This is a configuration-level finding typical for boilerplate templates.
Audit Metadata
Risk Level
SAFE
Analyzed
Mar 21, 2026, 10:19 AM