repositories / dotfiles

dotfiles

bugabingas dorkfiles

owned by bugabinga

opencode/skills/security-checklist/SKILL.md

Raw

name: security-checklist description: Security review checklist — injection (SQL, XSS, CSRF), auth flaws, secrets in code, dependency CVEs, input validation. Use before deploying or during code review to catch vulnerabilities early. license: MIT

What I do

Review code for security vulnerabilities before committing.

Checklist

Input Validation

Authentication

Authorization

Data Protection

Dependencies

Error Handling

API Security

Secrets

Common Vulnerabilities

SQL Injection

// Bad
query := fmt.Sprintf("SELECT * FROM users WHERE id = %s", id)

// Good
query := "SELECT * FROM users WHERE id = $1"
db.Query(query, id)

Format String

// Bad
printf(user_input);

// Good
printf("%s", user_input);

Buffer Overflow

// Bad
strcpy(dest, src);

// Good
strncpy(dest, src, sizeof(dest) - 1);
dest[sizeof(dest) - 1] = '\0';

Tools

# Rust
cargo audit
cargo deny check

# Go
go vet ./...

# C
gcc -fsanitize=address

# Secrets
gitleaks detect

Before Deploy


Use before every commit.

Markdown source
File outline
---
name: security-checklist
description: Security review checklist — injection (SQL, XSS, CSRF), auth flaws, secrets in code, dependency CVEs, input validation. Use before deploying or during code review to catch vulnerabilities early.
license: MIT
---

## What I do

Review code for security vulnerabilities before committing.

## Checklist

### Input Validation

- [ ] User inputs validated
- [ ] Length limits enforced
- [ ] Special characters sanitized

### Authentication

- [ ] Passwords hashed (Argon2/bcrypt, not MD5/SHA)
- [ ] Session tokens secure
- [ ] No hardcoded credentials

### Authorization

- [ ] RBAC implemented
- [ ] Users access only own data
- [ ] Admin endpoints protected

### Data Protection

- [ ] Sensitive data encrypted at rest
- [ ] TLS for data in transit
- [ ] Secrets in env vars, not code

### Dependencies

- [ ] Up to date
- [ ] No known vulnerabilities
- [ ] Lock files committed

### Error Handling

- [ ] No sensitive info in errors
- [ ] Stack traces hidden
- [ ] Rate limiting on failed attempts

### API Security

- [ ] Rate limiting
- [ ] SQL injection prevented
- [ ] Parameterized queries

### Secrets

- [ ] No secrets in code
- [ ] Rotated regularly

## Common Vulnerabilities

### SQL Injection

```go
// Bad
query := fmt.Sprintf("SELECT * FROM users WHERE id = %s", id)

// Good
query := "SELECT * FROM users WHERE id = $1"
db.Query(query, id)
```

### Format String

```c
// Bad
printf(user_input);

// Good
printf("%s", user_input);
```

### Buffer Overflow

```c
// Bad
strcpy(dest, src);

// Good
strncpy(dest, src, sizeof(dest) - 1);
dest[sizeof(dest) - 1] = '\0';
```

## Tools

```bash
# Rust
cargo audit
cargo deny check

# Go
go vet ./...

# C
gcc -fsanitize=address

# Secrets
gitleaks detect
```

## Before Deploy

- [ ] Full security scan
- [ ] Env vars verified
- [ ] SSL/TLS valid
- [ ] Security headers configured

---

Use before every commit.