scc-universal 1.2.1 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/.cursor/agents/sf-agentforce-agent.md +88 -40
  3. package/.cursor/skills/prompt-optimizer/SKILL.md +21 -21
  4. package/.cursor/skills/sf-2gp-security-review/SKILL.md +167 -0
  5. package/.cursor/skills/sf-agentforce-development/SKILL.md +385 -348
  6. package/.cursor/skills/sf-cli-reference/SKILL.md +221 -0
  7. package/.cursor/skills/sf-harness-audit/SKILL.md +2 -2
  8. package/.cursor/skills/sf-quickstart/SKILL.md +1 -1
  9. package/.cursor-plugin/plugin.json +1 -1
  10. package/README.md +8 -38
  11. package/agents/sf-agentforce-agent.md +88 -40
  12. package/docs/ARCHITECTURE.md +4 -3
  13. package/docs/authoring-guide.md +1 -1
  14. package/docs/hook-development.md +1 -1
  15. package/examples/agentforce-action/README.md +4 -4
  16. package/examples/devops-pipeline/README.md +4 -4
  17. package/examples/integration-pattern/README.md +4 -4
  18. package/examples/platform-events/README.md +4 -4
  19. package/examples/security-audit/README.md +3 -3
  20. package/examples/visualforce-migration/README.md +4 -4
  21. package/manifests/install-modules.json +9 -3
  22. package/package.json +2 -2
  23. package/scripts/lib/install-executor.js +23 -12
  24. package/skills/_reference/AGENTFORCE_PATTERNS.md +433 -51
  25. package/skills/_reference/APPEXCHANGE_REVIEW.md +427 -0
  26. package/skills/_reference/SF_CLI_COMMANDS.md +812 -0
  27. package/skills/prompt-optimizer/SKILL.md +21 -21
  28. package/skills/sf-2gp-security-review/SKILL.md +168 -0
  29. package/skills/sf-agentforce-development/SKILL.md +385 -348
  30. package/skills/sf-cli-reference/SKILL.md +225 -0
  31. package/skills/sf-harness-audit/SKILL.md +2 -2
  32. package/skills/sf-quickstart/SKILL.md +1 -1
  33. package/.cursor/hooks/adapter.js +0 -81
  34. package/.cursor/hooks/after-file-edit.js +0 -26
  35. package/.cursor/hooks/after-mcp-execution.js +0 -12
  36. package/.cursor/hooks/after-shell-execution.js +0 -30
  37. package/.cursor/hooks/after-tab-file-edit.js +0 -12
  38. package/.cursor/hooks/before-mcp-execution.js +0 -11
  39. package/.cursor/hooks/before-read-file.js +0 -13
  40. package/.cursor/hooks/before-shell-execution.js +0 -29
  41. package/.cursor/hooks/before-submit-prompt.js +0 -23
  42. package/.cursor/hooks/pre-compact.js +0 -7
  43. package/.cursor/hooks/session-end.js +0 -10
  44. package/.cursor/hooks/session-start.js +0 -10
  45. package/.cursor/hooks/stop.js +0 -18
  46. package/.cursor/hooks/subagent-start.js +0 -10
  47. package/.cursor/hooks/subagent-stop.js +0 -10
@@ -0,0 +1,427 @@
1
+ # AppExchange Security Review — Salesforce Reference
2
+
3
+ > Last verified: API v66.0 (Spring '26)
4
+ > Source: <https://developer.salesforce.com/docs/atlas.en-us.packagingGuide.meta/packagingGuide/security_review_overview.htm>
5
+
6
+ ## 15 Audit Categories
7
+
8
+ For each category: AppExchange-specific audit criteria, grep patterns, and PASS/WARN/FAIL
9
+ thresholds. General security implementation patterns live in dedicated reference files
10
+ (SECURITY_PATTERNS.md, TESTING_STANDARDS.md, PACKAGE_DEVELOPMENT.md, GOVERNOR_LIMITS.md).
11
+
12
+ ### Category 1: CRUD/FLS Enforcement (CRITICAL — #1 Failure Reason)
13
+
14
+ > For CRUD/FLS implementation patterns, see SECURITY_PATTERNS.md.
15
+
16
+ **Grep patterns to find violations:**
17
+
18
+ ```
19
+ Database.query( — check if AccessLevel.USER_MODE is passed
20
+ [SELECT — check if WITH USER_MODE is appended
21
+ Database.insert( — check for AccessLevel.USER_MODE parameter
22
+ Database.update( — same
23
+ Database.delete( — same
24
+ Database.upsert( — same
25
+ insert — bare DML without stripInaccessible wrapper
26
+ update — same
27
+ delete — same
28
+ upsert — same
29
+ ```
30
+
31
+ - **FAIL:** Any SOQL query or DML statement operates in system mode without explicit justification.
32
+ - **WARN:** Legacy `isAccessible()` pattern used instead of modern `USER_MODE` — functional but dated.
33
+ - **PASS:** All queries/DML use `USER_MODE` or `Security.stripInaccessible()`.
34
+
35
+ ### Category 2: Sharing Model Enforcement
36
+
37
+ > For sharing keywords and decision tree, see SECURITY_PATTERNS.md and SHARING_MODEL.md.
38
+
39
+ **Grep patterns:**
40
+
41
+ ```
42
+ class.*{ — find all class declarations
43
+ with sharing — should be present on data-access classes
44
+ without sharing — must have justification comment nearby
45
+ inherited sharing — acceptable for utility classes
46
+ ```
47
+
48
+ - **FAIL:** Data-access classes omit the sharing keyword or use `without sharing` without justification.
49
+ - **PASS:** Every class explicitly declares sharing behavior.
50
+
51
+ ### Category 3: SOQL/DML Injection Prevention
52
+
53
+ > For injection prevention patterns, see SECURITY_PATTERNS.md.
54
+
55
+ **Grep patterns:**
56
+
57
+ ```
58
+ Database.query(.*+ — dynamic query with concatenation
59
+ ' + .*+ ' — string concatenation in queries
60
+ String.escapeSingleQuotes — check if used where needed
61
+ ```
62
+
63
+ - **FAIL:** Any dynamic SOQL uses unescaped string concatenation.
64
+ - **PASS:** All queries use bind variables or properly escaped parameters.
65
+
66
+ ### Category 4: Sensitive Data Exposure
67
+
68
+ **What to check:**
69
+
70
+ - No `System.debug()` calls that log sensitive data (credentials, tokens, PII, full query results)
71
+ - No hardcoded API keys, passwords, tokens, or secrets anywhere in code
72
+ - Error messages shown to users don't expose stack traces or system internals
73
+ - `AuraHandledException` messages are user-friendly, not technical
74
+
75
+ **Grep patterns:**
76
+
77
+ ```
78
+ System.debug — audit every instance for sensitive data
79
+ password — should never appear as a literal
80
+ api_key|apikey — should never be hardcoded
81
+ secret — check context
82
+ token — check if it's a hardcoded value vs variable name
83
+ ```
84
+
85
+ - **FAIL:** Hardcoded credentials or sensitive data in debug statements found.
86
+ - **WARN:** Debug statements present but don't contain sensitive data (should be removed before production).
87
+ - **PASS:** No sensitive data exposure detected.
88
+
89
+ ### Category 5: XSS and Content Security Policy (LWC/Aura)
90
+
91
+ > For VF/LWC encoding patterns, see SECURITY_PATTERNS.md. For LWC lifecycle and patterns, see LWC_PATTERNS.md.
92
+
93
+ **What to check in LWC components:**
94
+
95
+ - No use of `innerHTML` with unsanitized user input (use `lwc:dom="manual"` carefully)
96
+ - No inline `<script>` tags or inline event handlers (`onclick=`, `onload=`)
97
+ - All third-party JavaScript loaded from Static Resources, never external CDNs
98
+ - No `eval()`, `Function()`, or `setTimeout(string)` calls
99
+ - CSS doesn't use absolute positioning that breaks component encapsulation
100
+
101
+ **What to check in Aura components:**
102
+
103
+ - `$A.util.escapeHtml()` used for dynamic content rendering
104
+ - No `{!v.unsanitizedContent}` without `aura:text` or escaping
105
+ - Components don't break Lightning Locker Service isolation
106
+
107
+ - **FAIL:** innerHTML with user input, inline scripts, or external CDN dependencies found.
108
+ - **PASS:** All dynamic content is properly escaped and CSP-compliant.
109
+
110
+ ### Category 6: External Callout Security
111
+
112
+ **What to check:**
113
+
114
+ - All HTTP callouts use HTTPS (never plain HTTP)
115
+ - Remote Site Settings and Named Credentials use HTTPS URLs
116
+ - SSL/TLS endpoints support TLS 1.2+ (A grade from SSL checker)
117
+ - Named Credentials used instead of hardcoded endpoints where possible
118
+ - No credentials passed in URL parameters (use headers or body)
119
+ - All certificates properly configured and not self-signed
120
+
121
+ - **FAIL:** HTTP endpoints, credentials in URLs, or missing Named Credentials for integrations.
122
+ - **PASS:** All callouts use HTTPS with proper credential management.
123
+ - **N/A:** Package makes no external callouts.
124
+
125
+ ### Category 7: Third-Party Library Vulnerabilities
126
+
127
+ **What to check:**
128
+
129
+ - All static resources containing JavaScript libraries are current versions
130
+ - No known CVE vulnerabilities in bundled libraries (especially jQuery, lodash, moment.js)
131
+ - `package.json` dependencies (if any) don't have known vulnerabilities
132
+ - No deprecated or end-of-life libraries
133
+
134
+ **How to check:**
135
+
136
+ - Examine every static resource for library version numbers
137
+ - Cross-reference versions against known vulnerability databases
138
+ - Check `package.json` devDependencies for outdated packages
139
+
140
+ - **FAIL:** Libraries with known critical CVEs are included.
141
+ - **WARN:** Libraries are outdated but no known CVEs.
142
+ - **PASS:** All libraries are current or no third-party JS is used.
143
+
144
+ ### Category 8: Code Coverage
145
+
146
+ > For test patterns, annotations, and assertion API, see TESTING_STANDARDS.md.
147
+
148
+ **How to assess (without running tests):**
149
+
150
+ - Count test classes vs. production classes (healthy ratio is ~1:1)
151
+ - Check test methods for assertions
152
+ - Verify test data factory exists and is used consistently
153
+ - Look for edge case and error path tests
154
+
155
+ - **FAIL:** Missing test classes, `@SeeAllData` used, or triggers lack coverage.
156
+ - **WARN:** Coverage likely below 85% based on test method count vs. code complexity.
157
+ - **PASS:** Comprehensive test coverage with assertions and negative tests.
158
+
159
+ ### Category 9: Namespace and Packaging Compliance
160
+
161
+ > For namespace rules, versioning, and package CLI, see PACKAGE_DEVELOPMENT.md.
162
+
163
+ **What to check (audit-specific):**
164
+
165
+ - Apex code references fields with namespace prefix (e.g., `agentsiq__Field__c`)
166
+ - Metadata XML defines fields WITHOUT namespace prefix (Salesforce adds it at deploy)
167
+ - No hardcoded Salesforce IDs (use dynamic queries or Custom Metadata)
168
+ - All metadata is packageable (no org-specific dependencies)
169
+
170
+ - **FAIL:** Namespace mismatches, hardcoded IDs, or unpackageable metadata found.
171
+ - **PASS:** All namespace conventions are followed correctly.
172
+
173
+ ### Category 10: Permission Model
174
+
175
+ **What to check:**
176
+
177
+ - At least one Permission Set defined for the package
178
+ - Permission Sets follow least-privilege principle
179
+ - Object CRUD permissions are assigned per role/tier
180
+ - Field-level security is configured per Permission Set
181
+ - No custom profiles (use Permission Sets for 2GP)
182
+ - Protected Custom Metadata Types are truly protected (not public)
183
+ - Feature gating mechanism exists for tiered products
184
+
185
+ - **FAIL:** No Permission Sets, or all fields/objects are wide-open.
186
+ - **PASS:** Well-structured permission model with appropriate access levels.
187
+
188
+ ### Category 11: Governor Limit Safety
189
+
190
+ > For limits tables and anti-patterns, see GOVERNOR_LIMITS.md.
191
+
192
+ **Grep patterns:**
193
+
194
+ ```
195
+ for.*{.*\[SELECT — SOQL inside loop
196
+ for.*{.*insert — DML inside loop
197
+ for.*{.*update — DML inside loop
198
+ while.*{.*Database — DML inside while loop
199
+ ```
200
+
201
+ - **FAIL:** SOQL or DML inside loops found.
202
+ - **WARN:** Complex CPU operations without async offloading.
203
+ - **PASS:** All operations are bulk-safe and governor-friendly.
204
+
205
+ ### Category 12: Lightning Web Security (LWS) Compliance
206
+
207
+ **What to check:**
208
+
209
+ - LWC components follow namespace isolation rules
210
+ - No attempts to access global window properties outside LWS sandbox
211
+ - Component API version is 60.0+ (supports LWS)
212
+ - Components tested with LWS enabled
213
+ - No cross-namespace DOM manipulation
214
+
215
+ - **FAIL:** Components break LWS isolation or target deprecated API versions.
216
+ - **PASS:** All LWC components are LWS-compliant at API v60.0+.
217
+
218
+ ### Category 13: Connected App and OAuth Configuration
219
+
220
+ **What to check:**
221
+
222
+ - OAuth scopes follow least-privilege (no `full` scope without justification)
223
+ - Connected Apps use HTTPS callback URLs
224
+ - No client secrets or OAuth tokens hardcoded in source
225
+ - Refresh token handling is secure
226
+ - Named Credentials used for org-to-org authentication
227
+
228
+ - **FAIL:** Overly broad OAuth scopes or hardcoded secrets.
229
+ - **N/A:** Package doesn't use Connected Apps or OAuth flows.
230
+
231
+ ### Category 14: Data at Rest and in Transit
232
+
233
+ **What to check:**
234
+
235
+ - Sensitive data stored in Protected Custom Settings or Protected Custom Metadata
236
+ - No plain-text storage of API keys, tokens, or credentials
237
+ - All external communication encrypted (TLS 1.2+)
238
+ - Platform Encryption considered for PII fields
239
+ - Custom Settings marked as Protected in managed package context
240
+
241
+ - **FAIL:** Sensitive data stored in plain text or unprotected settings.
242
+ - **PASS:** All sensitive data properly encrypted/protected.
243
+
244
+ ### Category 15: Documentation and Submission Readiness
245
+
246
+ **What to check:**
247
+
248
+ - Security architecture documentation exists
249
+ - API callout documentation (all external endpoints listed)
250
+ - False positive documentation prepared for scanner findings
251
+ - Test environment credentials documented
252
+ - Install/upgrade guide exists
253
+ - Post-install script documented (if applicable)
254
+ - Release notes maintained
255
+
256
+ - **FAIL:** No security documentation exists.
257
+ - **WARN:** Partial documentation — needs completion before submission.
258
+ - **PASS:** Complete documentation ready for security review team.
259
+
260
+ ---
261
+
262
+ ## Scoring Rules
263
+
264
+ ### Automatic FAIL (any one = will not pass security review)
265
+
266
+ - CRUD/FLS violations found in any Apex class
267
+ - Hardcoded credentials or API keys in source code
268
+ - SOQL injection vulnerabilities (dynamic queries with string concatenation)
269
+ - HTTP (non-HTTPS) external callouts
270
+ - `@SeeAllData` in test classes
271
+ - Apex triggers without test coverage
272
+ - Code coverage below 75%
273
+ - Static resources with known critical CVE vulnerabilities
274
+
275
+ ### Likely FAIL (2+ together = high risk of failure)
276
+
277
+ - Classes missing explicit sharing keyword
278
+ - Debug statements with sensitive data
279
+ - No security documentation
280
+ - OAuth scope broader than needed
281
+ - Unprotected Custom Settings storing secrets
282
+
283
+ ### WARN (won't fail alone but should fix)
284
+
285
+ - Legacy CRUD/FLS patterns instead of modern `USER_MODE`
286
+ - Debug statements present (even without sensitive data)
287
+ - Outdated but non-vulnerable libraries
288
+ - Missing negative test cases
289
+ - Partial documentation
290
+
291
+ ### Verdicts
292
+
293
+ - **READY TO SUBMIT** — Zero FAILs, zero or few WARNs. Package should pass security review.
294
+ - **NEEDS REMEDIATION** — Has FAILs that must be fixed before submission. List each FAIL with specific file, line number, and remediation steps.
295
+ - **MAJOR REWORK NEEDED** — Multiple critical FAILs across categories. Provide a prioritized remediation plan.
296
+
297
+ ---
298
+
299
+ ## 2GP License Qualification Checklist
300
+
301
+ ### Dev Hub & Environment
302
+
303
+ - [ ] Dev Hub org enabled (Developer, Enterprise, Unlimited, or Performance edition)
304
+ - [ ] "Unlocked Packages and Second-Generation Managed Packages" enabled in Dev Hub
305
+ - [ ] Namespace registered and linked to Dev Hub
306
+ - [ ] Using ONE Dev Hub per partner company (not multiple)
307
+ - [ ] Scratch org definition file configured correctly
308
+ - [ ] CI/CD pipeline set up for automated package builds
309
+
310
+ ### Package Configuration
311
+
312
+ - [ ] `sfdx-project.json` has valid namespace, package name, and API version
313
+ - [ ] Package type is "Managed" (not Unlocked)
314
+ - [ ] Dependencies declared in `sfdx-project.json` if applicable
315
+ - [ ] Semantic versioning followed (major.minor.patch.build)
316
+ - [ ] Package aliases configured for readable references
317
+
318
+ ### Code Quality Gates
319
+
320
+ - [ ] Apex code coverage at 75%+ (minimum) — aim for 85%+
321
+ - [ ] Every Apex trigger has test coverage
322
+ - [ ] All test classes use `@IsTest` annotation
323
+ - [ ] No `@SeeAllData` in any test class
324
+ - [ ] Test data factory exists and is used consistently
325
+ - [ ] All test methods have `System.assert*` calls
326
+ - [ ] Salesforce Code Analyzer run with `--rule-selector AppExchange`
327
+ - [ ] All critical and high severity findings resolved
328
+ - [ ] False positives documented with justification
329
+
330
+ ### Security Review Submission
331
+
332
+ - [ ] Salesforce Code Analyzer scan report generated
333
+ - [ ] Source Code Scanner (Checkmarx) report generated via Partner Security Portal
334
+ - [ ] DAST scan report generated (Chimera retired June 2025 — use alternative)
335
+ - [ ] All scan reports uploaded to security review submission
336
+ - [ ] Security architecture documentation complete
337
+ - [ ] Test org credentials prepared for review team
338
+ - [ ] API callout documentation complete (all external endpoints)
339
+ - [ ] False positive justifications written
340
+
341
+ ### ISV Partner Program
342
+
343
+ - [ ] Salesforce Partner Program Agreement (SPPA) signed
344
+ - [ ] AppExchange Partner category selected
345
+ - [ ] License Management App (LMA) installed in Partner Business Org
346
+ - [ ] License type decided (per-user, site-wide, or permission set license)
347
+ - [ ] Feature Parameters defined for tiered pricing (if applicable)
348
+ - [ ] Trialforce Source Org configured (if offering free trials)
349
+
350
+ ### Post-Security Review
351
+
352
+ - [ ] Publishing Partner Console access confirmed
353
+ - [ ] AppExchange listing content prepared (description, screenshots, pricing)
354
+ - [ ] Post-install script tested (if applicable)
355
+ - [ ] Push upgrade strategy planned (batch size, scheduling, communication)
356
+ - [ ] Annual re-review calendar reminder set
357
+ - [ ] Version attestation process understood (no re-review for minor updates)
358
+
359
+ ---
360
+
361
+ ## Scanner Commands
362
+
363
+ ```bash
364
+ # Install Salesforce Code Analyzer (if not installed)
365
+ sf plugins install @salesforce/sfdx-scanner
366
+
367
+ # Run Code Analyzer with AppExchange ruleset
368
+ sf scanner run --target "force-app/" --rule-selector AppExchange --format html --outfile security-scan-report.html
369
+
370
+ # Run PMD analysis
371
+ sf scanner run --target "force-app/" --engine pmd --format csv --outfile pmd-report.csv
372
+
373
+ # Run ESLint on LWC
374
+ sf scanner run --target "force-app/**/lwc/**" --engine eslint --format html --outfile eslint-report.html
375
+
376
+ # Run RetireJS for vulnerable libraries
377
+ sf scanner run --target "force-app/**/staticresources/**" --engine retire-js --format html --outfile retirejs-report.html
378
+
379
+ # Check code coverage
380
+ sf apex run test --code-coverage --result-format human --output-dir coverage-results/
381
+
382
+ # Create package version with coverage check
383
+ sf package version create --package "PackageName" --code-coverage --installation-key "key" --wait 20
384
+ ```
385
+
386
+ ---
387
+
388
+ ## Top 20 AppExchange Security Review Failures
389
+
390
+ Ranked by frequency:
391
+
392
+ 1. CRUD/FLS enforcement gaps (by far #1)
393
+ 2. Sensitive data in debug logs
394
+ 3. Known vulnerabilities in third-party libraries
395
+ 4. SSL/TLS compliance issues
396
+ 5. SOQL injection vulnerabilities
397
+ 6. Cross-site scripting (XSS)
398
+ 7. Insufficient input validation
399
+ 8. Hardcoded credentials/secrets
400
+ 9. OAuth scope misuse
401
+ 10. Inadequate session security
402
+ 11. API version misconfiguration
403
+ 12. Broken authentication
404
+ 13. Insufficient encryption
405
+ 14. Path traversal issues
406
+ 15. Missing access controls
407
+ 16. Insecure deserialization
408
+ 17. Broken cryptography
409
+ 18. Using blacklisted APIs
410
+ 19. Unvalidated redirects
411
+ 20. Information leakage
412
+
413
+ Source: developer.salesforce.com — "The Top 20 Vulnerabilities Found in the AppExchange Security Review"
414
+
415
+ ---
416
+
417
+ ## 2026 Considerations
418
+
419
+ Flag these recent changes that may affect the package:
420
+
421
+ - **Chimera DAST Scanner retired** (June 2025) — use alternative DAST tools
422
+ - **MFA mandatory for all users** (June 2026) — phishing-resistant methods required for admins
423
+ - **Email domain verification** (April 2026) — unverified domains silently drop emails
424
+ - **Connected App creation restricted by default** (Spring '26) — only via package install
425
+ - **Named Credentials default to developer control** (Feb 2026) — subscribers can't edit endpoints
426
+ - **CA-signed certificates limited to 200 days** (March 2026) — plan renewal cycles
427
+ - **Salesforce Code Analyzer mandatory** for AppExchange submissions (replaces sfdx-scanner)