No. 129 Review the diff

DevSecOps + SSDLC + AppSec Cursor Rule

Use when a diff needs a second pass that stops at findings

  • Claude Code
  • Codex
  • Cursor
  • Review the diff

Prompt

# DevSecOps + SSDLC + AppSec Cursor Rule

## General Security Principles
- Never hardcode secrets, credentials, or API keys. Use environment variables or secure vaults for sensitive data.
- Prohibit the inclusion of `.env`, secret config files, or unknown tokens in source control.
- Never log sensitive data, secrets, or session tokens in application logs.
- Validate and sanitize all user input. Escape output in HTML, JS, and SQL contexts.
- Avoid unsafe functions such as `exec`, `eval`, or similar dynamic code execution.

## Database Security
- Use parameterized queries or ORM for all database access. Do not use string concatenation for query building.
- Ensure database users have the least privilege required for their tasks.
- Regularly review and update database access policies.

## Dependency Management
- Only use packages from verified sources.
- Do not add new dependencies without explicit approval and security review.
- Regularly update dependencies and scan for known vulnerabilities (SCA).

## Authentication & Authorization
- Use secure authentication frameworks; never implement custom authentication.
- Store passwords using strong, salted hashes (e.g., Argon2, bcrypt).
- Implement Role-Based Access Control (RBAC) for sensitive operations.
- Enforce the principle of least privilege for APIs and UI actions.

## Secure SDLC Practices
- Integrate Static Application Security Testing (SAST) and Software Composition Analysis (SCA) into the CI pipeline.
- Scan all code for secrets before merging (Secret Scanning).
- Use Infrastructure as Code (IaC) scanning for all infrastructure code.
- Integrate Dynamic Application Security Testing (DAST) in the CD pipeline for deployed applications.
- Enforce Policy as Code (PaC) for automated, version-controlled security policies.

## Monitoring & Feedback
- Enable continuous vulnerability monitoring and alerting.
- Integrate Runtime Application Self-Protection (RASP) and Web Application Firewall (WAF) as appropriate.
- Encourage regular vulnerability assessments and penetration testing.
- Maintain a feedback loop to update rules and prompts based on recurring vulnerabilities.

## Compliance & Documentation
- Align with industry standards (e.g., OWASP Top 10, NIST, ISO 27001).
- Document all security controls and decisions for auditability.

When to use

“DevSecOps + SSDLC + AppSec Cursor Rule” fits when a diff needs a second pass that stops at findings, because it says “DevSecOps + SSDLC + AppSec Cursor Rule”, and it is written to stay in force on later turns rather than to finish one task.

With “DevSecOps + SSDLC + AppSec Cursor Rule” loaded, the user message can be as small as “fix the empty-cart total in src/cart.js and do not touch the test runner”, because “DevSecOps + SSDLC + AppSec Cursor Rule” is already in force.

When not to use

Leave “DevSecOps + SSDLC + AppSec Cursor Rule” unused when you wanted the fix applied in the same turn, because “DevSecOps + SSDLC + AppSec Cursor Rule” points the other way

How to run it

Claude Code

Claude Code loads “DevSecOps + SSDLC + AppSec Cursor Rule” from .claude/rules on later sessions, so “DevSecOps + SSDLC + AppSec Cursor Rule” survives a new chat, which a one-off paste does not.

Codex

Codex keeps “DevSecOps + SSDLC + AppSec Cursor Rule” only if you put “DevSecOps + SSDLC + AppSec Cursor Rule” in AGENTS.md, or in AGENTS.override.md beside the directory that should inherit it. A paste that is not saved is gone next thread.

Cursor

Cursor keeps “DevSecOps + SSDLC + AppSec Cursor Rule” by saving “DevSecOps + SSDLC + AppSec Cursor Rule” as .cursor/rules. The chat transcript alone will not reload it tomorrow.

Comparison

对比待补

This before-and-after was not run on this machine.

Related

来源:PatrickJS awesome-cursorrules · https://github.com/PatrickJS/awesome-cursorrules/blob/main/rules/security-devsecops-ssdls-appsec.mdc · CC0-1.0 · 2026-12-01