Salesforce Integration Policy Guardrails
Overview
Turn recurring integration hazards into deterministic checks with fail-closed severity, exact evidence, owned exceptions, and no secret-dependent fork execution.
Prerequisites
- Repository, Salesforce DX or adapter layout, languages, CI trust model, protected branches, and code owners
- Current API EOL, OAuth, security, object and field access, sharing, limits, and deployment contracts
- Policy authority, severity model, baseline findings, exception format, expiry, and remediation owners
Tool Discipline
Use Read, Glob, and Grep to inspect approved repository and evidence files, WebFetch to re-check current first-party Salesforce documentation, and Write or Edit only for secretless plans, fixtures, configuration, and redacted receipts.
Current Contract
Salesforce requires parameter-safe query construction and layered authorization, while supported API versions and client-app guidance evolve. Static rules cannot prove runtime CRUD, field access, sharing, limits, or org identity and must be paired with protected tests.
Authentication
Static and fixture gates must run without Salesforce credentials. Protected runtime checks use a minimum non-production principal only after exact-head trust and must never expose secrets to fork code.
Instructions
- Inventory query construction, credentials, app and OAuth settings, API versions, objects and fields, mutations, events, retries, logs, and deployment paths.
- Define checks for string-built SOQL, secrets, unsafe logs, retired or fixed versions, broad scopes, wrong-org defaults, and unrestricted queries.
- Add rules for missing CRUD and field-access evidence, destructive operations, blind retries, unbounded concurrency, checkpoint resets, and reconciliation gaps.
- Create positive and negative fixtures for every rule and pin scanners, actions, runtimes, dependencies, and rule hashes.
- Run secretless checks on every change and protected org contract checks only in trusted environments.
- Ratchet against a reviewed baseline; require exact finding, owner, reason, scope, expiry, and compensating control for exceptions.
- Measure escapes and false positives, close expired waivers, and update policies from incidents and Salesforce contract changes.
Approval Boundaries
Do not suppress blockers, broaden globs, add permanent waivers, expose CI secrets, or auto-fix Salesforce org state without policy-owner approval.
Output
Return the policy catalog, authority and hashes, fixture results, findings, baseline delta, exceptions with expiry, protected-test receipt, and owners.
Error Handling
| Condition |
Response |
| Rule flags generated or vendored content |
Narrow the rule with an evidence-backed path boundary rather than disabling the category. |
| Runtime permission cannot be proven statically |
Require a protected non-production test and label static evidence as incomplete. |
| Exception has no owner or expiry |
Fail the gate until governance metadata is complete. |
Example
A redacted completion receipt might look like this:
profile=enterprise; rules=12; fixtures=24-pass; blockers=0; waivers=2-expiring; fork-secrets=0; runtime=protected-pass
Resources
Next Steps
Run the workflow first in the lowest-risk authorized org and preserve its redacted receipt. Schedule a review against the next Salesforce seasonal release and the customer change calendar.
1---2name: salesforce-policy-guardrails-23description: 'Gate Salesforce code and configuration for SOQL injection, secret exposure, unsafe API versions, missing access checks, destructive writes, and unreviewed org changes. Use when running CI or review. Trigger with "add Salesforce guardrails".'4argument-hint: "[repository] [policy-profile]"5allowed-tools: Read, Glob, Grep, WebFetch, Write, Edit6version: 1.8.07author: Jeremy Longshore <jeremy@intentsolutions.io>8license: MIT9tags: [saas, salesforce, policy, secure-coding, ci]10model: inherit11effort: high12compatibility: Designed for Claude Code; blocking policy and exceptions require code, security, Salesforce platform, and business-owner governance13metadata:14 source: https://skillmd.com/skills/jeremylongshore/salesforce-policy-guardrails-215---1617# Salesforce Integration Policy Guardrails1819## Overview2021Turn recurring integration hazards into deterministic checks with fail-closed severity, exact evidence, owned exceptions, and no secret-dependent fork execution.2223## Prerequisites2425- Repository, Salesforce DX or adapter layout, languages, CI trust model, protected branches, and code owners26- Current API EOL, OAuth, security, object and field access, sharing, limits, and deployment contracts27- Policy authority, severity model, baseline findings, exception format, expiry, and remediation owners2829## Tool Discipline3031Use `Read`, `Glob`, and `Grep` to inspect approved repository and evidence files, `WebFetch` to re-check current first-party Salesforce documentation, and `Write` or `Edit` only for secretless plans, fixtures, configuration, and redacted receipts.3233## Current Contract3435Salesforce requires parameter-safe query construction and layered authorization, while supported API versions and client-app guidance evolve. Static rules cannot prove runtime CRUD, field access, sharing, limits, or org identity and must be paired with protected tests.3637## Authentication3839Static and fixture gates must run without Salesforce credentials. Protected runtime checks use a minimum non-production principal only after exact-head trust and must never expose secrets to fork code.4041## Instructions42431. Inventory query construction, credentials, app and OAuth settings, API versions, objects and fields, mutations, events, retries, logs, and deployment paths.442. Define checks for string-built SOQL, secrets, unsafe logs, retired or fixed versions, broad scopes, wrong-org defaults, and unrestricted queries.453. Add rules for missing CRUD and field-access evidence, destructive operations, blind retries, unbounded concurrency, checkpoint resets, and reconciliation gaps.464. Create positive and negative fixtures for every rule and pin scanners, actions, runtimes, dependencies, and rule hashes.475. Run secretless checks on every change and protected org contract checks only in trusted environments.486. Ratchet against a reviewed baseline; require exact finding, owner, reason, scope, expiry, and compensating control for exceptions.497. Measure escapes and false positives, close expired waivers, and update policies from incidents and Salesforce contract changes.5051## Approval Boundaries5253Do not suppress blockers, broaden globs, add permanent waivers, expose CI secrets, or auto-fix Salesforce org state without policy-owner approval.5455## Output5657Return the policy catalog, authority and hashes, fixture results, findings, baseline delta, exceptions with expiry, protected-test receipt, and owners.5859## Error Handling6061| Condition | Response |62|---|---|63| Rule flags generated or vendored content | Narrow the rule with an evidence-backed path boundary rather than disabling the category. |64| Runtime permission cannot be proven statically | Require a protected non-production test and label static evidence as incomplete. |65| Exception has no owner or expiry | Fail the gate until governance metadata is complete. |6667## Example6869A redacted completion receipt might look like this:7071```text72profile=enterprise; rules=12; fixtures=24-pass; blockers=0; waivers=2-expiring; fork-secrets=0; runtime=protected-pass73```7475## Resources7677- [Salesforce SOQL injection guidance](https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/pages_security_tips_soql_injection.htm)78- [REST API end-of-life policy](https://developer.salesforce.com/docs/platform/api-rest/guide/api-rest-eol.html)7980## Next Steps8182Run the workflow first in the lowest-risk authorized org and preserve its redacted receipt. Schedule a review against the next Salesforce seasonal release and the customer change calendar.