Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
git clone --depth 1 https://github.com/hamzaamjad/cursor-rulesWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/rules/hamzaamjad/cursor-rules/433-backend-security)<a href="https://agentmods.dev/rules/hamzaamjad/cursor-rules/433-backend-security"><img src="https://agentmods.dev/badge/rules/hamzaamjad/cursor-rules/433-backend-security/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/rules/hamzaamjad/cursor-rules/433-backend-security"><img src="https://agentmods.dev/badge/rules/hamzaamjad/cursor-rules/433-backend-security.svg" alt="Reviewed on agentmods" width="80" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00000 | $0.01104 |
| Opus 5.5 | $0.00000 | $0.00442 |
| Sonnet 5.5 | $0.00000 | $0.00221 |
| Haiku 4.5 | $0.00000 | $0.00110 |
Grade A, and why
433-backend-security scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 1mo ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
How it starts
The opening of the file, as written. The whole thing — 65 lines — stays where its author put it; the contents beside it link to each section on GitHub.
backend-security.mdc
- Purpose: To enforce fundamental security best practices for backend and API development, aligning with OWASP recommendations.
- Requirements:
- Input Validation: All external/untrusted data (request bodies, params, headers) MUST be validated and sanitized using a schema validation library (e.g.,
zod,pydantic,express-validator). Validate type, format, length, and range. - Authentication & Authorization:
- Use secure, framework-recommended session management (e.g., HTTPS-only, SameSite cookies).
- Implement proper authorization checks for all sensitive endpoints/operations.
- Rotate secrets (API keys, JWT secrets) periodically (default: quarterly, document exceptions). Store secrets securely (env vars loaded from vault/KMS in prod/stage,
.envfor local dev ONLY), never commit to VCS.
- SQL & Data Access:
- Use parameterized queries or ORM methods that prevent SQL injection by default.
- Direct use of raw SQL execution functions (e.g., ORM
.raw()) requires explicit justification and review for injection vulnerabilities.
- Error Handling:
- Return generic error messages/codes (e.g., HTTP 4xx/5xx) to clients.
- NEVER expose stack traces, sensitive configuration details, or PII in error responses. Log detailed errors internally.
- Logging:
- Include correlation IDs (
requestId,traceId) in logs. Include authenticateduserIdwhere applicable. - Scrub or mask sensitive data (passwords, PII, secrets) before logging payloads.
- Include correlation IDs (
- Rate Limiting: Implement rate limiting on public endpoints, especially authentication routes (e.g., per IP, per API key), with exponential backoff on failures.
- Dependency Management: Regularly scan dependencies for vulnerabilities (e.g., weekly
npm audit --prod/pip-audit). Patch Critical/High severity vulnerabilities promptly (define SLA, e.g., within 7 days). - Secrets Management: Use appropriate mechanisms for environment (e.g., Vault, AWS Secrets Manager, GCP Secret Manager for prod/stage;
.envfile loaded viadotenvfor local development ONLY). - (Placeholder) Incorporate specific checks from
@security-checklist.mdonce available.
- Input Validation: All external/untrusted data (request bodies, params, headers) MUST be validated and sanitized using a schema validation library (e.g.,
- Validation:
- Check (Static Analysis/Linting): Configure linters (e.g., ESLint security plugins, Bandit for Python) to detect common vulnerabilities like lack of input validation, use of raw SQL, insecure cookie settings.
- Check (Code Review): Explicitly review areas using raw SQL, handling sensitive data, authentication/authorization logic. Verify secret management practices. Verify presence of schema validation on input boundaries. Check error responses for information leakage.
- Check (Testing): Security tests should attempt to bypass validation, trigger errors, exploit potential injection points. Dependency scan results must be checked in CI.
- Check: Is
@security-checklist.mdintegrated or its content addressed? (Needs Clarification)
- Examples:
- Input Validation (Pydantic):
from pydantic import BaseModel, Field, EmailStr class UserSignup(BaseModel): email: EmailStr password: str = Field(min_length=8) full_name: str = Field(max_length=100) - Error Handling (Generic):
// Bad: Leaks details // app.use((err, req, res, next) => { res.status(500).send(err.stack); }); // Good: Logs detail, returns generic error app.use((err, req, res, next) => { console.error(`[${req.id}] Error processing request: ${err.message}`, err.stack); res.status(500).json({ error: 'Internal Server Error' }); });
- Input Validation (Pydantic):
- Changes: Updated to include recent security vulnerabilities and mitigation strategies for backend systems, including enhanced logging practices and dependency management.
- Readiness: Needs Clarification (regarding content/location of
@security-checklist.md). Assuming it contains more specific checks, it needs to be obtained and integrated. - Source References:
.cursor/rules/backend-security.mdc; OWASP Top 10;pydanticdocs;zoddocs.
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 1mo ago First seen · 65 lines · 0 tokens per session scan A 6b626acb63ca
433-backend-security is a cursor rule published in the GitHub repository hamzaamjad/cursor-rules (2 stars, last pushed 1y ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 1,104 tokens. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.
Other cursor rules, from other repositories
api-property-optionality-hygiene
Fix ApiProperty/ApiPropertyOptional optionality mismatches in DTO files; use for scheduled batch fixes or DTO edits.
python
Python best practices and patterns for modern software development with Flask and SQLite.
cursor
You are working on the checkout service. Preserve transaction integrity and auditability.
django
Definitive guidelines for writing maintainable, performant, and secure Django applications, emphasizing modern best practices, clear code organization, and efficient patterns.
shared-libraries
Shared libraries - condition framework, inventory containers, file-backed DB, itinerary, references.
selectools-providers
Rules for working with LLM provider adapters in selectools.