sf-security-constraints

Enforce CRUD/FLS, sharing, SOQL injection, and XSS protections on 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-constraints
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: sf-security-constraints
Source: https://github.com/jiten-singh-shahi/salesforce-claude-code/tree/main/.cursor/skills/sf-security-constraints
Command: npx skills add https://github.com/jiten-singh-shahi/salesforce-claude-code --skill sf-security-constraints

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Enforces security rules to prevent unauthorized data access, injection vulnerabilities, and client-side XSS in Salesforce code by ensuring correct CRUD/FLS checks, sharing context, safe SOQL usage, and proper encoding.

Core Features & Use Cases

  • Automated security guidance for reviews: Identifies missing CRUD/FLS enforcement, improper or undocumented sharing keywords, SOQL injection risks, and unsafe client-side rendering patterns.
  • Concrete remediation patterns: Recommends use of bind variables, WITH USER_MODE / AccessLevel.USER_MODE, Security.stripInaccessible(), and encoding strategies for Visualforce and LWC.
  • Governance and documentation: Requires documented justification for any without sharing usage and calls out hardcoded credentials or sensitive logging during development and deployments.

Quick Start

Run the security constraints check during development or code review on any Apex class, trigger, LWC component, or Visualforce page to surface missing CRUD/FLS, sharing, injection, and XSS issues.

Frequently Asked Questions about sf-security-constraints

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

FAQPage Schema
How do I enforce CRUD and FLS checks in Apex classes to prevent unauthorized data access?

To enforce CRUD and FLS in Apex, apply Security.stripInaccessible() and WITH USER_MODE or AccessLevel.USER_MODE during DML and SOQL operations to strip inaccessible fields and prevent unauthorized data access.

What is the best way to prevent SOQL injection vulnerabilities in Salesforce Apex?

Preventing SOQL injection in Apex requires using bind variables instead of string concatenation for user input. This ensures user-supplied data is treated as a value rather than executable code in the query string.

How do I prevent XSS in Lightning Web Components and Visualforce pages?

Preventing XSS in LWC and Visualforce requires proper encoding and sanitization patterns. LWC automatically escapes HTML, but Visualforce needs explicit encoding strategies to secure client-side rendering against malicious script execution.

Can I use this Salesforce security check on triggers and Lightning Web Components?

Yes, you can run this security check on Apex classes, triggers, Lightning Web Components, and Visualforce pages during development or code review to surface missing CRUD/FLS, sharing, injection, and XSS vulnerabilities.

Why does my Apex class need documented justification for using without sharing?

Using without sharing in Apex classes bypasses record-level security and risks unauthorized data access. Documented justification is required to enforce governance rules and explain why the specific logic needs to run in system mode.

What are the limitations of automated security guidance for Salesforce code reviews?

Automated security guidance identifies missing CRUD/FLS enforcement, sharing context, and injection risks, but developers must still manually implement the recommended bind variables, encoding strategies, and stripInaccessible patterns.