cmd-moodle-security-review

cmd-moodle-security-review is a cursor rule for Cursor from SaadRahman01/claude-moodle-dev. It costs 26 tokens per session (704 once invoked), scanned A, original, MIT.

A Moodle-focused security checklist for reviewing PHP code. Moodle is a learning platform, and the checklist covers login, permissions, request protection, input validation, database queries, and output safety.

In plain words
What is it for?
Use it to audit a Moodle file, directory, or complete plugin and receive findings with file locations, severity, category, and suggested fixes.
Why use it?
It exposes common security weaknesses such as missing access checks, unsafe requests, unvalidated input, and SQL built by joining user data into a query.

Cursor rule for Cursor

Written for Cursor: installed under .cursor/.

Good fit Use it to audit a Moodle file, directory, or complete plugin and receive findings with file locations, severity, category, and suggested fixes.

Compare 6 cursor rules from other repositories ↓
Install with agentmods
npx agentmods add rules/saadrahman01/claude-moodle-dev/cmd-moodle-security-review
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/SaadRahman01/claude-moodle-dev

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 cmd-moodle-security-review

README.md
[![agentmods](https://agentmods.dev/badge/rules/saadrahman01/claude-moodle-dev/cmd-moodle-security-review.svg)](https://agentmods.dev/rules/saadrahman01/claude-moodle-dev/cmd-moodle-security-review)
Your own site
<a href="https://agentmods.dev/rules/saadrahman01/claude-moodle-dev/cmd-moodle-security-review"><img src="https://agentmods.dev/badge/rules/saadrahman01/claude-moodle-dev/cmd-moodle-security-review.svg" alt="Measured on agentmods" height="20"></a>
Per session 26 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 704 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 1 finding. 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.00026 $0.00704
Opus 5 $0.00013 $0.00352
Sonnet 5 $0.00005 $0.00141
Haiku 4.5 $0.00003 $0.00070

Measured 8d ago against content hash 804280f79a52, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-08, from the pricing page.

Security

Grade A, and why

cmd-moodle-security-review scanned grade A with 1 finding 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 8d 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.

Makes network callslowCapability

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

15. Uses `\curl` wrapper, not raw `curl_exec()` / `file_get_contents($url)`
adapters/cursor/.cursor/rules/cmd-moodle-security-review.mdc · 64 lines

What it actually says

You will perform a Moodle-specific security review.

User's input: {user_input}

Activate the moodle-security-audit skill for context.

If {user_input} is empty, ask for a file or plugin path.

Audit each PHP file in scope against this checklist. Report findings as:

[FILE]:[LINE] [SEVERITY] [CATEGORY] — [issue]
                                         FIX: [actionable fix]

Severities: CRITICAL (exploitable now), HIGH (privilege escalation / data leak), MEDIUM (defense in depth), LOW (style / hardening).

Checklist

For every entry script (file with require('config.php') or similar):

  1. require_login() present and called early
  2. require_capability() against the object's context (not arbitrary system context)
  3. require_sesskey() on every state-changing request (POST or mutating GET)
  4. All input via required_param/optional_param with appropriate PARAM_* type — flag any $_GET/$_POST/$_REQUEST usage

For every DB call: 5. Uses $DB->... — flag any mysqli_*, PDO, mysql_* 6. Placeholders (? / :name) — flag string concatenation in SQL 7. LIKE patterns use $DB->sql_like() + sql_like_escape() 8. IN (...) uses $DB->get_in_or_equal()

For every output: 9. User text rendered via s(), format_string(), format_text() — flag direct echo $var 10. format_string/format_text is called with a context 11. Mustache {{{var}}} raw output is justified (text already passed through format_text)

For file APIs: 12. pluginfile.php callback re-checks capability inside callback 13. Files are served via \file_storage + send_stored_file, never raw $CFG->dataroot 14. Uploads use file_save_draft_area_files with maxfiles, maxbytes, accepted_types

For HTTP / external: 15. Uses \curl wrapper, not raw curl_exec() / file_get_contents($url) 16. Open redirects: redirect($next) with $next from user input is validated against site host

For secrets: 17. No tokens / API keys committed in source — use set_config/get_config

For dangerous PHP: 18. No eval(), create_function(), unserialize() on user input 19. print_error is replaced with throw new \moodle_exception()

For sessions: 20. \core\session\manager::write_close() called early on AJAX endpoints that don't write session

After audit:

  • Print summary: N CRITICAL, N HIGH, N MEDIUM, N LOW
  • Offer to apply fixes one-by-one or as a single patch (ask before writing)
  • For unresolved CRITICAL findings, recommend not deploying until fixed
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. 8d ago First seen · 64 lines · 704 tokens per session scan A 804280f79a52

Subscribe to this mod's changes

cmd-moodle-security-review is a cursor rule published in the GitHub repository SaadRahman01/claude-moodle-dev (36 stars, last pushed 2mo ago), licensed MIT. It adds 26 tokens to every session and 704 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 1 finding (makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.