ml-secure-no-railguard-available

ml-secure-no-railguard-available is a cursor rule for Cursor from brighton-labs/railguard-cursor-coding. It costs 837 tokens per session, scanned A, original, MIT.

Security rules for Python machine-learning code, including training, prediction, data loading, and model files. They treat incoming data and downloaded model files as potentially unsafe.

In plain words
What is it for?
Use them when writing or reviewing ML pipelines, loading model checkpoints, handling datasets, or building prediction services.
Why use it?
They reduce risks such as malicious files, poisoned data, unsafe code execution, leaked personal information, and hidden errors.

Cursor rule for Cursor

Written for Cursor: installed under .cursor/.

Good fit Use them when writing or reviewing ML pipelines, loading model checkpoints, handling datasets, or building prediction services.

Compare 6 cursor rules from other repositories ↓
Install with agentmods
npx agentmods add rules/brighton-labs/railguard-cursor-coding/ml-secure-no-railguard-available
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/brighton-labs/railguard-cursor-coding

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 ml-secure-no-railguard-available

README.md
[![agentmods](https://agentmods.dev/badge/rules/brighton-labs/railguard-cursor-coding/ml-secure-no-railguard-available.svg)](https://agentmods.dev/rules/brighton-labs/railguard-cursor-coding/ml-secure-no-railguard-available)
Your own site
<a href="https://agentmods.dev/rules/brighton-labs/railguard-cursor-coding/ml-secure-no-railguard-available"><img src="https://agentmods.dev/badge/rules/brighton-labs/railguard-cursor-coding/ml-secure-no-railguard-available.svg" alt="Measured on agentmods" height="20"></a>
Per session 837 This file is loaded in full into every session.
When invoked 837 The same file — it is already loaded in full.
Security scan A 0 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.00837 $0.00837
Opus 5 $0.00418 $0.00418
Sonnet 5 $0.00167 $0.00167
Haiku 4.5 $0.00084 $0.00084

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

Security

Grade A, and why

ml-secure-no-railguard-available 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 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.

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.

.cursor/rules/ml-secure-no-railguard-available.mdc · 86 lines

How it starts

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

R: Risk First

  • The goal is to reduce risk exposure in machine learning pipelines by securing data ingestion, model checkpoint loading, dependency handling, and inference logic.
  • AI-generated ML code should not trust unknown data sources or model files without validation.
  • The LLM must ensure safety against insecure serialization, poisoning, and unsafe dynamic behavior.

A: Attached Constraints

  • Never use pickle.load() or torch.load() on files from untrusted sources.
  • Never use eval() or exec() to dynamically interpret model code, formulas, or input.
  • Never suppress exceptions silently (try/except: pass).
  • Avoid using untyped data transformations or outputs.
  • Do not log raw inputs from end users (can include PII).

I: Interpretative Framing

  • Treat all input data (CSV, JSON, NumPy, HuggingFace datasets) as potentially malformed or poisoned unless explicitly validated.
  • If loading a model checkpoint, assume the file may have been tampered with.
  • When generating inference code, assume it may be deployed in production with untrusted input.

L: Local Defaults

  • Use joblib or torch.load() only on trusted, versioned model paths
  • Prefer torch.save(model.state_dict()) for safe model export; avoid full object serialization
  • Use Pydantic or Marshmallow schemas for preprocessing configs and inference input validation
  • Use logging for monitoring; avoid print() and never log raw request.body
  • Default to strict file permissions (r, no rb+)

G: Generative Path Checks

  1. When generating model loading logic:
    • Confirm source is trusted or version-controlled
    • Avoid deserializing entire objects unless safe
    • Use checksum or hash verification if relevant
  2. When preprocessing data:
    • Validate data structure (rows, types, shape)
    • Use try/except with logging for failed transforms
  3. When handling input for inference:
    • Validate schema
    • Normalize securely
    • Avoid leaking model internals in output

U: Uncertainty Disclosure

  • If unsure about input format, file source, or serialization method, generate a comment: “Verify this file path is trusted before deserializing model.”
  • If unsure about preprocessing correctness, generate: “Review schema/shape assumptions before transforming user input.”

Read the full file on GitHub · 86 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. 8d ago First seen · 86 lines · 837 tokens per session scan A 575bfe0def9b

Subscribe to this mod's changes

ml-secure-no-railguard-available is a cursor rule published in the GitHub repository brighton-labs/railguard-cursor-coding (13 stars, last pushed 1y ago), licensed MIT. It adds 837 tokens to every session, about $0.0042 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-30.