# Code Safety

> Scan LLM-generated code for security vulnerabilities using language-aware pattern rules Use when this capability is needed.

- Skill: `tomevault-io/code-safety` (Agent Skill, multi-file: 2 files)
- Install (CLI): `npx skillmds@latest add tomevault-io/code-safety`
- Raw SKILL.md: https://api.skillmd.com/api/skills/tomevault-io/code-safety/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: AI & ML
- Author: tomevault-io (https://skillmd.com/u/tomevault-io)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/tomevault-io/code-safety

---


# Code Safety Scanner

A guardrail automatically scans code in your responses for security
vulnerabilities. You also have a tool for on-demand code scanning.

## When to Use scan_code

- Before writing code to files via write_file or create_file
- Before executing code via shell_execute
- When reviewing user-submitted code for security issues
- Before presenting code examples that handle user input

## What It Detects

- **Injection**: eval(), exec(), os.system(), command injection
- **SQL Injection**: string concatenation in SQL queries
- **XSS**: innerHTML, document.write, dangerouslySetInnerHTML
- **Path Traversal**: unsanitized ../ in file paths
- **Hardcoded Secrets**: API keys, passwords, tokens in code
- **Weak Crypto**: MD5/SHA1 for passwords, Math.random for security
- **Insecure Deserialization**: pickle.loads, yaml.load without SafeLoader
- **SSRF**: unvalidated URL construction from user input

## Post-Approval Guardrail Override

When HITL (human-in-the-loop) is enabled with `guardrailOverride: true` (the default), the code-safety scanner runs **after** HITL approval as a post-approval guardrail. This means even actions approved by a human operator or LLM judge are scanned for destructive patterns before execution. This catches accidental approvals of dangerous commands like `rm -rf /` or `DROP TABLE`. See the **hitl-safety** skill for full HITL configuration.

## Constraints

- Regex-based detection — may have false positives on safe code patterns
- Language detection from code fence tags or heuristics
- Does not perform deep AST analysis

---
> Source: [framersai/agentos-skills](https://github.com/framersai/agentos-skills) — distributed by [TomeVault](https://tomevault.io).
<!-- tomevault:4.0:skill_md:2026-06-16 -->

