agentleFS
jiten-singh-shahijiten-singh-shahi/salesforce-claude-code/skills/security-scan/SKILL.md

security-scan

Skill17 starsChanged 8 months agoMITView on GitHub

Use when scanning Salesforce org Claude Code configuration for security vulnerabilities, deploy misconfigurations, and injection risks in CLAUDE.md, hooks, and MCP servers. Do NOT use for Apex code review — use sf-security.

  • Installs packages

49 other projects use a version of this, 15 of them edited.

Adopted by

Most recently taken up by

Used with

Projects with it also use springboot-security, django-security and 8 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • FaisalAlqarniSkill

    springboot-security

    Spring Security best practices for authn/authz, validation, CSRF, secrets, headers, rate limiting, and dependency security in Java Spring Boot services.

    Also in 5 projects that use this

  • johnrtiptonSkill

    django-security

    This skill should be used when conducting security reviews, auditing Django applications, hardening security settings, implementing OWASP Top 10 protections, managing secrets, or ensuring multi-tenant security isolation. Provides automated security auditor that scans settings, code, dependencies, and multi-tenant configurations with auto-fix capabilities.

    Also in 5 projects that use this

  • JamkrisSkill

    security-bounty-hunter

    Hunt for exploitable, bounty-worthy security issues in repositories. Focuses on remotely reachable vulnerabilities that qualify for real reports instead of noisy local-only findings.

    Also in 3 projects that use this

  • joneqianSkill

    postgres-patterns

    PostgreSQL database patterns for query optimization, schema design, indexing, and security. Based on Supabase best practices.

    Also in 5 projects that use this

  • Microsoft AzureSkill

    iterative-retrieval

    Max-3-cycle protocol for agent sub-tasks with WHY context and coordinator validation. Use when spawning sub-agents to complete scoped work.

    Also in 5 projects that use this

  • LangChainSkill

    docker-patterns

    Best practices for Docker containerization and multi-stage builds

    Also in 5 projects that use this

The file

We split this skill into the rules it gives an agent

5 rules. 0 are common, 5 are distinctive, and 0 are very specific to this project.

  • 0

    Common

    Most of the 43 edited versions we read keep these.

  • 5

    Distinctive

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Before submitting an AppExchange managed package for security review

    line 21
  2. Distinctive:

    When running a pre-deployment security gate in CI/CD pipelines

    line 22
  3. Distinctive:

    When auditing a new codebase for SOQL injection, XSS, or FLS violations

    line 23
  4. Distinctive:

    When a PMD or Checkmarx scan surfaces violations that need triaging

    line 24
  5. Distinctive:

    When validating that new Apex contributors follow secure coding patterns

    line 25

“Common” is measured: kept by at least 6 in 10 of the 43 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

External tool: AgentShield is published as ecc-agentshield on npm by affaan-m. It is a third-party security scanner, not part of SCC itself. Maintenance risk: This package has no SLA or maintenance guarantee. If it becomes unavailable, use the manual scanning section below as a fallback.

Security Scan Skill

Audit your Claude Code configuration for security issues using AgentShield.

When to Use

  • Before submitting an AppExchange managed package for security review
  • When running a pre-deployment security gate in CI/CD pipelines
  • When auditing a new codebase for SOQL injection, XSS, or FLS violations
  • When a PMD or Checkmarx scan surfaces violations that need triaging
  • When validating that new Apex contributors follow secure coding patterns

What It Scans

FileChecks
CLAUDE.mdHardcoded secrets, auto-run instructions, prompt injection patterns
settings.jsonOverly permissive allow lists, missing deny lists, dangerous bypass flags
mcp.jsonRisky MCP servers, hardcoded env secrets, npx supply chain risks
hooks/Command injection via interpolation, data exfiltration, silent error suppression
agents/*.mdUnrestricted tool access, prompt injection surface, missing model specs

Salesforce-Specific Security Checks

Beyond configuration scanning, watch for these Salesforce vulnerability patterns:

SOQL Injection

// VULNERABLE — user input concatenated into query
String query = 'SELECT Id FROM Account WHERE Name = \'' + userInput + '\'';

// SAFE — bind variables
List<Account> results = [SELECT Id FROM Account WHERE Name = :userInput];

// SAFE — Database.queryWithBinds for dynamic SOQL
Map<String, Object> binds = new Map<String, Object>{ 'userInput' => userInput };
List<Account> results = Database.queryWithBinds(
    'SELECT Id FROM Account WHERE Name = :userInput',
    binds, AccessLevel.USER_MODE
);

FLS/CRUD Bypass

PatternRiskFix
SOQL without WITH USER_MODEReads fields user can't seeAdd WITH USER_MODE
Database.insert(records) without AccessLevelSkips FLS on writeUse AccessLevel.USER_MODE
WITH SECURITY_ENFORCEDThrows on inaccessible fields, no sharing enforcementPrefer WITH USER_MODE

Sharing Model Violations

  • without sharing on class with @AuraEnabled methods — privilege escalation
  • without sharing on class with @RemoteAction — same risk via Visualforce
  • Missing sharing declaration — inherits calling class context

XSS Patterns

  • Visualforce: {!userInput} without JSENCODE, HTMLENCODE, or URLENCODE
  • LWC: lwc:dom="manual" with innerHTML from user data
  • Aura: $A.util.isEmpty() doesn't sanitize — validate before DOM insertion

Usage

AgentShield Scan

# Install and scan
npm install -g ecc-agentshield
npx ecc-agentshield scan

# With severity filter and JSON output for CI
npx ecc-agentshield scan --min-severity medium --format json

# Auto-fix safe issues
npx ecc-agentshield scan --fix

Severity Levels

GradeScoreMeaning
A90-100Secure configuration
B75-89Minor issues
C60-74Needs attention
D40-59Significant risks
F0-39Critical vulnerabilities

Manual Scanning (Without AgentShield)

# SOQL Injection — string concatenation in queries
grep -rn "Database.query" force-app/ --include="*.cls" | grep -v "bind"

# Missing sharing declaration
grep -rEL "with sharing|without sharing|inherited sharing" force-app/main/default/classes/*.cls

# Hardcoded Salesforce IDs (15 or 18 char)
grep -rnE "'00[0-9a-zA-Z]{12,15}'" force-app/ --include="*.cls"

# Missing CRUD/FLS on DML
grep -rn "insert \|update \|delete \|upsert " force-app/ --include="*.cls" | grep -v "stripInaccessible\|USER_MODE\|SECURITY_ENFORCED\|isAccessible\|@IsTest"

# Hardcoded endpoints
grep -rn "https://\|http://" force-app/ --include="*.cls" | grep -v "Named\|test\|mock\|example.com"

SF Code Analyzer Integration

# Full PMD scan
sf code-analyzer run --target force-app --format table

# Security-focused scan
sf code-analyzer run --target force-app --category "Security" --format table

Remediation Patterns

FindingVulnerable CodeFixed Code
SOQL InjectionDatabase.query('...WHERE Name=\'' + name + '\'')[SELECT Id FROM Account WHERE Name = :name]
Missing Sharingpublic class MyService {public with sharing class MyService {
FLS Bypassinsert records;Database.insert(records, AccessLevel.USER_MODE);
Hardcoded ID'012000000000ABC'Schema.SObjectType.Account.getRecordTypeInfosByDeveloperName().get('Customer').getRecordTypeId()
XSS (VF){!userInput}{!HTMLENCODE(userInput)}

Related

  • Constraint: sf-security-constraints (co-activates for enforcement rules)
  • Action: sf-security (CRUD/FLS implementation procedures)

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.