agentleFS
DataArtDataArt/artisyn-log-hub/.claude/skills/security-check/SKILL.md

security-check

Skill12 starsChanged 7 days agoMITView on GitHub

Whole-repo security invariants audit: checks every invariant in this skill's numbered list (first: no GET endpoint mutates data under a cookie session) and reports OK or violations with file:line. Read-only, never fixes anything. Run when explicitly asked (/security-check).

34 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use fix-bug, write-tests and 2 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • JetBrainsSkill

    fix-bug

    End-to-end bug fix workflow for the Exposed project. Accepts a GitHub issue (#NUMBER), YouTrack issue (EXPOSED-NUMBER), or YouTrack URL (https://youtrack.jetbrains.com/issue/EXPOSED-NUMBER). Fetches the issue, creates a failing reproducer test, commits on a new branch, implements the fix, validates, and opens a PR. Use this skill whenever the user wants to fix a bug from an issue tracker, mentions a EXPOSED issue number, or references a GitHub issue to fix.

    Also in 3 projects that use this

  • SentrySkill

    write-tests

    Write tests following project conventions. Use when adding new tests or modifying existing ones.

    Also in 3 projects that use this

  • genomewalkerSkill

    learn

    Learn from web sources, generate SKILL.md, and store key patterns in soul memory. Trigger keywords: learn, skill-gen, web-learn, documentation, tutorial.

    Also in 3 projects that use this

  • GoogleSkill

    code-review

    Adversarial systems, concurrency, memory-model, and architecture code review protocol. Use this skill whenever asked to review code, PRs, diffs, or branches in Filament.

    Also in 6 projects that use this

The file

We split this skill into the rules it gives an agent

6 rules. 0 are common, 4 are distinctive, and 2 are very specific to this project.

  • 0

    Common

    Most of the 26 edited versions we read keep these.

  • 4

    Distinctive

    This author's own choices. Worth a look.

  • 2

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Read-only: Never edit, fix, refactor or delete anything — not even an "obvious" one-line fix.

    line 15
  2. Distinctive:

    Check each invariant independently.

    line 17
  3. Very specific:

    Every violation must cite file:line (repo-relative path, line of the offending decorator / statement) and one sentence on *why* it violates …

    line 18
  4. Distinctive:

    When unsure whether a code path writes (e.g.

    line 23
  5. Distinctive:

    Read the handler body and every service method it calls (one level deep, deeper when a callee name does not make it obvious).

    line 51
  6. Very specific:

    If the caller asked for it, the dated summary is appended to the task's requirements.md Notes.

    line 84

“Common” is measured: kept by at least 6 in 10 of the 26 edited versions of this file we could read. “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

You are auditing the whole repository against a fixed list of security invariants. Unlike post-impl-check-security-no-auto (which looks only at one task's changed files), this check always scans the full codebase, so it also catches regressions introduced outside any task.

Invariants to check: $ARGUMENTS (empty = all invariants below, in order).

Rules

  • Read-only. Never edit, fix, refactor or delete anything — not even an "obvious" one-line fix. Report only. Fixing a violation is a separate task the user decides on.
  • Check each invariant independently; one invariant's failure does not stop the others.
  • Every violation must cite file:line (repo-relative path, line of the offending decorator / statement) and one sentence on why it violates the invariant.
  • A listed allowed exception is reported as an exception, not a violation — but verify it still matches its description (same route, same reason). An exception whose code changed so that the stated reason no longer holds IS a violation.
  • When unsure whether a code path writes (e.g. it calls a service you have not opened), open the service method and follow it one level further before deciding. Do not guess from method names.

Invariants

The list is extensible: add a new numbered section below, using the same four parts (Rule, Why, How to find candidates, Allowed exceptions). Never renumber existing invariants — reports and task notes refer to them by number.

1. No GET endpoint mutates data under a cookie session

Rule. A GET handler reachable with the browser session cookie (connect.sid, i.e. guarded by SessionAuthGuard / AdminGuard / AutoIdentifyGuard, or unguarded) must not change server state: no DB insert/update/delete/upsert, no req.logIn/session writes, no deletion or rewriting of files or job rows the user cares about.

Why. CSRF protection is SameSite=Lax only (see user-docs/security-hardening.md). Lax still sends the session cookie on cross-site top-level GET navigations, so a mutating GET can be triggered by any external page the logged-in user visits. A mutating GET found here is converted to POST; if an old hook or installer version calls it, the old GET is kept and listed as an exception.

How to find candidates.

  1. Grep @Get( in server/src (skip *.spec.ts). Today that is ~79 handlers across ~21 controllers.
  2. For each handler, note the guards on the handler and its @Controller class. Handlers guarded only by ApiKeyAuthGuard (X-Api-Key header) are not reachable with the cookie — record them as "not cookie-authenticated" and move on.
  3. Read the handler body and every service method it calls (one level deep, deeper when a callee name does not make it obvious). Flag: .insert(, .update(, .delete(, onConflictDo*, raw INSERT/UPDATE/DELETE SQL, req.logIn, req.session[...] =, fs.writeFile*, fs.unlink/fs.rm of anything that is not a temp file the same request created.
  4. .set(/.delete( on an in-memory Map/Set, createHmac(...).update( and similar are not state changes — ignore them.

Allowed exceptions (agreed when preparing the open-source release):

EndpointWhereWhy it is allowed
GET /static/artisyn-hooks-installer.tgz?v=server/src/installer/installer.controller.ts (downloadInstaller)Public, no cookie needed; writes only the max-wins latest-hook-version.json cache; called by old hooks/installers, so it cannot become a POST.
GET /api/v1/auth/azureserver/src/auth/auth.controller.ts (azure)Starts Azure OAuth: stores a fresh state/nonce in the caller's own session and redirects.
GET /api/auth/callbackserver/src/auth/azure/azure-callback.controller.ts (callback)OAuth redirect target (must be a GET); logs in / auto-provisions only after the state and nonce from the session match.
GET /api/v1/auth/me (Mode 1)server/src/auth/auth.controller.ts (me, AutoIdentifyGuard)Mode 1 auto-identify req.logIn — localhost-only, and Mode 1 has no auth model to protect.
GET /api/v1/admin/logs-archiveserver/src/admin/admin-panel.controller.ts (downloadLogsArchive)Creates and then deletes its own temp archive; no persistent state changes.

Token-authorised flows (email confirmation, password reset) are SPA routes that POST a one-time token — they are not GET mutations.

Report format

One block per invariant checked:

### Invariant <N> — <title>: OK | <k> violation(s)
- VIOLATION <file>:<line> — <METHOD path> — <what it writes, one sentence>
- EXCEPTION <file>:<line> — <METHOD path> — <which allowed exception, still valid: yes/no>
- NOTE <file>:<line> — <anything checked and deliberately out of scope, e.g. API-key-only GET that writes>
Scanned: <number of candidates inspected>

End with a one-line summary: security-check <YYYY-MM-DD>: <passed>/<checked> invariants OK, <n> violation(s). If the caller asked for it, the dated summary is appended to the task's requirements.md Notes.

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.