agentleFS
MN-Lizard-TeamMN-Lizard-Team/aiyu-multi-agent/.cursor/rules/domain/security-rules.mdc

aiyu-multi-agent / domain

Cursor rule8 starsChanged 7 months agoApache-2.0View on GitHub

Mandatory security practices for all code and configuration changes.

  • Reads credentials

The file

We split this security-rules.mdc into the rules it gives an agent

4 rules. About 0 are common, 3 are distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈3

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Run npm audit / pip audit / cargo audit regularly

    line 80
  2. Distinctive:

    Never log sensitive data (passwords, tokens, PII)

    line 101
  3. Distinctive:

    Use TLS 1.2+ for data in transit

    line 108
  4. Distinctive:

    Before completing any task:

    line 116

≈ “Common” is an estimate: at least 1 in 5 of the 7,324 Cursor rule files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
security-rules.mdc
---
description: "Mandatory security practices for all code and configuration changes."
globs:
  - "**/auth/**/*"
  - "**/*.env*"
  - "**/security/**/*"
  - "**/middleware/**/*"
alwaysApply: false
---
# Security Rules — Aiyu Agent Kit

> Mandatory security practices for all code and configuration changes.

---

## 🔴 CRITICAL: Security First

### Hardcoded Secrets Prevention

**NEVER commit:**
- API keys, tokens, passwords in source code
- `.env` files with real credentials
- Private keys, certificates
- Database connection strings with credentials

**ALWAYS use:**
- Environment variables
- Secret management (Vault, AWS Secrets Manager, etc.)
- `.env.example` for documentation

### Input Validation

```python
# ✅ GOOD — Validate and sanitize all inputs
user_input = sanitize_input(raw_input)
if not validate_format(user_input, expected_pattern):
    raise ValidationError("Invalid input format")

# ❌ BAD — Direct use of untrusted input
query = f"SELECT * FROM users WHERE id = {user_input}"
```

### Output Encoding

- HTML: Escape with `htmlspecialchars` or framework equivalents
- SQL: Use parameterized queries exclusively
- JSON: Use proper serialization, never string concatenation
- Shell: Never pass user input to shell commands

---

## 🟡 HIGH: Secure Defaults

### Authentication & Authorization

- Passwords: Minimum 12 chars, bcrypt/Argon2 only
- Sessions: Secure, HttpOnly, SameSite cookies
- JWT: Short expiry, refresh token rotation
- MFA: Require for admin/sensitive operations

### Error Handling

```python
# ✅ GOOD — Generic errors to users, detailed to logs
try:
    process_data()
except Exception as e:
    log.error(f"Processing failed: {e}")  # Detailed log
    return {"error": "Processing failed"}  # Generic user message

# ❌ BAD — Information leakage
try:
    process_data()
except Exception as e:
    return {"error": f"Database connection failed: {e}"}
```

### Dependencies

- Run `npm audit` / `pip audit` / `cargo audit` regularly
- Pin versions in lock files
- Review new dependencies for security
- Subscribe to security advisories

---

## 🟢 MEDIUM: Security Hardening

### Headers & Configuration

```
Content-Security-Policy: default-src 'self'
X-Content-Type-Options: nosniff
X-Frame-Options: DENY
Strict-Transport-Security: max-age=31536000; includeSubDomains
```

### Logging & Monitoring

- Log security events (auth success/failure, access denied)
- Never log sensitive data (passwords, tokens, PII)
- Alert on suspicious patterns
- Regular security log reviews

### Data Protection

- Encrypt data at rest (AES-256)
- Use TLS 1.2+ for data in transit
- Classify data sensitivity
- Implement data retention policies

---

## Security Checklist

Before completing any task:

- [ ] No hardcoded secrets in code
- [ ] All inputs validated and sanitized
- [ ] Proper error handling (no info leakage)
- [ ] Dependencies scanned for vulnerabilities
- [ ] Security headers configured
- [ ] Authentication/authorization appropriate
- [ ] Sensitive data encrypted

---

> 🔒 **Remember:** Security is not a feature, it's a foundation.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.