Repo rules
- This provisioning code is designed to run on Manjaro Linux.
Hardened Secure Cursor Rules for Personal Use
Loading actions...
Main instructions and any bundled files for this skill.
โ Never hardcode secrets, tokens, passwords, API keys, or credentials.
โ
Always reference them from process.env, Vault, or encrypted config stores.
โ Disallow insecure code execution: eval, Function, exec, spawn("sh"), vm.runInContext().
โ Do not concatenate strings for SQL.
โ
Use query builders or parameterized methods only.
โ Do not log sensitive data: passwords, tokens, auth headers, PII.
โ
Hash passwords with bcrypt, argon2, or scrypt โ never MD5 or SHA1.
โ
Use HTTPS for all HTTP requests (unless explicitly localhost for dev).
โ All user inputs must be sanitized and validated with schema tools (e.g. Zod, Joi).
โ Never weaken or remove secure headers (CSP, CORS, HSTS, X-Frame-Options).
Security:
os.Getenv() or config storesdeny, no credentialsHttpOnly, Secure, SameSite=Strict.env, .ssh/, secrets.*, /etc, ~/ unless explicitly allowed.curl | bash, no plaintext secretsCOPY with checksums; use secret mounts/env for credentials.cursorignore must exclude:
.env, *.pem, *.key, secrets.*, credentials.json, private/, .ssh/
// RULE-CHECK: Secure rules active
// [SECURITY INTENT]: What this protects.
Especially for: validation, auth, crypto, DB, or network access.
// [SECURITY REASONING]: This approach is safe because...
req.body, req.params, cookies, headers.require(varName) logic.dangerouslySetInnerHTML unless sanitized with DOMPurify or equivalent.secrets: mounts or ENV injection.If a request requires violating any rule:
โโ ๏ธ This violates hardened security constraints. Action blocked.โ
If unsure:
โโ ๏ธ Unclear if this action is secure. Please clarify intent or constraints.โ
// [AI GENERATED SECURE CODE]
---
description: "Hardened Secure Cursor Rules for Personal Use"
version: "1.0"
alwaysApply: true
tags: ["security", "strict", "backend", "frontend", "DevOps", "AI coding"]
---
## ๐ Global Security Constraints
- โ Never hardcode secrets, tokens, passwords, API keys, or credentials.
โ
Always reference them from `process.env`, Vault, or encrypted config stores.
- โ Disallow insecure code execution: `eval`, `Function`, `exec`, `spawn("sh")`, `vm.runInContext()`.
- โ Do not concatenate strings for SQL.
โ
Use query builders or parameterized methods only.
- โ Do not log sensitive data: passwords, tokens, auth headers, PII.
- โ
Hash passwords with `bcrypt`, `argon2`, or `scrypt` โ **never** MD5 or SHA1.
- โ
Use HTTPS for all HTTP requests (unless explicitly `localhost` for dev).
- โ
All user inputs must be sanitized and validated with schema tools (e.g. Zod, Joi).
- โ Never weaken or remove secure headers (CSP, CORS, HSTS, X-Frame-Options).
- **Security**:
- Never hardcode secrets
- use `os.Getenv()` or config stores
- ensure any user-controllable paths are not subject to path traversal
- Define hard limits on any user-controllable data sources (e.,g. buffers, web requests)
---
## ๐ก๏ธ Supply Chain Security
- Prefer using the standard library for common functionality instead of installing dependencies
---
## ๐ก๏ธ Code Quality
- **Constants** Use constants and/or descriptive variable names instead of magic numbers
- **Error Handling**: Always check errors, use descriptive error messages, and define errors at the top of relevant files rather than declaring them in-line
---
## ๐ก๏ธ Secure Defaults
- Assume the following unless explicitly overridden:
- CORS: `deny`, no credentials
- Cookies: `HttpOnly`, `Secure`, `SameSite=Strict`
- HTTP headers: HSTS, X-Content-Type-Options, Referrer-Policy, etc.
- Deny file access to `.env`, `.ssh/`, `secrets.*`, `/etc`, `~/` unless explicitly allowed.
- In web contexts:
- Encode dynamic content
- Block inline event handlers unless sanitized
- In Docker/bash:
- No `curl | bash`, no plaintext secrets
- Use `COPY` with checksums; use secret mounts/env for credentials
- Use modern and recommended patterns in the programming language
- Prefer standard library implementations over third-party packages
---
## ๐งผ Hygiene Enforcement
- `.cursorignore` must exclude:
- `.env`, `*.pem`, `*.key`, `secrets.*`, `credentials.json`, `private/`, `.ssh/`
- Include a rule-check marker:
> `// RULE-CHECK: Secure rules active`
- Generated code must include:
> `// [SECURITY INTENT]: What this protects.`
Especially for: validation, auth, crypto, DB, or network access.
---
## ๐ง Reasoning Requirements
- For sensitive operations, Cursor must add:
> `// [SECURITY REASONING]: This approach is safe because...`
- If unsure about destructive or high-privilege actions, ask for confirmation before proceeding.
---
## ๐งฉ Context-Specific Controls
### ๐ Backend
- Sanitize and validate all input from `req.body`, `req.params`, cookies, headers.
- No dynamic imports or `require(varName)` logic.
### ๐ Frontend
- Escape/encode untrusted content.
- Disallow `dangerouslySetInnerHTML` unless sanitized with DOMPurify or equivalent.
### โ๏ธ DevOps
- No embedded secrets in Dockerfiles, bash scripts, or Compose files.
- Prefer `secrets:` mounts or ENV injection.
---
## ๐ Enforcement Policy
- If a request requires violating any rule:
> โโ ๏ธ This violates hardened security constraints. Action blocked.โ
- If unsure:
> โโ ๏ธ Unclear if this action is secure. Please clarify intent or constraints.โ
---
## ๐ Auditing Tags (optional, for tracing)
- Tag all secure code output with:
> `// [AI GENERATED SECURE CODE]`
---
- This provisioning code is designed to run on Manjaro Linux.
Project Summary:
ALWAYS use uv to run Python code, NOT python or python3!