agentleFS
mindfortaimindfortai/security-skills/skills/security-tests/SKILL.md

security-tests

Skill16 starsChanged 5 months agoMITView on GitHub

Converts security findings, threat models, and suspected vulnerabilities into concrete regression tests. Use when adding tests that prove an application's security controls keep working.

1 other project uses a version of this.

Adopted by

Most recently taken up by

The file

Show its rules and text

We split this skill into the rules it gives an agent

20 rules. About 0 are common, 19 are distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈19

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Use this skill when a team has a security concern, finding, PR risk, or threat model and needs durable tests that prevent the bug class …

    line 9
  2. Distinctive:

    Test the security invariant, not an incidental implementation detail.

    line 15
  3. Distinctive:

    Prefer denial tests for unauthorized actors and malicious inputs.

    line 16
  4. Distinctive:

    Use existing test frameworks and project patterns.

    line 17
  5. Distinctive:

    Keep tests deterministic and local when possible.

    line 18
  6. Distinctive:

    Do not add brittle tests that require real third-party services unless the repo already has a stable harness.

    line 19
  7. Distinctive:

    Do not introduce broad mocks that skip the security control being tested.

    line 20
  8. Distinctive:

    Use temporary stubs only for external services, credentials, time, network, or nondeterministic providers.

    line 21
  9. Distinctive:

    When subagents are available, ask an independent subagent to review proposed or added tests for whether they would fail against the …

    line 23
  10. Distinctive:

    Use the pattern that best matches the risk:

    line 47
  11. Distinctive:

    Read existing tests and fixtures before writing new tests.

    line 95
  12. Distinctive:

    Create realistic actors, tenants, resources, and malicious inputs.

    line 97
  13. Distinctive:

    Add a positive control only when needed to prove the setup is valid.

    line 99
  14. Distinctive:

    Run the targeted test command.

    line 100
  15. Distinctive:

    Remove temporary validation scaffolding that is not part of the intended test change.

    line 101
  16. Distinctive:

    If the test cannot be added, produce a precise test plan with file locations and fixture needs.

    line 102
  17. Distinctive:

    When editing or proposing tests, output a CSV list of security test coverage:

    line 106
  18. Very specific:

    Use status values such as test_added, test_proposed, test_failed, blocked, residual_gap, or no_confirmed_findings.

    line 112
  19. Distinctive:

    Put verification commands, residual gaps, and a concise coverage summary after the CSV unless the user asks for CSV only.

    line 126
  20. Distinctive:

    Avoid overfitting to one parameter name when the real property is broader.

    line 133

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Security Tests

Use this skill when a team has a security concern, finding, PR risk, or threat model and needs durable tests that prevent the bug class from returning.

The goal is not just to test the patch. The goal is to encode the security property that must remain true.

Principles

  • Test the security invariant, not an incidental implementation detail.
  • Prefer denial tests for unauthorized actors and malicious inputs.
  • Use existing test frameworks and project patterns.
  • Keep tests deterministic and local when possible.
  • Do not add brittle tests that require real third-party services unless the repo already has a stable harness.
  • Do not introduce broad mocks that skip the security control being tested.
  • Use temporary stubs only for external services, credentials, time, network, or nondeterministic providers. The authentication, authorization, tenant filter, validation, approval, signature, or policy control being tested must run for real.
  • Clean up exploratory scratch files, throwaway harnesses, temporary data, and local config changes before final output. Keep only intentional regression tests that the user asked you to add.
  • When subagents are available, ask an independent subagent to review proposed or added tests for whether they would fail against the vulnerable behavior and whether they accidentally mock away the security boundary.

Inputs

Accept any of:

  • A vulnerability finding.
  • A PR security review.
  • A threat scenario.
  • A suspected bug.
  • A patch that needs validation.
  • A security requirement such as "users cannot access other tenants' data."

First identify:

  • The security property.
  • The affected entry point.
  • The attacker starting permissions.
  • The protected asset or action.
  • The expected secure failure mode.
  • The existing test framework and fixtures.

Test Patterns

Use the pattern that best matches the risk:

Authorization

  • User A cannot read/write/delete/export User B's object.
  • Tenant A cannot access Tenant B's records by swapping IDs.
  • Viewer/member cannot perform admin/owner actions.
  • Revoked or disabled identities lose access.
  • Bulk endpoints enforce authorization per object.

Authentication And Sessions

  • Missing, expired, malformed, revoked, wrong-audience, or wrong-issuer tokens fail.
  • Logout and password reset invalidate the right sessions.
  • OAuth/SSO callbacks reject forged state, wrong redirect, or wrong issuer.

Input Handling

  • Unsafe input is rejected or encoded in the correct context.
  • Raw query, shell, path, template, parser, and URL fetch paths cannot be controlled by user input.
  • File upload validation covers type, size, extension, content, path, and parser limits.

Data Exposure

  • Sensitive fields are absent from API responses, logs, exports, telemetry, errors, and client bundles.
  • Debug/internal endpoints are not accessible to unauthorized actors.

Webhooks And Integrations

  • Invalid signatures fail.
  • Old timestamps fail.
  • Replayed events fail or are idempotent.
  • Events are bound to the correct tenant or account.

LLM And Agentic Systems

  • Untrusted content cannot trigger privileged tools.
  • Retrieved content from one tenant cannot affect another tenant.
  • Model output is validated before shell, browser, network, database, or policy actions.

Supply Chain And CI

  • Security-sensitive workflow permissions remain least-privilege.
  • Release jobs require expected checks.
  • Build scripts do not expose secrets.

Implementation Workflow

  1. Read existing tests and fixtures before writing new tests.
  2. Locate the smallest test layer that exercises the real control.
  3. Create realistic actors, tenants, resources, and malicious inputs.
  4. Assert the secure behavior clearly: denied status, exception, no state change, no log field, no queued job, no cross-tenant row.
  5. Add a positive control only when needed to prove the setup is valid.
  6. Run the targeted test command.
  7. Remove temporary validation scaffolding that is not part of the intended test change.
  8. If the test cannot be added, produce a precise test plan with file locations and fixture needs.

Output Format

When editing or proposing tests, output a CSV list of security test coverage:

id,severity,confidence,status,category,title,location,asset_or_flow,actor,issue,impact,evidence,fix,test,scope_notes

Use status values such as test_added, test_proposed, test_failed, blocked, residual_gap, or no_confirmed_findings. Use category values such as authorization, authentication, input-handling, data-exposure, webhook, llm-agent, supply-chain, or coverage.

For test rows, use:

  • location: test file path or proposed file path.
  • asset_or_flow: protected asset, action, endpoint, tool, workflow, or policy.
  • actor: unauthorized or malicious actor setup.
  • issue: security invariant being encoded.
  • impact: bug class or finding this prevents.
  • evidence: command result, file created, or fixture inspected.
  • fix: production control the test protects.
  • test: test name and expected secure failure mode.
  • scope_notes: residual gaps, setup requirements, or why a test could not be added.

Put verification commands, residual gaps, and a concise coverage summary after the CSV unless the user asks for CSV only.

Quality Bar

  • Each high or critical finding should have at least one regression test.
  • Tests should fail against the vulnerable behavior and pass against the fix.
  • Tests should be readable enough that future maintainers understand the security property.
  • Avoid overfitting to one parameter name when the real property is broader.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.