backend-endpoint-security-test

Generates and runs security tests for Django REST and GraphQL endpoints covering auth, IDOR, injection, and rate limiting.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires pytest, factory_boy, djangorestframework, graphene, django-ratelimit.

What problem does it solve? Backend APIs handling sensitive data (like PHI under HIPAA) need systematic security testing across every endpoint, but manually writing auth, authorization, IDOR, injection, and rate-limit tests for each route is slow and error-prone. ## Core Features & Use Cases - Endpoint Mapping: Extracts all URL patterns, ViewSets, and GraphQL queries/mutations from Django apps to build a complete endpoint inventory. - Test Templates: Provides ready-to-adapt pytest templates for authentication (401 checks), role-based authorization, IDOR cross-user access, SQL injection/XSS payloads, GraphQL depth/introspection limits, and rate limiting. - Test Generation Command: Includes a Django management command that walks the URL resolver to scaffold security test files per app. - Use Case: Before a HIPAA compliance review, run the skill against the calendar_functionality and risk_screening apps to generate IDOR tests proving one provider cannot read another provider's clinical notes. ## Quick Start Ask the AI to generate security tests for all backend endpoints, or scope it with options like --app calendar_functionality or --category idor.

Frequently Asked Questions about backend-endpoint-security-test

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

FAQPage Schema
How do I test Django REST endpoints for IDOR vulnerabilities?

Create two users with factory_boy factories, authenticate as user A with DRF's APIClient, then request user B's object by ID. Assert the response is 403 or 404 rather than 200, proving object-level permissions block cross-user access.

How to write authentication tests for DRF API endpoints?

Parametrize a list of (method, URL) endpoint pairs and assert each returns 401 without credentials, with an expired token, and with a malformed JWT. Use APIClient.credentials with HTTP_AUTHORIZATION headers instead of force_authenticate for real auth checks.

Does force_authenticate bypass JWT validation in DRF tests?

Yes, force_authenticate sets the user directly without any JWT validation, so it is suitable only for authorization tests. For authentication tests, pass real or invalid tokens via the Authorization header to exercise the actual token verification path.

How do I test GraphQL query depth limiting in Graphene?

Send a deeply nested query (10+ levels) to the GraphQL endpoint and check whether the response contains errors or is rejected. If a 200 response returns full data, no depth limiting is configured, which is a denial-of-service finding.

Why do rate limiting tests fail when fixtures mock is_ratelimited?

Autouse fixtures like otp_common_patches mock django-ratelimit's is_ratelimited to always return False, so 429 responses never occur. Rate limiting tests must exclude or override these fixtures to exercise the real throttling logic.

What are the limitations of automated endpoint security test generation?

Generated tests rely on discovered URL patterns and cannot infer business-logic authorization rules, so permission classes must be verified per app. Findings like missing rate limits are reported as warnings and still require manual triage.