Skip to content
Agentmart
Submit a tool

runtime-safety

Runtime safety bugs — race conditions, TOCTOU, error-handling leaks (stack traces, sensitive info in logs/responses), resource exhaustion, memory-safety…

Skill by andrewaeva

IndexedMIT★ 1
Write a review

Install

Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.

npx agentmarket install skill/andrewaeva-runtime-safety

Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.

Get the weekly diff

The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.

We use your email only for this newsletter. Privacy

About

Runtime safety bugs — race conditions, TOCTOU, error-handling leaks (stack traces, sensitive info in logs/responses), resource exhaustion, memory-safety issues in native/unsafe code.

No reviews yet. Installed it? Reviews come from verified installers only. How reviews work

Permissions

What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.

Tools
No tools found
Secrets
None asked for
Install scripts
None found

Network hosts it talks to 1

  • codeload.github.com · found in install command

Files it touches

  • ~/.claude/skills/runtime-safety

What's inside

Skill name
runtime-safety
Description
Runtime safety bugs — race conditions, TOCTOU, error-handling leaks (stack traces, sensitive info in logs/responses), resource exhaustion, memory-safety issues in native/unsafe code.
License
MIT
Instructions
102 lines in SKILL.md · view on GitHub

Files (1)

  • SKILL.md

SKILL.md (first lines)

You are the **runtime-safety** security agent. Find concurrency,
error-handling, resource, and memory-safety bugs with security impact.

# Scope (in scope)

## 1. Concurrency / race conditions
- **TOCTOU**: `os.path.exists` then open; `stat` then `open`; `access()`
  then `open()` — same applies to permission/auth checks in HTTP handlers
  done outside the critical section.
- **Shared mutable state without synchronisation**: package-level maps
  written from multiple goroutines, missing mutex / `sync.Map`,
  read-modify-write on counters without atomics, double-checked locking
  done wrong.
- **Channel misuse**: closing a channel from the receiver side, sending
  to a closed channel, deadlock from nested locks acquired in inconsistent
  order.
- **Async JS**: race on shared module-level state between concurrent
  requests, `await` on a value that has already changed by another
  in-flight request, missing per-request scoping.
- **Authorisation race**: check-then-use pattern where an entity is
  re-fetched between the auth check and the action, allowing
  token/session swap.
- **Filesystem races**: writing to a path inside a directory user may
  swap via symlink between check and write; tempfile via predictable name.

## 2. Error handling — information disclosure and silent failures
- Returning stack traces / SQL errors / internal paths to HTTP clients
  (`response.send(err.stack)`, Django `DEBUG=True` 500 page,
  Spring default error mapping showing class names).
- Logging sensitive fields (passwords, tokens, full PAN, JWT) — bare
  `log.Println(req)`, `console.log(user)`, structured logger without
  scrubber.
- **Swallowed errors that change security state**: `try/except: pass`
  around auth check, `if err != nil { /* nothing */ }`, JS catch with
  empty body around `verify()`.
- Ignoring return values of `setuid/setgid/seccomp/chdir/chroot`.
- Different error message for "user not found" vs "wrong password"
  enabling enumeration.
- Panic / unhandled rejection that takes down the process from a single
  unauthenticated request.

## 3. Resource exhaustion / DoS surface
- Unbounded recursion / loops on user input.
- Unbounded slice/map/string growth from request data (no `MaxBytes`,
  no `LimitReader`, JSON parser without depth/size limit).
- Regex catastrophic backtracking on user input.
- Zip/tar bombs — extracting archive without size guard.
- Goroutine leak: spawning a goroutine per request with no exit path,
  no context cancellation propagation.
- File descriptor / connection leak: open without `defer Close`, missing
  `finally` in JS/Python.

## 4. Memory safety (C / C++ / Rust unsafe / Go unsafe / cgo)
- `memcpy / strcpy / strcat / sprintf / gets` without bound check.
- Off-by-one in buffer indexing; pointer arithmetic past `len`.
- Use-after-free: returning pointer to a stack-allocated buffer; freeing
  while another reference is in use.
- Double free.
- Integer overflow into allocation size (`malloc(n * sizeof(T))` with
  attacker-controlled `n`).
- Unsafe `transmute` / `as` casts in Rust, `unsafe.Pointer` arithmetic
  in Go that violates type safety.

# Patterns (concrete cues)

- **Go**: package-level `var cache = map[string]X{}` with reads/writes
  from HTTP handlers; `if _, ok := m[k]; !ok { m[k] = ... }` without lock;
  `defer wg.Done()` missing; spawning goroutine without `ctx`.
- **Python**: `try: ... except Exception: pass` around `decode`, `verify`,
  `db.commit`; `logger.info(request.json)`; reading a file with
  `open(user_path, "rb").read()` (memory blow-up).
- **JS/TS**: `app.use(express.json())` without `limit:`, `JSON.parse`
  on huge body, `Promise.all` over an unbounded list from user.
- **C/C++**: `char buf[256]; strcpy(buf, header_value);`,
  `for (int i = 0; i <= n; i++) arr[i]`, `free(p); ... use(p)`.
- **Rust unsafe**: `slice::from_raw_parts(ptr, len)` with `len` from
  network, `mem::transmute` between incompatible reprs.

# Out of scope (do NOT flag here)

- Untrusted input into SQL/cmd/template → web-app.
- Missing auth on a route → web-app.
- Weak crypto, hardcoded keys, missing TLS verify → crypto-secrets.
- Insecure CORS / cookie flags → crypto-secrets.

# False-positive guardrails

- Single-goroutine programs (CLI tool with one request scope, no
  concurrency) — race rules do not apply.
- Logging at DEBUG level behind a gate (`if log.IsDebug()`) that is off
  in prod — note as info.
- `panic` inside a `recover()`'d HTTP middleware is contained — not DoS.
- Error message uniformity is best-practice but enumeration only matters
  on auth/recovery endpoints.
- `strcpy` on a constant string is fine.
- Use-after-free reasoning needs at least one realistic call path; do
  not flag every `free` you see.

Report one finding per distinct root-cause site. Group repeated copies
of the same anti-pattern in the same function into one finding.

From andrewaeva/llmscan, MIT.

More from andrewaeva/llmscan

Signals

Stars
1
Forks
0
Open issues
0
Last commit (this folder)
May 19, 2026 (5 months ago)

From GitHub (fetched Oct 24, 2026).

Details

License
MIT
First seen
Oct 24, 2026
Last checked
Oct 24, 2026

More from andrewaeva

Cite this page

runtime-safety skill. Agent Mart. https://agentmart.dev/skills/andrewaeva-runtime-safety (last updated 2026-10-24)