grzmol/vibe-force/sf-org-security-audit

Claude Code and agent skill by grzmol/vibe-force

Trust tier 3
  • community
Source check pending

Checking that the SKILL.md file is still in the repository.

Standing security audit of a Salesforce org and its source - who holds ModifyAllData, ViewAllData, AuthorApex and ViewEncryptedData, the object and field matrix behind every permission set, profile sprawl, Apex class and @AuraEnabled exposure, org-wide defaults and without-sharing code, guest user and Experience Cloud surface, Named and External Credentials, secrets in source and in git history, and the Setup-only checks (Health Check, session and password policy, login IP ranges, MFA, Setup Audit Trail) that no CLI command covers. Produces a severity-ranked findings report with evidence and a fix per item. Use when onboarding an org, preparing a security review or audit response, or periodically. Not for reviewing a diff - that is the sf-security-reviewer agent - and not for writing secure Apex, which is skill sf-security-model.

Install

npx vskill@latest install grzmol/vibe-force/sf-org-security-audit

SKILL.md

The same SKILL.md was published earlier as grzmol/vibe-force/sf-org-security-audit.

Salesforce Org Security Audit

When to use

SituationUse this skill
Auditing the standing security posture of an orgYes
Preparing for a customer or internal security reviewYes
Onboarding an org you did not configureYes
Reviewing the security of the diff you just wroteAgent sf-security-reviewer
Writing Apex that enforces CRUD, FLS and sharingSkill sf-security-model
Maintainability rather than exposureSkill sf-technical-debt-audit
Callout authentication designSkill sf-integration-patterns
Analyzer security rules on sourceSkill sf-code-analyzer-quality

This audit is read-only: queries, retrieves and greps. It never changes a permission, a setting or a record, and it is legitimate against production.

Scope and safety

RuleWhy
Read-only commands only: sf data query, sf project retrieve preview, sf org list ..., vf-check staticAn audit that mutates is an incident
Never VF_ALLOW_PROD=1That flag exists to let a mutating check through; nothing here needs it
Retrieve into a scratch directory, never over the working treeA retrieved profile overwriting source is a silent change
Evidence or it did not happenEvery finding carries a query result, a file:line, or a named Setup page
Handle findings like the vulnerability they describeThe report names exposures; treat it as confidential and never paste org ids, usernames or tokens into a public channel

Production posture: vf-check prints a production banner for read-only checks rather than refusing them (scripts/checks/lib/org.mjs). Queries against a production alias are fine here. Running vf-check apex against production is not part of this audit.

Audit layers

LayerThe questionHow to measure
IdentityWho can log in, from where, with what factorSetup: session, password, login IP, MFA; sf org list users
GrantsWho holds administrative permissionsPermissionSetAssignment SOQL, pattern 3
Access matrixWhat each permission set opens upObjectPermissions and FieldPermissions SOQL, pattern 4
Record accessOrg-wide defaults, sharing rules, without sharing codeSource <sharingModel> plus grep, pattern 7
Code exposure@AuraEnabled, @RestResource, webService, Apex class accessSource inventory plus SetupEntityAccess, pattern 6
Public surfaceGuest users, Sites, Experience Cloudnetworks/ metadata plus guest profile, pattern 8
IntegrationNamed and External Credentials, Remote Site Settings, connected appsSource inventory, pattern 9
SecretsLiteral credentials in source or historyGrep plus git history, pattern 9
Change controlWho changed security settings, and whenSetup Audit Trail, pattern 10

Core patterns

1. Fix the scope and the evidence trail
bash
sf org display --target-org vf-prod
sf org list users --target-org vf-prod
mkdir -p .vibeforce/reports/audit && export AUDIT=.vibeforce/reports/audit

Record the org id, the edition, the alias, whether the source tree is the whole org, and the date. Every command below writes into $AUDIT, so the report can cite raw output rather than memory.

2. Retrieve the security-relevant metadata
xml
<!-- manifest/security-audit.xml -->
<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
<types><members>Security</members><name>Settings</name></types>
<types><members>*</members><name>PermissionSet</name></types>
<types><members>*</members><name>PermissionSetGroup</name></types>
<types><members>*</members><name>Profile</name></types>
<types><members>*</members><name>SharingRules</name></types>
<types><members>*</members><name>NamedCredential</name></types>
<types><members>*</members><name>ExternalCredential</name></types>
<types><members>*</members><name>RemoteSiteSetting</name></types>
<version>67.0</version>
</Package>
bash
sf project retrieve start --manifest manifest/security-audit.xml \
--target-org vf-prod --output-dir "$AUDIT/metadata"

Retrieving into --output-dir keeps the working tree untouched. The directory layout under it depends on the retrieve, so locate the retrieved types rather than assuming a path:

bash
find "$AUDIT/metadata" -type d \( -name profiles -o -name permissionsets -o -name permissionsetgroups \
-o -name namedCredentials -o -name externalCredentials -o -name remoteSiteSettings -o -name sharingRules \)

An ls against a guessed path that does not exist prints an error and counts as zero - on a security audit that reads as a clean result. Always count from find output.

Profiles retrieve as a sparse representation - a permission missing from a retrieved profile is not proof it is not granted, so confirm grants with the queries in patterns 3 and 4 rather than by reading profile XML.

3. Who holds the dangerous permissions
bash
sf data query --target-org vf-prod --json \
--query "SELECT Assignee.Username, Assignee.IsActive, PermissionSet.Name FROM PermissionSetAssignment WHERE PermissionSet.PermissionsModifyAllData = true" > "$AUDIT/modifyalldata.json"
sf data query --target-org vf-prod --json \
--query "SELECT Assignee.Username, PermissionSet.Name FROM PermissionSetAssignment WHERE PermissionSet.PermissionsViewAllData = true" > "$AUDIT/viewalldata.json"

Repeat for PermissionsAuthorApex, PermissionsViewEncryptedData, PermissionsManageUsers and PermissionsCustomizeApplication [unverified: only PermissionsModifyAllData, PermissionsViewAllData, PermissionsViewAllRecords and PermissionsModifyAllRecords are confirmed field names in this repository - run sf sobject describe --sobject PermissionSet --target-org <alias> before relying on the rest]. Findings, in descending severity:

FindingSeverity
An integration or service account holds ModifyAllDatahigh
A named person holds ModifyAllData outside the admin grouphigh
An inactive user still holds an administrative permissionmedium
ViewAllData granted for a reporting need a report type would satisfymedium
AuthorApex outside the release processmedium

A grant that appears through a profile's own permission set still counts as a grant, which is why profile sprawl (pattern 5) is a security topic and not only a tidiness one. [unverified: the IsOwnedByProfile field used below to separate profile-owned permission sets from standalone ones was not confirmed in this session - describe the object first, or drop the filter and group by Parent.Name.]

4. The access matrix per permission set
bash
sf data query --target-org vf-prod --json \
--query "SELECT Parent.Name, SobjectType, PermissionsRead, PermissionsCreate, PermissionsEdit, PermissionsDelete, PermissionsViewAllRecords, PermissionsModifyAllRecords FROM ObjectPermissions WHERE Parent.IsOwnedByProfile = false" > "$AUDIT/objectperms.json"
sf data query --target-org vf-prod --json \
--query "SELECT Parent.Name, Field, PermissionsRead, PermissionsEdit FROM FieldPermissions WHERE SobjectType = 'Account'" > "$AUDIT/fieldperms-account.json"

Audit the sensitive objects first: anything holding personal data, financial data, or credentials. PermissionsViewAllRecords and PermissionsModifyAllRecords bypass sharing for that object - each one needs a named reason, and an object-level bypass granted to a broad permission set is a high finding.

5. Profile sprawl
bash
find "$AUDIT/metadata" -path "*/profiles/*.profile-meta.xml" | wc -l
find "$AUDIT/metadata" -path "*/permissionsets/*.permissionset-meta.xml" | wc -l

Posture, in order of preference: permission set groups for personas, permission sets for features, profiles reduced to login and default settings. A large profile count with few permission sets means access cannot be reviewed - the finding is "grants are not reviewable", and its severity depends on what those profiles open up (pattern 4), not on the count.

6. Code exposure surface
bash
grep -rn "@AuraEnabled" force-app --include="*.cls" | wc -l
grep -rn "@RestResource\|global class\|webService" force-app --include="*.cls"
grep -rln "without sharing" force-app --include="*.cls"
sf data query --target-org vf-prod --json \
--query "SELECT Parent.Name, SetupEntityId FROM SetupEntityAccess WHERE SetupEntityType = 'ApexClass'" > "$AUDIT/apexclassaccess.json"

Every @AuraEnabled and @RestResource method is an API an authenticated user can call directly: the client never enforces anything. Check each one for user-mode data access and a sharing keyword (skill sf-security-model). A generic endpoint - "run this SOQL", "update this record with this map" - is a high finding regardless of who holds the class access.

7. Record access: org-wide defaults and elevation
bash
grep -rh "<sharingModel>" force-app/main/default/objects/*/*.object-meta.xml | sort | uniq -c
grep -rn "without sharing" force-app --include="*.cls"
grep -rn "__Share\b" force-app --include="*.cls"

An object whose sharing model is ReadWrite needs a reason; Private plus sharing rules is the defensible default for anything sensitive. Every without sharing class and every Apex managed sharing insert is an elevation path: it must be narrow, documented, and covered by a negative test (skill sf-security-model, references sharing-and-record-access.md).

8. Public surface
bash
ls force-app/main/default/networks/ 2>/dev/null
ls force-app/main/default/sites/ 2>/dev/null
grep -rn "Site\.\|Network\.\|UserInfo.getUserType" force-app --include="*.cls"

If the org has Sites or Experience Cloud, the guest user is an unauthenticated identity with real permissions. Audit it as its own user: what objects it reads, which Apex classes it can run, which Flows it can start, and whether any without sharing code runs on its behalf. Guest access to person data is a high finding on sight, and personal-information visibility settings on the User object are not enforced by user mode or stripInaccessible (skill sf-security-model, reference crud-fls-enforcement.md).

9. Integrations and secrets
bash
find "$AUDIT/metadata" -path "*/namedCredentials/*" -type f
find "$AUDIT/metadata" -path "*/externalCredentials/*" -type f
find "$AUDIT/metadata" -path "*/remoteSiteSettings/*" -type f
grep -rniE "password|secret|token|api[_-]?key|authorization" force-app --include="*.cls" --include="*.js" --include="*.xml"
git log -p --all -S"password" -- force-app | head -100

A Remote Site Setting with no matching Named Credential usually means a callout is authenticating by hand, with the credential somewhere in source. A secret found in git history is still a secret: the finding is "rotate the credential", not "remove the line".

10. The Setup-only layer

No CLI command covers these; a person opens Setup and records the answer. They belong in the report with the same severity scale as everything else.

This is the start of the file. Read the full SKILL.md on GitHub.

Security

  • Security scanPassed, 95 of 100Pattern checks on the skill's files.
  • Model reviewPassed

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

7-day trend score
0

Not refreshed yet.

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/grzmol/vibe-force/sf-org-security-audit/badge)](https://verified-skill.com/skills/grzmol/vibe-force/sf-org-security-audit)

Something wrong with this skill or its page? Tell us.