security-guardrails

security-guardrails is a cursor rule for coding agents from ofershap/vibe-guard. It costs 282 tokens per session, scanned A, original, MIT.

A set of always-on rules for writing safer application code. It covers secrets, user input, authentication, databases, cookies, errors, rate limits, and cross-origin requests.

In plain words
What is it for?
Use it while creating APIs, handling sign-ins, processing user data, or adding database operations.
Why use it?
It helps prevent common security mistakes, such as exposing passwords, accepting unsafe input, or building vulnerable database queries.

Cursor rule

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/ofershap/vibe-guard/security-guardrails
Clone the repo
git clone --depth 1 https://github.com/ofershap/vibe-guard

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 security-guardrails

README.md
[![agentmods](https://agentmods.dev/badge/rules/ofershap/vibe-guard/security-guardrails.svg)](https://agentmods.dev/rules/ofershap/vibe-guard/security-guardrails)
Your own site
<a href="https://agentmods.dev/rules/ofershap/vibe-guard/security-guardrails"><img src="https://agentmods.dev/badge/rules/ofershap/vibe-guard/security-guardrails.svg" alt="Measured on agentmods" height="20"></a>
Per session 282 This file is loaded in full into every session.
When invoked 282 The same file — it is already loaded in full.
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 $0.00282 $0.00282
Opus 5 $0.00141 $0.00141
Sonnet 5 $0.00056 $0.00056
Haiku 4.5 $0.00028 $0.00028

Measured 3d ago against content hash a9d39867ee27, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

security-guardrails 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 3d 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.

rules/security-guardrails.mdc · 29 lines

What it actually says

Before writing any code that handles user input, authentication, or database operations:

  1. NEVER hardcode API keys, passwords, tokens, or secrets - always use environment variables
  2. ALWAYS validate and sanitize user input before processing - use Zod, Joi, or equivalent
  3. ALWAYS add authentication middleware to API routes unless explicitly marked as public
  4. NEVER use string interpolation in SQL queries - always use parameterized queries
  5. ALWAYS set CORS to specific origins in production - never use wildcard (*)
  6. ALWAYS hash passwords with bcrypt/scrypt/Argon2 - never MD5, SHA1, or plain text
  7. ALWAYS set httpOnly, secure, and sameSite flags on cookies
  8. NEVER expose stack traces or internal errors to users in production
  9. ALWAYS add rate limiting to authentication endpoints
  10. NEVER commit .env files - always use .env.example with placeholder values

When generating a new API endpoint:

  • Add input validation
  • Add authentication check
  • Add rate limiting for sensitive operations
  • Return generic error messages

When generating database queries:

  • Use parameterized queries or ORM methods
  • Add Row-Level Security policies if using Supabase/Postgres
  • Never trust user input in WHERE clauses
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. 3d ago First seen · 29 lines · 282 tokens per session scan A a9d39867ee27

Subscribe to this mod's changes

security-guardrails is a cursor rule published in the GitHub repository ofershap/vibe-guard (1 stars, last pushed 6mo ago), licensed MIT. It adds 282 tokens to every session, about $0.0014 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-08-31.