Salesforce provides built-in Cross-Site Request Forgery (CSRF) protection for all form requests made on the platform. State change operations like insert, delete, update, and upsert triggered by user actions (e.g., button clicks) are protected by default. However, additional measures are needed in specific scenarios:
1. **Visualforce Pages**: To protect against CSRF vulnerabilities when state change or DML operations execute on page initialization, enable the `confirmationTokenRequired` boolean metadata field in the Visualforce page settings. When set to `true`, GET requests to the page require a CSRF token in the URL, making the page inaccessible without the token.
2. **Lightning and LWC**: Avoid performing state change or DML operations in an Apex controller during the instantiation of Lightning or LWC components. Instead, trigger these operations through explicit user actions, like button clicks.
These additional measures ensure CSRF vulnerabilities are mitigated in scenarios where default protections may not apply.