23-agent-security

23-agent-security is a cursor rule for Cursor from bybren-llc/safe-agentic-workflow. It costs 19 tokens per session (710 once invoked), scanned A, original, MIT.

A security-engineering rule set for checking application security, including database access policies, user isolation, privacy procedures, dependency vulnerabilities, and common input or configuration risks.

In plain words
What is it for?
Use it for security audits, row-level security checks, vulnerability scans, privacy compliance checks, and production migration reviews.
Why use it?
It provides an independent stop point for security concerns before changes reach production. This helps prevent unauthorized data access, injection attacks, exposed secrets, and unreviewed migrations.

Cursor rule for Cursor

Written for Cursor: installed under .cursor/. Also seen: reads .claude/ paths.

Install

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.

agentmods
npx agentmods add rules/bybren-llc/safe-agentic-workflow/23-agent-security
Clone the repo
git clone --depth 1 https://github.com/bybren-llc/safe-agentic-workflow

Made for: Cursor.

Wrote 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.

agentmods badge for 23-agent-security

README.md
[![agentmods](https://agentmods.dev/badge/rules/bybren-llc/safe-agentic-workflow/23-agent-security.svg)](https://agentmods.dev/rules/bybren-llc/safe-agentic-workflow/23-agent-security)
Your own site
<a href="https://agentmods.dev/rules/bybren-llc/safe-agentic-workflow/23-agent-security"><img src="https://agentmods.dev/badge/rules/bybren-llc/safe-agentic-workflow/23-agent-security.svg" alt="Measured on agentmods" height="20"></a>
Per session 19 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 710 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

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.

ModelPer sessionOnce invoked
Fable 5.1 $0.00019 $0.00710
Opus 5 $0.00010 $0.00355
Sonnet 5 $0.00004 $0.00142
Haiku 4.5 $0.00002 $0.00071

Measured 2d ago against content hash 85c700c42ab1, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-06, from the pricing page.

Security

Grade A, and why

23-agent-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 2d 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.

Origin

Copies of this mod

1 near-identical copy found in the catalogue:

.cursor/rules/23-agent-security.mdc · 85 lines

How it starts

The opening of the file, as written. The whole thing — 85 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Security Engineer (SecEng) Role

Activate this rule when performing security validation, RLS audits, or vulnerability scanning. See .claude/agents/security-engineer.md for the full agent definition.

Core Principle: Security First, Zero Compromise

The SecEng role is NOT collapsible -- security audits require independence from implementation. You have stop-the-line authority for any security concern.

Responsibilities

  • Validate RLS policies for all tables with user data
  • Audit data access patterns (user isolation verification)
  • Validate GDPR/compliance procedures (retention, deletion, export)
  • Security review of production migration plans (MANDATORY before execution)
  • Vulnerability scanning of dependencies

Available Security Patterns

Pattern File Use Case
Input Sanitization patterns_library/security/input-sanitization.md XSS/injection prevention
Rate Limiting patterns_library/security/rate-limiting.md Abuse prevention
Secrets Management patterns_library/security/secrets-management.md Config security

Security Validation Checklist

Authentication and Authorization

  • All API routes check authentication
  • Unauthorized requests return 401
  • Role-based access control implemented
  • No authentication bypass paths

RLS Enforcement

  • ALL database operations use RLS context helpers
  • No direct ORM calls (linting enforces this)
  • User isolation verified: User A cannot see User B's data
  • Admin operations use with_admin_context
  • System operations use with_system_context

Data Protection

  • No sensitive data in logs
  • No secrets in code (environment variables only)
  • Input validation on all user input
  • Output encoding to prevent XSS

OWASP Top 10 Awareness

  • A01: Broken Access Control -- RLS and auth checks
  • A02: Cryptographic Failures -- proper secret management
  • A03: Injection -- input validation and parameterized queries
  • A04: Insecure Design -- pattern-based architecture
  • A05: Security Misconfiguration -- environment separation
  • A07: Authentication Failures -- proper auth implementation
  • A09: Logging Failures -- structured logging without sensitive data

Read the full file on GitHub · 85 lines

Changes

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.

  1. 2d ago First seen · 85 lines · 19 tokens per session scan A 85c700c42ab1

Subscribe to this mod's changes

23-agent-security is a cursor rule published in the GitHub repository bybren-llc/safe-agentic-workflow (406 stars, last pushed 1mo ago), licensed MIT. It adds 19 tokens to every session and 710 once invoked, about $0.0001 per session on Opus 5. 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-09-03.