sf-security

Identifies and remediates Apex, SOQL security vulnerabilities in Salesforce code.

13|2|Updated Mar 18, 2026
One-click install
npx skills add https://github.com/jiten-singh-shahi/salesforce-claude-code --skill sf-security
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: sf-security
Source: https://github.com/jiten-singh-shahi/salesforce-claude-code/tree/main/.cursor/skills/sf-security
Command: npx skills add https://github.com/jiten-singh-shahi/salesforce-claude-code --skill sf-security

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill helps developers and security reviewers identify and remediate common Salesforce security issues in Apex, SOQL, and UI components so applications respect CRUD, FLS, sharing, and injection protections required for safe production and AppExchange submissions.

Core Features & Use Cases

  • CRUD and FLS enforcement: Guidance on using WITH USER_MODE, AccessLevel.USER_MODE, and Security.stripInaccessible to ensure record and field-level access is enforced.
  • Sharing context and keywords: Decision guidance for with sharing, without sharing, and inherited sharing based on caller context and scheduled processing.
  • SOQL injection prevention and safe dynamic queries: Patterns for bind variables, queryWithBinds, and whitelist-based dynamic sorting to avoid injection.
  • AppExchange and review preparation: Checklist of common review failures and actionable fixes for debug logs, hardcoded credentials, and insecure DML.

Quick Start

Run a security review on the provided Apex classes and report missing CRUD/FLS checks, inappropriate sharing keywords, and SOQL injection risks.

Frequently Asked Questions about sf-security

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I enforce CRUD and FLS in Salesforce Apex?

To enforce CRUD and FLS in Salesforce Apex, use WITH USER_MODE in SOQL queries or AccessLevel.USER_MODE in DML operations. Additionally, apply Security.stripInaccessible to remove inaccessible fields before processing records.

How do I prevent SOQL injection in dynamic Apex queries?

Prevent SOQL injection in dynamic Apex by using bind variables instead of string concatenation. For dynamic sorting, apply whitelist-based validation for sorting parameters to block unauthorized SOQL injection.

When should I use with sharing vs without sharing keywords in Apex classes?

Use with sharing or without sharing keywords based on caller context and scheduled processing requirements. Evaluate inherited sharing when a class context must dynamically respect the calling class's sharing rules.

What does a Salesforce AppExchange security review check for in Apex code?

A Salesforce AppExchange security review checks Apex code for CRUD and FLS enforcement, proper sharing mode correctness, and SOQL injection prevention. It also flags hardcoded credentials and insecure DML for remediation.

Can I use Security.stripInaccessible to check field-level security in LWC controllers?

Yes, you can use Security.stripInaccessible to check field-level security in LWC controllers. It verifies FLS by removing inaccessible fields from query results before returning data to the Lightning web component.

Why does my Apex class bypass sharing rules in scheduled jobs?

Your Apex class bypasses sharing rules in scheduled jobs because the execution context lacks a defining user sharing setting. You must explicitly declare with sharing or inherited sharing keywords to enforce record visibility.