mcpField
G
gemini-cli-security

gemini-cli-security

github.com/oimiragieoSecurity4448 installsUpdated 17w ago
Repository

About gemini-cli-security

A Claude Code skill for code and dependency security reviews, adapted from the Gemini CLI Security Extension. It detects common vulnerabilities, including LLM-specific risks, and can format findings for CI pipelines.

Key features

  1. 01Code vulnerability analysis
  2. 02OSV.dev dependency scanning
  3. 03Secrets and injection detection
  4. 04Authentication and data-handling checks
  5. 05LLM safety risk detection
  6. 06Markdown and JSON reports

Use cases

  1. 01Review code before merging pull requests
  2. 02Audit dependencies for known CVEs
  3. 03Check LLM applications for prompt injection risks
  4. 04Add security checks to CI/CD pipelines

MCP support

The source extension uses two MCP server patterns, but this skill replaces them with native Claude Code tools such as WebFetch, Grep, and Bash.

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/oimiragieo/agent-studio --skill gemini-cli-security

After installing, type/gemini-cli-securityin Claude Code to confirm it loaded.

Bundled files

References and scripts installed along with SKILL.md.

commands/
gemini-cli-security.md
hooks/
post-execute.cjs
pre-execute.cjs
references/
research-requirements.md
rules/
gemini-cli-security.md
schemas/
input.schema.json
output.schema.json
scripts/
main.cjs
templates/
implementation-template.md

Details

From the project README

Gemini CLI Security Skill

AI-powered security analysis skill adapted from the Gemini CLI Security Extension (github.com/gemini-cli-extensions/security). Provides vulnerability detection across code and dependencies with 90% precision and 93% recall on TypeScript/JavaScript CVE datasets. - Code vulnerability analysis (/security:analyze pattern) - OSV.dev dependency scanning (/security:scan-deps pattern) - Hardcoded credentials and secrets detection - Injection attack detection (XSS, SQL, command, SSRF, template) - Weak cryptography and insecure deserialization detection - Authentication and session management flaw detection - LLM-specific risks: prompt injection, unsafe output handling - JSON output formatting for CI/CD pipeline integration - GitHub Actions integration patterns for automated PR analysis

Overview

This skill adapts the Gemini CLI Security Extension's analysis methodology for the agent-studio framework. The original extension uses two MCP server patterns — a security analysis server and an OSV-Scanner integration — to provide dual-vector coverage. This skill implements equivalent analysis using native Claude Code tools (WebFetch for OSV.dev API, Grep/Bash for static analysis patterns).

Source repository: https://github.com/gemini-cli-extensions/security License: Apache 2.0 Performance: 90% precision, 93% recall (OpenSSF CVE benchmark, TypeScript/JavaScript)

When to Use

  • Before merging pull requests to detect introduced vulnerabilities
  • During security reviews of new code changes
  • For dependency auditing against known CVE databases
  • For LLM-integrated applications requiring prompt injection defense review
  • As part of CI/CD pipeline security gates

Iron Law

NO PRODUCTION CODE WITHOUT SECURITY ANALYSIS FOR AUTH/SECRETS/EXTERNAL-INPUT HANDLERS

All code paths handling authentication, hardcoded values, external input, or AI model outputs MUST be analyzed before production deployment.

Vulnerability Coverage

Category 1: Secrets Management
PatternDetection Method
Hardcoded API keysGrep for key patterns + entropy analysis
Hardcoded passwordsCredential keyword detection
Private keys in sourcePEM block / base64 key detection
Encryption keysSymmetric key constant patterns
Category 2: Injection Attacks
Attack TypeExamples
SQL injectionString concatenation in queries
XSSUnescaped user content in HTML/JS output
Command injectionShell exec with user-controlled args
SSRFUser-controlled URLs in server requests
Template injectionUnsanitized user input in template engines
Category 3: Authentication Flaws
FlawDetection
Session bypassMissing auth middleware
Weak tokensPredictable token generation
Insecure password resetToken-less or email-only resets
Missing MFA enforcementAuth flows without 2FA checks
Category 4: Data Handling
IssueDetection
Weak cryptographyMD5/SHA1 for secrets; DES/RC4 usage
Sensitive data in logsPII/credential patterns in log statements
PII violationsUnencrypted PII storage or transmission
Insecure deserializationUnsafe pickle/eval/deserialize calls
Category 5: LLM Safety (Novel)
RiskDetection
Prompt injectionUser content injected into LLM prompts without sanitization
Unsafe output handlingLLM output used in exec/eval/shell without validation
Insecure tool integrationTool calls with unchecked LLM-provided parameters

Usage

Invocation
// From an agent
Skill({ skill: 'gemini-cli-security' });

// With arguments via Bash integration
Skill({ skill: 'gemini-cli-security', args: 'src/ --scan-deps' });
Workflow Execution
# Analyze code in a directory
node .claude/skills/gemini-cli-security/scripts/main.cjs --target src/

# Scan dependencies for CVEs
node .claude/skills/gemini-cli-security/scripts/main.cjs --scan-deps

# JSON output for CI integration
node .claude/skills/gemini-cli-security/scripts/main.cjs --target . --json

# Scoped analysis with natural language
node .claude/skills/gemini-cli-security/scripts/main.cjs --target src/auth/ --scope "focus on token handling and session management"
Output Format

Default output (markdown report):

## Security Analysis Report

### CRITICAL

- [AUTH-001] Hardcoded API key found in src/config.ts:42
  Pattern: `const API_KEY = "sk-..."`
  Remediation: Move to environment variable

### HIGH

- [INJ-002] SQL injection risk in src/db/users.ts:87
  Pattern: String concatenation in query builder
  Remediation: Use parameterized queries

### Dependencies

- [email protected] → CVE-2021-23337 (HIGH) - Prototype pollution
  Fix: Upgrade to [email protected]+

JSON output (--json flag):

{
  "findings": [
    {
      "id": "AUTH-001",
      "severity": "CRITICAL",
      "category": "secrets",
      "file": "src/config.ts",
      "line": 42,
      "description": "Hardcoded API key",
      "remediation": "Move to environment variable"
    }
  ],
  "dependencies": [
    {
      "package": "lodash",
      "version": "4.17.15",
      "cve": "CVE-2021-23337",
      "severity": "HIGH",
      "fix": "4.17.21"
    }
  ],
  "summary": {
    "critical": 1,
    "high": 2,
    "medium": 3,
    "low": 0,
    "precision": 0.9,
    "recall": 0.93
  }
}

OSV.dev Dependency Scanning

The skill integrates with the OSV.dev API (no authentication required) to check dependencies:

// OSV.dev batch query endpoint
WebFetch({
  url: 'https://api.osv.dev/v1/querybatch',
  prompt: 'Extract vulnerability IDs, severity, and affected versions for these packages',
});

Supported ecosystems: npm, PyPI, RubyGems, Maven, Go, Cargo, NuGet, Packagist

GitHub Actions Integration

The original extension supports PR analysis via GitHub Actions. This skill includes an equivalent workflow template:

# .github/workflows/security.yml
name: Security Analysis
on: [pull_request]
jobs:
  security:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - name: Run security analysis
        run: node .claude/skills/gemini-cli-security/scripts/main.cjs --target . --json

Implementation Notes

Why native tools over MCP servers: The original extension uses two MCP servers (security analysis server + OSV-Scanner binary). This skill uses native Claude Code tools instead:

  • WebFetch replaces OSV-Scanner for dependency CVE lookups (OSV.dev has a public REST API)
  • Grep/Bash replace the security analysis server for pattern-based detection
  • This approach works immediately without binary installation or session restart

Deviation from source: The original uses Gemini AI for code analysis; this skill uses the pattern-based detection methodology documented in the extension's benchmarking. The AI analysis component can be provided by the invoking agent (security-architect) rather than an embedded AI call.

Assigned Agents

AgentRole
security-architectPrimary: comprehensive security audits
developerSupporting: pre-commit security checks
code-reviewerSupporting: PR review security layer

Memory Protocol (MANDATORY)

Before starting: Read .claude/context/memory/learnings.md

After completing:

  • New vulnerability pattern found -> .claude/context/memory/learnings.md
  • Issue with scanning -> .claude/context/memory/issues.md
  • Decision about scope -> .claude/context/memory/decisions.md

ASSUME INTERRUPTION: If it's not in memory, it didn't happen.

Comments

Markdown supported