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.pyis vulnerable to indirect prompt injection. It takes a user-suppliedproject_nameargument and interpolates it directly into generated Python source files (likeapp/main.py) and configuration files (likepyproject.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_namecommand-line argument inscripts/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模板.mddefault toallow_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