api-response-sanitizer

Audit and fix API serializers, GraphQL types, and frontend state to prevent PHI/PII leakage.

Updated May 11, 2026
One-click install
npx skills add https://github.com/thachrocky12345/local-agent-train-workstation --skill api-response-sanitizer-thachrocky12345
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: api-response-sanitizer
Source: https://github.com/thachrocky12345/local-agent-train-workstation/tree/main/.claude/skills/api-response-sanitizer
Command: npx skills add https://github.com/thachrocky12345/local-agent-train-workstation --skill api-response-sanitizer-thachrocky12345

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? API responses often leak sensitive PHI/PII fields like clinical notes, OAuth tokens, risk scores, and payment identifiers through overly permissive serializers, GraphQL types, or client-side caching. This Skill audits your Django REST Framework serializers, Graphene schemas, middleware, and frontend state stores to find and fix field-level exposure violations. ## Core Features & Use Cases - Serializer Auditing: Scans DRF serializers for fields = '__all__', missing write_only flags, and SerializerMethodField leaks on PHI models, producing a field-level exposure map. - GraphQL & Middleware Checks: Verifies resolver ownership filtering, auth decorators, introspection settings, and can generate a response sanitization middleware that strips stack traces, redacts emails, and sets no-store cache headers on PHI endpoints. - Frontend Cache Review: Detects PHI persisted in Redux slices, Apollo cache, localStorage, console logs, and dangerouslySetInnerHTML XSS vectors. - Use Case: Before deploying a new telehealth feature, run the audit to confirm that Notes.notes, OAuth tokens, and provider NPI numbers are never exposed to unauthorized users, and receive a markdown exposure map with PASS/FAIL verdicts per serializer. ## Quick Start Ask the assistant to run the api-response-sanitizer skill with scope all and the fix flag to audit serializers, GraphQL, middleware, and frontend state for PHI leakage.

Frequently Asked Questions about api-response-sanitizer

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I prevent PHI leakage in Django REST Framework serializers?

Audit each serializer for fields = '__all__' on PHI models, ensure sensitive fields use write_only or are excluded, and check SerializerMethodField implementations for leaking related data. Generate a field-level exposure map listing every exposed field with a PASS/FAIL verdict.

How to check GraphQL APIs for sensitive data exposure?

Scan DjangoObjectType definitions for sensitive fields like notes, tokens, and scores, then verify resolvers filter querysets by the requesting user and use login_required decorators. Also check whether GraphQL introspection is disabled in production settings.

Does Apollo Client cache PHI by default?

Yes, Apollo caches all query results by default, which can persist PHI in the client. Set fetchPolicy to 'no-cache' or 'network-only' on queries returning notes, risk screening results, or appointment details to prevent sensitive data from lingering in the cache.

Why is fields = '__all__' dangerous on healthcare models?

Using '__all__' automatically exposes every model field, including OAuth tokens, clinical notes, vulnerability flags, and payment identifiers added later. Explicitly listing fields ensures new sensitive columns are never accidentally leaked in API responses.

What are the limitations of serializer-level access control for clinical notes?

When a model like Notes has no get_queryset override or custom manager, ownership enforcement depends entirely on views and serializers. String-matched relationships without foreign keys require manual ownership queries, making cross-provider isolation easy to get wrong.