Skip to content
Report library
Purpose / Other

Fastapi Templates Skill Security Audit

What the author says it does (original text)

Create production-ready FastAPI projects with async patterns, dependency injection, and comprehensive error handling. Use when building new FastAPI applications or setting up backend API projects.

Independent security check

Do not install or run it yet

Files checked
2
Risks found
3
Could it run dangerous commands?Looks for programs run straight after downloading, remote control of your computer, and hidden commands.No risks found
Could it expose your files or keys?Looks for uploads of files containing passwords or keys, and keys written directly in the code.Risks found: 2
Medium risk

Any signed-in user can retrieve another user's record by ID

Source references: 2
What we found

The read-user endpoint requires authentication but does not compare current_user.id with user_id as the update and delete endpoints do. An authenticated user can select any integer ID, and the endpoint returns the fields included in the User response model.

Why this matters

One ordinary account could enumerate and read other users' profiles. The exact disclosure depends on the User response model, which is not provided, but the authorization gap affects every field that model exposes.

The read-by-ID endpoint only requires a logged-in caller and does not verify that the caller owns the record or has an administrator role; the update endpoint in the same file explicitly performs an ID check. If adopted, any authenticated user could try enumerating IDs and receive fields exposed by the User response model. The exact disclosure is unknown because that model is not provided. Users should require a stated access policy, ownership/role checks, and a minimal response schema.

references/details.md:295In the instructionsOpen original file
@router.get("/{user_id}", response_model=User)async def read_user(    user_id: int,    db: AsyncSession = Depends(get_db),    current_user: User = Depends(get_current_user)):    """Get user by ID."""    user = await user_service.repository.get(db, user_id)    if not user:        raise HTTPException(status_code=404, detail="User not found")    return user
Show 1 other places
references/details.md:307In the instructionsOpen original file
@router.patch("/{user_id}", response_model=User)async def update_user(    user_id: int,    user_in: UserUpdate,    db: AsyncSession = Depends(get_db),    current_user: User = Depends(get_current_user)):    """Update user."""    if current_user.id != user_id:        raise HTTPException(status_code=403, detail="Not authorized")
Medium risk

Database debug logging is enabled by default and may record sensitive parameters

Source references: 2
What we found

The asynchronous SQLAlchemy engine is hard-coded with echo=True. SQLAlchemy echo mode outputs executed SQL and bound parameters, so production requests may place email addresses, token-related records, or other business data into application logs.

Why this matters

People or logging platforms with log access could receive personal or business data that was intended to remain in the database. Log retention and forwarding can create additional copies of that data.

The complete application example hard-codes `echo=True` when creating its database engine, with no development/production switch. SQLAlchemy echo logging normally writes executed SQL and bound parameters to logs; after adopting the template, queried or written user and business data may therefore be exposed to log readers and logging services. Users should ask for echo to default off or be enabled only by an explicit development setting, and review log retention and access.

references/details.md:65In the instructionsOpen original file
settings = get_settings()engine = create_async_engine(    settings.DATABASE_URL,    echo=True,    future=True)
Show 1 other places
SKILL.md:3In the instructionsOpen original file
name: fastapi-templatesdescription: Create production-ready FastAPI projects with async patterns, dependency injection, and comprehensive error handling. Use when building new FastAPI applications or setting up backend API projects.---
Could it delete files or keep running?Looks for broad file deletion, disk overwrites, and programs set to start automatically.No risks found
Could it bypass safety checks?Looks for skipped website security checks, excessive file access, or actions that skip your approval.Risks found: 1
High risk

The “production-ready” example opens CORS to every origin, method, and header

Source references: 2
What we found

The application allows all origins, HTTP methods, and headers while also enabling credential mode. This does not match its production-ready positioning and unnecessarily expands cross-site browser access when copied into a real service.

Why this matters

Where the browser and the particular CORS/credential combination permit it, a malicious website could make cross-origin API requests on a visitor's behalf or read responses. Even where browsers reject wildcard-origin credential combinations, this configuration can break legitimate clients and encourage an overly broad replacement.

This is a complete application example presented as “production-ready.” Its CORS configuration permits every origin, method, and header while enabling credentials. Although browsers restrict some wildcard credential requests, this still unnecessarily broadens cross-origin access and can behave differently from what users expect. Users should ask for a deployment-specific origin allowlist and restrict methods and headers before production use.

references/details.md:28In the instructionsOpen original file
# CORS middlewareapp.add_middleware(    CORSMiddleware,    allow_origins=["*"],    allow_credentials=True,    allow_methods=["*"],    allow_headers=["*"],)
Show 1 other places
SKILL.md:3In the instructionsOpen original file
name: fastapi-templatesdescription: Create production-ready FastAPI projects with async patterns, dependency injection, and comprehensive error handling. Use when building new FastAPI applications or setting up backend API projects.---
Could it mislead the AI or hide text?Checks the skill instructions for requests to ignore you, influence the report, or hide text in invisible characters.No risks found
Could it change links or payment recipients without asking?Looks for forced referral or payment changes combined with instructions to hide the change.No risks found

Inside this skill

4 instruction sections

This Skill is a documentation-style template for generating FastAPI projects and directs the agent to the bundled details.md for full implementation examples; the provided content contains no installation command or automatic execution entry point.

View source
SKILL.md:2In the instructionsOpen original file
---name: fastapi-templatesdescription: Create production-ready FastAPI projects with async patterns, dependency injection, and comprehensive error handling. Use when building new FastAPI applications or setting up backend API projects.---
SKILL.md:71In the instructionsOpen original file
## Detailed worked examples and patternsDetailed sections (starting with `## Implementation Patterns`) live in `references/details.md`. Read that file when the navigation summary above is insufficient.

The template reads the database URL and JWT secret from .env, then uses that secret to issue and verify HS256 access tokens.

View source
references/details.md:45In the instructionsOpen original file
class Settings(BaseSettings):    """Application settings."""    DATABASE_URL: str    SECRET_KEY: str    ACCESS_TOKEN_EXPIRE_MINUTES: int = 30    API_V1_STR: str = "/api/v1"    class Config:        env_file = ".env"
references/details.md:351In the instructionsOpen original file
ALGORITHM = "HS256"def create_access_token(data: dict, expires_delta: Optional[timedelta] = None):    """Create JWT access token."""    to_encode = data.copy()    if expires_delta:        expire = datetime.utcnow() + expires_delta    else:        expire = datetime.utcnow() + timedelta(minutes=15)    to_encode.update({"exp": expire})    encoded_jwt = jwt.encode(to_encode, settings.SECRET_KEY, algorithm=ALGORITHM)    return encoded_jwt
references/details.md:396In the instructionsOpen original file
    try:        payload = jwt.decode(token, settings.SECRET_KEY, algorithms=[ALGORITHM])        user_id: int = payload.get("sub")        if user_id is None:            raise credentials_exception    except JWTError:        raise credentials_exception

The database dependency automatically commits after successful request handling and rolls back on exceptions; the repository layer includes operations that create, update, and delete persistent records.

View source
references/details.md:81In the instructionsOpen original file
async def get_db() -> AsyncSession:    """Dependency for database session."""    async with AsyncSessionLocal() as session:        try:            yield session            await session.commit()        except Exception:            await session.rollback()            raise        finally:            await session.close()```
references/details.md:158In the instructionsOpen original file
    async def delete(self, db: AsyncSession, id: int) -> bool:        """Delete record."""        obj = await self.get(db, id)        if obj:            await db.delete(obj)            return True        return False
Start here · InstructionsSKILL.md
fastapi-templates
Lines connect the instruction file to its sections, not an observed execution order. Select a section to read the source.

File reference map

References: 1
Files making referencesReferenced content
Lines show actual file references, not execution order. Select a node to highlight its connections and inspect the files and source locations. Dashed lines include files that still need locating.
Files and check records2 files

Coverage and gaps

Content covered in each file

These are the source ranges included in this check, not a guarantee that every issue has been resolved.

  • SKILL.mdFull text included
  • references/details.mdFull text included

This report is for the version above. We read the available code and instructions without running the skill or checking extra packages it installs. This is not a promise of safety: a different version or setup may behave differently.

  • SKILL.mdInstructions
  • references/details.mdSupporting file

Operations mentioned in code and instructions

Read files
SKILL.md:73In the instructionsOpen original file
Detailed sections (starting with `## Implementation Patterns`) live in `references/details.md`. Read that file when the navigation summary above is insufficient.
Connect to websites
SKILL.md:116In the instructionsOpen original file
    async with AsyncClient(app=app, base_url="http://test") as client:        yield client
Read keys or account settings
references/details.md:32In the instructionsOpen original file
    allow_origins=["*"],    allow_credentials=True,    allow_methods=["*"],
references/details.md:53In the instructionsOpen original file
    class Config:        env_file = ".env"
references/details.md:390In the instructionsOpen original file
    """Get current authenticated user."""    credentials_exception = HTTPException(        status_code=status.HTTP_401_UNAUTHORIZED,
Lines read
547
File checksum (to compare versions)
89d3dddb24448a91d122a0a5b29ace9fea6ca77852c3cbe74013369ab1876905