cisco-ai-defense/defenseclaw/codeguard

Claude Code and agent skill by cisco-ai-defense/defenseclaw

Trust tier 2
  • community
LLM review pending
Source check pending

Checking that the SKILL.md file is still in the repository.

Security-aware code generation — teaches the agent CodeGuard rules to write secure code by default

Install

npx vskill@latest install cisco-ai-defense/defenseclaw/codeguard

SKILL.md

The same SKILL.md was published earlier as cisco-ai-defense/defenseclaw/codeguard.

CodeGuard: Secure Code Generation Rules

You MUST follow these security rules when writing code. Code that violates these rules will be blocked by the DefenseClaw CodeGuard scanner before it reaches disk. Write it correctly the first time.


Credentials — all languages

CG-CRED-001: Never hardcode API keys or secrets

Assigning API keys, secret keys, access tokens, or private keys directly in source code exposes them in version control and build artifacts.

~~~python

Load the value at runtime from an approved secret source.

import os api_key = os.environ["API_KEY"] ~~~

~javascript // Load the value at runtime from the process environment. const accessToken = process.env.ACCESS_TOKEN; ~

Do not place realistic credential-shaped examples in documentation or test data. Use descriptive placeholders containing spaces when an example value is needed, such as "provided by the secret store".

CG-CRED-002: Never include AWS access key IDs

AWS access key IDs have a distinctive four-letter prefix followed by a fixed length of uppercase letters and digits. Treat any value with that shape as a real credential, including examples in comments or documentation.

~python import boto3 session = boto3.Session() # uses the standard SDK credential chain ~

CG-CRED-003: Never embed private keys (CRITICAL)

PEM-encoded private keys use a five-hyphen marker, a BEGIN label, a key-type label, and a matching end marker. That structure is the highest-severity finding because it grants authentication as the key holder.

~~~python

Load key material from a protected file or secrets manager at runtime.

with open("/etc/ssl/private/server.key") as f: key = f.read() ~~~


Command Execution — Python, JavaScript, TypeScript, Ruby, PHP

CG-EXEC-001: Never pass untrusted strings to command or code interpreters

APIs that pass one string to an operating-system command interpreter, or that dynamically evaluate source text, enable injection when any part comes from user input or external data. Invoke a fixed executable with a separate argument list instead.

~python import subprocess subprocess.run(["grep", "--", user_input, "/var/log/app.log"], check=True) ~

~javascript const { execFile } = require("child_process"); execFile("ls", ["--", userDir], callback); ~

~python import json result = json.loads(user_document) ~

CG-EXEC-002: Never enable shell interpretation in subprocess APIs

Even with a subprocess library, enabling its shell mode re-introduces command injection risk. Keep shell mode disabled and pass an argument list.

~python subprocess.run(["convert", infile, outfile], check=True) ~


SQL — Python, JavaScript, TypeScript, Ruby, PHP, Java

CG-SQL-001: Never format strings into SQL queries

String interpolation in SQL enables SQL injection. Always use parameterized queries with bind variables.

~python cursor.execute("SELECT * FROM users WHERE name = ?", (username,)) cursor.execute("SELECT * FROM users WHERE name = %s", (username,)) ~

~javascript db.query("SELECT * FROM users WHERE id = ?", [userId]); ~

~java PreparedStatement ps = conn.prepareStatement("SELECT * FROM users WHERE id = ?"); ps.setInt(1, userId); ~


Deserialization — Python

CG-DESER-001: Never use executable object formats for untrusted data

Python-native object deserialization can execute arbitrary code. A generic YAML loader can construct unsafe objects too. Prefer JSON, or use the YAML library's explicit safe loader.

~~~python import json obj = json.loads(request.data)

import yaml config = yaml.safe_load(user_yaml) ~~~


Cryptography — Python, JavaScript, TypeScript, Java, Go, Ruby

CG-CRYPTO-001: Never use MD5 or SHA1

MD5 and SHA1 are cryptographically broken. Use SHA-256 or stronger.

~python import hashlib h = hashlib.sha256(data) ~

~javascript crypto.createHash("sha256").update(data); ~


Network — Python, JavaScript, TypeScript, Go

CG-NET-001: Validate outbound URLs

HTTP requests to URLs constructed from variables can enable SSRF (Server-Side Request Forgery). Validate the scheme and require an exact host from an application-owned allowlist before making a request.

~python ALLOWED_HOSTS = {"api.example.com", "cdn.example.com"} parsed = urllib.parse.urlsplit(user_url) if parsed.scheme != "https" or parsed.hostname not in ALLOWED_HOSTS: raise ValueError("URL not allowed") response = approved_client.get(user_url) ~


Path Safety — all languages

CG-PATH-001: Reject parent-directory traversal

Parent-directory segments can escape an intended directory and expose arbitrary files. Resolve both paths and require the candidate to remain under the trusted root.

~~~python from pathlib import Path

root = Path(upload_dir).resolve(strict=True) candidate = (root / filename).resolve(strict=False) try: candidate.relative_to(root) except ValueError as exc: raise ValueError("path escapes the upload directory") from exc ~~~


Quick Reference

RuleSeverityLanguagesInstead ofUse
CG-CRED-001HIGHallEmbedded credential valuesEnvironment or secrets manager
CG-CRED-002HIGHallCloud access IDs in sourceStandard SDK credential chain
CG-CRED-003CRITICALallEmbedded key materialProtected file or secrets manager
CG-EXEC-001HIGHpy,js,ts,rb,phpCommand or code stringsFixed executable plus argument list
CG-EXEC-002MEDIUMpySubprocess shell modeArgument-list subprocess call
CG-SQL-001HIGHpy,js,ts,rb,php,javaSQL string interpolationParameterized queries
CG-DESER-001HIGHpyExecutable object formatsJSON or an explicit safe loader
CG-CRYPTO-001MEDIUMpy,js,ts,java,go,rbBroken legacy digestsSHA-256 or stronger
CG-NET-001MEDIUMpy,js,ts,goUnvalidated variable URLScheme and exact-host validation
CG-PATH-001MEDIUMallUnchecked path joiningResolve and enforce trusted root

Security

  • Security scanPassed, 100 of 100Pattern checks on the skill's files.
  • Model reviewNot runA model review is scheduled for the next rescan.

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

Repository stars
864
Repository forks
159
7-day trend score
34

Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/cisco-ai-defense/defenseclaw/codeguard/badge)](https://verified-skill.com/skills/cisco-ai-defense/defenseclaw/codeguard)

Something wrong with this skill or its page? Tell us.