secure-by-default

secure-by-default is a cursor rule for Cursor from j4flmao/agent-skills. It costs 24 tokens per session (1,185 once invoked), scanned E, original, MIT.

A baseline of security rules for code, configuration, infrastructure, CI, and shell commands generated by an AI assistant. It covers secrets, untrusted input, and related safety practices.

In plain words
What is it for?
It guides secure handling of API keys, passwords, tokens, cloud access, web requests, files, webhooks, queue messages, and AI output.
Why use it?
It reduces common risks such as exposing credentials, logging sensitive data, or trusting unchecked input. The rules apply even when another task or skill is active.

Cursor rule for Cursor

Written for Cursor: installed under .cursor/.

Good fit It guides secure handling of API keys, passwords, tokens, cloud access, web requests, files, webhooks, queue messages, and AI output.

Compare 6 cursor rules from other repositories ↓
Install with agentmods
npx agentmods add rules/j4flmao/agent-skills/secure-by-default
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.

Clone the repo
git clone --depth 1 https://github.com/j4flmao/agent-skills

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 secure-by-default

README.md
[![agentmods](https://agentmods.dev/badge/rules/j4flmao/agent-skills/secure-by-default/github.svg)](https://agentmods.dev/rules/j4flmao/agent-skills/secure-by-default)
Your own site
<a href="https://agentmods.dev/rules/j4flmao/agent-skills/secure-by-default"><img src="https://agentmods.dev/badge/rules/j4flmao/agent-skills/secure-by-default/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for secure-by-default

Your own site · 80×15
<a href="https://agentmods.dev/rules/j4flmao/agent-skills/secure-by-default"><img src="https://agentmods.dev/badge/rules/j4flmao/agent-skills/secure-by-default.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 24 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,185 The whole file, excluding the scripts and references it only reads on demand.
Security scan E 3 findings. A grade says what 26 rules found in the file — not that it is safe.
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.00024 $0.01185
Opus 5.5 $0.00010 $0.00474
Sonnet 5.5 $0.00005 $0.00237
Haiku 4.5 $0.00002 $0.00119

Measured 23d ago against content hash 0ad37663f450, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade E, and why

secure-by-default scanned grade E with 3 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 23d 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.

Downloads and executes remote codehighSupply chain

curl | sh runs whatever the server returns today, which is not necessarily what it returned when this was reviewed.

- **Action**: Pin GitHub Actions and container base images by digest/SHA for anything that runs with secrets. Prefer package managers over `curl ... | sh`; if an installer script is unavoidable, download it, check its ch

Cloud metadata endpointhighServer-side request forgery

One request to 169.254.169.254 can return temporary IAM credentials.

- **Action**: Server-side fetches of user-supplied URLs need an SSRF guard: allow-list hosts, block private/link-local ranges (including `169.254.169.254`), and re-check after redirects.

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

- **Action**: Pin GitHub Actions and container base images by digest/SHA for anything that runs with secrets. Prefer package managers over `curl ... | sh`; if an installer script is unavoidable, download it, check its ch
.cursor/rules/secure-by-default.mdc · 55 lines

How it starts

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

Secure by Default

Cursor/AI MUST apply this baseline to all generated code, configuration, infrastructure, CI, and shell commands, whichever skill is active. Domain rules (crypto, database, distributed systems, RAG, ML, eBPF, MISRA-C, ZK, MCP) add detail on top of it.

1. Secrets

  • Rule: Never write a real or realistic secret (API key, password, token, private key, connection string with credentials) into code, config, docs, tests, or commit messages.
  • Action: Read secrets from environment variables or a secret manager (Vault, AWS Secrets Manager, GCP Secret Manager, Azure Key Vault, Doppler, 1Password). Use workload identity (IAM roles, IRSA, Workload Identity Federation, OIDC in CI) instead of static cloud keys. In examples use obvious placeholders like <api-key> or ${API_KEY}.
  • Action: Never log secrets, tokens, or full request bodies that may contain them; redact before logging.

2. Untrusted input

  • Rule: Treat every input as hostile: HTTP params, headers, files, queue messages, webhooks, LLM output, and content fetched from the web.
  • Action: Validate with an allow-list schema at the boundary (Zod, Pydantic, JSON Schema). Use parameterized queries or an ORM (never string-built SQL), safe templating with auto-escaping (never innerHTML/dangerouslySetInnerHTML with user data), and argument arrays for subprocesses (never shell=True / string-built commands).
  • Action: Server-side fetches of user-supplied URLs need an SSRF guard: allow-list hosts, block private/link-local ranges (including 169.254.169.254), and re-check after redirects.
  • Action: Never deserialize untrusted data with unsafe loaders (pickle, yaml.load without SafeLoader, Java native serialization).

3. Authentication and authorization

  • Rule: Every endpoint and every object access checks authorization on the server (deny by default); hiding a button is not access control.
  • Action: Check object ownership on each read/write to prevent IDOR. Use vetted auth libraries or an identity provider (OIDC); hash passwords per crypto-deprecation.md; rate-limit login, signup, password reset, and OTP endpoints; require MFA for admin access.

Read the full file on GitHub · 55 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. 23d ago First seen · 55 lines · 24 tokens per session scan E 0ad37663f450

Subscribe to this mod's changes

secure-by-default is a cursor rule published in the GitHub repository j4flmao/agent-skills (47 stars, last pushed 17d ago), licensed MIT. It adds 24 tokens to every session and 1,185 once invoked, about $0.0001 per session on Opus 5.5. A static security scan graded it E with 3 findings (downloads and executes remote code, cloud metadata endpoint, makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-11-11.

Related

secure-by-default compared with cursor rules from other repositories

secure-by-default next to 6 cursor rules from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
secure-by-defaultj4flmao/agent-skillsCursor rule4717d agoMITE24Cursor
ponytailDietrichGebert/ponytailCursor rule204k12d agoMITA604Cursor
angular-20angular/angularCursor rule102ktodayMITA0Cursor
dev-standardapache/supersetCursor rule76ktodayApache-2.0A1,147Cursor
prefer-assertions-over-defensive-checksprisma/ormCursor rule48ktodayApache-2.0A0Cursor
prefer-direct-imports-over-module-mocksprisma/ormCursor rule48ktodayApache-2.0A0Cursor
shared-plane-packagesprisma/ormCursor rule48ktodayApache-2.0A0Cursor