CtrlK
CommunityDocumentationLog inGet started
Tessl Logo

maria/fastapi

FastAPI framework with Pydantic v2 patterns, PII sanitisation, and practical workflows

94%

Overall

Overview
Review
Evals
Files

pii-sanitisation.mdrules/

alwaysApply:
Yes

PII Sanitisation

Response Model Requirement

Every FastAPI endpoint MUST declare response_model= with a Pydantic model. This acts as an allowlist — only fields in the response model are serialised. Endpoints returning raw dicts, ORM objects, or untyped data are not permitted.

# Required — explicit response model
@app.get("/users/{id}", response_model=UserResponse)

# Not permitted — no response model
@app.get("/users/{id}")

PII Field Detection

When a response model contains fields matching PII patterns, warn and recommend one of:

  1. Remove the field from the response model
  2. Mask the field (e.g., emailj***@example.com)
  3. Document justification with a code comment explaining why the PII is required in the response

PII patterns to flag

CategoryField name patterns
Emailemail, email_address, *_email
Phonephone, phone_number, mobile, telephone
SSN / National IDssn, national_id, tax_id, social_security
Physical addressaddress, street, city, zip_code, postal_code
Date of birthdob, date_of_birth, birth_date, birthday
IP addressip, ip_address, client_ip
Financialaccount_number, card_number, iban, routing_number
tessl i maria/fastapi@0.1.0

tile.json