stackhawk-optimize-trial

A set of rules for safely testing a named StackHawk scan policy before applying changes. StackHawk is a tool that scans web applications for security issues.

In plain words
What is it for?
Use it to create a temporary policy, run a trial scan, then promote or discard the result using predictable names and recovery safeguards.
Why use it?
It provides a repeatable trial process that avoids changing the application's live policy and handles failed or interrupted attempts.

Cursor rule for Cursor

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/stackhawk/agent-skills/stackhawk-optimize-trial
Clone the repo
git clone --depth 1 https://github.com/stackhawk/agent-skills

Made for: Cursor.

Per session 62 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 821 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 $0.00062 $0.00821
Opus 5 $0.00031 $0.00411
Sonnet 5 $0.00012 $0.00164
Haiku 4.5 $0.00006 $0.00082

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

Security

Grade A, and why

stackhawk-optimize-trial 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.

cursor/.cursor/rules/stackhawk-optimize-trial.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.

Trial Lifecycle

Setup mode builds + references the policy (steps 1–4, no scan); Refine mode runs the trial scan and promotes/discards (steps 5–9). Setup is re-runnable and is what hawkscan onboarding invokes.

How a named policy reaches a scan (why this is non-destructive)

When app.scanPolicy.name is set in stackhawk.yml, HawkScan bootstrap detects an org-level policy and downloads it directly from S3 at scan start (AssetManagerClient.getDownloadedAsset(orgId, SCAN_POLICY, name)), applying its tech flags

  • plugins and then layering the local includePluginIds/excludePluginIds toggles. The application's own stored policy/flags are never read or mutated by this path.

Naming

Trial policy name: OPTIMIZE_TRIAL_<APP>_<ENV>, transformed to match ^[A-Z0-9_]+$ (uppercase; replace any non [A-Z0-9] run with _). Deterministic so re-runs are idempotent.

Create (trial)

  1. Build the trial ScanPolicy JSON (base preset + edited tech flags + toggled plugins).
  2. Clean up any stale orphan first: hawk op policy delete --name OPTIMIZE_TRIAL_… --yes (ignore "not found").
  3. hawk op policy create --file <tmp.json> --name OPTIMIZE_TRIAL_… --display-name "Optimize trial (<APP>/<ENV>)".
  4. Back up stackhawk.yml — but guard against clobbering a good backup: if stackhawk.yml.optimize-bak ALREADY exists (a prior crashed run left it), do NOT overwrite it — it holds the true original. Warn the user, reuse the existing backup, and skip re-copying. Only when no backup exists, copy stackhawk.ymlstackhawk.yml.optimize-bak.
  5. Set app.scanPolicy.name and the corrections; show the diff.

Promote

  1. Ask the user for a permanent policy name (default OPTIMIZE_<APP>), upper-snake.
  2. Ensure the policy JSON is available, then create the permanent policy. The trial policy already lives on the platform, so do NOT assume the local <tmp.json> survived (a resumed/crashed session may have lost it). If <tmp.json> is missing, reconstruct it from the live trial policy: hawk op policy get --name OPTIMIZE_TRIAL_… > <tmp.json>. Then hawk op policy create --file <tmp.json> --name <PERMANENT>.
  3. Update stackhawk.yml app.scanPolicy.name<PERMANENT>; remove the backup file.
  4. hawk op policy delete --name OPTIMIZE_TRIAL_… --yes.
  5. (Optional) hawk op policy assign --app <APP> --name <PERMANENT> to set the platform default.
  6. Leave the stackhawk.yml change staged for the user to review/commit (do not commit for them).

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. 2d ago First seen · 55 lines · 62 tokens per session scan A 41519ac949f2

Subscribe to this mod's changes

stackhawk-optimize-trial is a cursor rule published in the GitHub repository stackhawk/agent-skills (15 stars, last pushed 12d ago), licensed MIT. It adds 62 tokens to every session and 821 once invoked, about $0.0003 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.