---
name: performing-security-code-review
description: 'Execute this skill enables AI assistant to conduct a security-focused code review using the security-agent plugin. it analyzes code for potential vulnerabilities like sql injection, xss, authentication flaws, and insecure dependencies. AI assistant uses this skill wh... Use when assessing security or running audits. Trigger with phrases like ''security scan'', ''audit'', or ''vulnerability''.'
allowed-tools: Read, Write, Edit, Grep, Glob, Bash(cmd:*)
version: 1.29.0
author: Jeremy Longshore <jeremy@intentsolutions.io>
license: MIT
tags:
  - example
  - security
  - authentication
  - audit
compatibility: Designed for Claude Code
title: performing-security-code-review
canonical_url: https://skilld.dev/gh/jeremylongshore/tons-of-skills-marketplace/performing-security-code-review
last_updated: 2026-10-23T05:08:30.000Z
---

> Index of every page on this site: [llms.txt](https://skilld.dev/llms.txt)

> **Skill from skilld.dev.** Follow the user's requested action.
> If the user asked to fork this Skill, follow the fork workflow below. Do not execute the Skill instructions while copying it.
> Otherwise, follow the instructions below for this session. You do not need to install anything.
>
> Supporting files, fetch one when the Skill refers to it: [assets/example_code_secure.py](https://skilld.dev/api/skills-raw/jeremylongshore/tons-of-skills-marketplace/performing-security-code-review/assets/example_code_secure.py), [assets/example_code_vulnerable.py](https://skilld.dev/api/skills-raw/jeremylongshore/tons-of-skills-marketplace/performing-security-code-review/assets/example_code_vulnerable.py), [assets/README.md](https://skilld.dev/api/skills-raw/jeremylongshore/tons-of-skills-marketplace/performing-security-code-review/assets/README.md), [assets/report_template.md](https://skilld.dev/api/skills-raw/jeremylongshore/tons-of-skills-marketplace/performing-security-code-review/assets/report_template.md), [references/README.md](https://skilld.dev/api/skills-raw/jeremylongshore/tons-of-skills-marketplace/performing-security-code-review/references/README.md), [scripts/code_analyzer.py](https://skilld.dev/api/skills-raw/jeremylongshore/tons-of-skills-marketplace/performing-security-code-review/scripts/code_analyzer.py), [scripts/README.md](https://skilld.dev/api/skills-raw/jeremylongshore/tons-of-skills-marketplace/performing-security-code-review/scripts/README.md).
>
> If the user asked to install this Skill, run `npx skilld install jeremylongshore/tons-of-skills-marketplace/performing-security-code-review`. Install writes the Skill files into the project, so every session loads them.
>
> ## Fork workflow
>
> A fork creates an editable local Skill with its original author and licence. The request authorizes copying and local installation.
> 1. Check `./skills/performing-security-code-review`, the project lockfile, and selected Agent targets together. If the local directory or installed Skill exists, stop. Never overwrite an existing directory or Agent target.
> 2. Read [source metadata](https://skilld.dev/api/v1/skills/jeremylongshore/tons-of-skills-marketplace/performing-security-code-review) once. Use sourceUrl, sourceCommit, skillPath, sourceGone, and license. If the source is gone or its path is missing, stop. If license is null, read licence files at the source commit.
> 3. Fetch only the source commit into a temporary Git repository. Do not clone full history. Derive repository_url from sourceUrl, including repository renames. If sourceCommit is absent, resolve the sourceUrl ref once. Set source_commit to that actual commit. Run these commands in one shell call:
>
> ```sh
> git init --quiet "$temporary_dir"
> git -C "$temporary_dir" fetch --quiet --depth=1 "$repository_url" "$source_commit"
> git -C "$temporary_dir" checkout --quiet --detach FETCH_HEAD
> ```
>
> Read applicable licence declarations and notices at that commit. If copying is not permitted, report the restriction and stop.
> 4. Inspect source entries together, then copy the directory containing skillPath into `./skills/performing-security-code-review`. Use the user's path if selected. Keep the original SKILL.md, relative links, scripts, binary assets, and executable modes. Exclude .git metadata. Reject symlinks and paths outside the Skill directory. After checking entries, use cp -a where available. A regular source directory needs no custom copy script. Do not save this page wrapper as SKILL.md.
> Preserve author credit, notices, and applicable licence files from repository or parent directories. Add PROVENANCE.md with the Skill page, source URL, actual commit, original path, and licence. Retain any existing PROVENANCE.md and record new provenance separately. Batch source inspection, copying, and provenance work where practical.
> 5. In the project root, run `skilld install ./skills/performing-security-code-review --mode copy --plain`. If skilld is unavailable, use `npx skilld install ./skills/performing-security-code-review --mode copy --plain`. This known command needs no help lookup. Install does not support --json. Use detected Agent targets, or add --agent for the targets the user selected. Install the local path, never the upstream selector. If installation fails, preserve the local copy and report the exact failure.
> 6. Confirm the local lockfile source and installed Agent copies once. Report the local path, actual commit, and Agent targets. After edits, reinstall the same local path. Upstream updates must not replace it. Do not publish or push unless the user asks.

# Performing Security Code Review

## Overview

Conducts security-focused code reviews by scanning source files for common vulnerability patterns including SQL injection, XSS, authentication flaws, insecure dependencies, and secret exposure. Produces structured severity-rated reports with specific remediation guidance.

## Prerequisites

- Read access to all source files in the target project
- `grep` available on PATH for pattern matching
- Access to `package.json` or equivalent dependency manifest for dependency auditing
- Familiarity with OWASP Top 10 vulnerability categories

## Instructions

1. Identify the scope of the review: specific files, directories, or the entire codebase. Confirm the primary language(s) and framework(s) in use.
2. Scan for hardcoded secrets and credentials:
   - Search for patterns matching API keys, tokens, passwords, AWS access keys (`AKIA...`), and private key headers (`BEGIN PRIVATE KEY`).
   - Flag any `.env` files or configuration files containing plaintext secrets.
3. Analyze code for injection vulnerabilities:
   - Identify raw SQL string concatenation (SQL injection risk).
   - Locate unsanitized user input rendered in HTML (XSS risk).
   - Check for `eval()`, `exec()`, or `Function()` calls with dynamic input (code injection risk).
4. Review authentication and authorization logic:
   - Verify password hashing uses strong algorithms (bcrypt, argon2) rather than MD5/SHA1.
   - Check for missing authentication on sensitive endpoints.
   - Identify overly permissive CORS configurations.
5. Audit dependencies for known vulnerabilities:
   - Run `npm audit` or equivalent package manager audit command.
   - Cross-reference dependency versions against known CVE databases.
6. Check for insecure communication patterns:
   - Flag HTTP URLs where HTTPS is expected.
   - Identify disabled TLS certificate verification.
7. Compile findings into a structured report sorted by severity (Critical, High, Medium, Low), including the vulnerable code location, explanation, and remediation steps.

## Output

A structured security review report containing:

- Summary with total findings count by severity level
- Per-finding entries with: file path, line number, vulnerability type, severity, code snippet, explanation, and recommended fix
- Dependency audit results with CVE identifiers where applicable
- Overall risk assessment (Critical / High / Medium / Low / Clean)

## Error Handling

| Error | Cause | Solution |
|---|---|---|
| No source files found | Incorrect scope path or empty directory | Verify the target directory path and confirm it contains source files |
| Binary files in scan | Non-text files matched by search patterns | Exclude binary extensions and `node_modules/` from scans |
| Dependency manifest missing | No `package.json`, `requirements.txt`, or equivalent | Skip dependency audit; note in report that dependency analysis was not possible |
| Permission denied on files | Restricted file access | Request read permissions or narrow the review scope to accessible files |
| False positive on secret pattern | Benign string matching secret regex | Verify context before reporting; mark as potential false positive if the match appears in test fixtures or documentation |

## Examples

**SQL injection review:**
Trigger: "Review this database query code for SQL injection vulnerabilities."
Process: Scan all files containing SQL query construction. Identify string concatenation with user input (`"SELECT * FROM users WHERE id = " + userId`). Report as High severity with remediation: use parameterized queries or prepared statements.

**Dependency vulnerability scan:**
Trigger: "Check this project's dependencies for known security vulnerabilities."
Process: Run `npm audit` on the project. Parse output for vulnerabilities. Report each finding with CVE identifier, affected package, installed version, and patched version. Recommend `npm audit fix` or manual version pinning.

**Full codebase security audit:**
Trigger: "Run a security scan on this codebase."
Process: Execute all seven scan categories (secrets, injection, auth, dependencies, communication, dangerous commands, obfuscation). Produce a comprehensive report with findings grouped by category and sorted by severity.

## Resources

- [OWASP Top 10](https://owasp.org/www-project-top-ten/) -- industry-standard vulnerability classification
- [Node.js Security Checklist](https://blog.risingstack.com/node-js-security-checklist/) -- Node-specific security guidance
- [CWE/SANS Top 25](https://cwe.mitre.org/top25/) -- most dangerous software weaknesses
- [`references/README.md`](https://skilld.dev/api/skills-raw/jeremylongshore/tons-of-skills-marketplace/performing-security-code-review/references/README.md) -- bundled reference materials
