FAQ-000185 - CSRF and DML Security Issues / DML Operations on Component Load

Current Status:VALID_RESPONSEErrorUnable to AnswerSuggests Case

Current FAQ

Question
If a DML operation is performed on page load, is adding an intermediate confirmation page a sufficient fix for a CSRF vulnerability?
Answer
Adding an intermediate confirmation page can help mitigate a CSRF vulnerability by requiring user interaction before executing DML operations. However, it is recommended to also enable the `confirmationTokenRequired` attribute in the Visualforce page settings. This ensures that GET requests to the page require a CSRF token in the URL, adding an extra layer of protection.
Enhancing FAQ...

Enhancing FAQ with AI recommendations...

AI Recommended Enhancement

Related Security Rules (click to view)
ApexCSRFVfCsrf
Question
If a DML operation is performed on page load, is adding an intermediate confirmation page a sufficient fix for a CSRF vulnerability?
Recommended Answer Update
Adding an intermediate confirmation page can help mitigate a CSRF vulnerability by requiring user interaction before executing DML operations. However, it's recommended to also enable the `confirmationTokenRequired` attribute in the Visualforce page settings. This ensures that GET requests to the page require a CSRF token in the URL, adding an extra layer of protection.
Reasoning
The original answer had minor wording improvements needed for clarity and tone. Changed 'it is recommended' to 'it's recommended' to follow the conversational tone guidelines using contractions. The technical content is accurate and current. For security rules: ApexCSRF relates directly to this FAQ because it addresses CSRF vulnerabilities in Apex code, which is exactly what the FAQ question is about - mitigating CSRF when DML operations are performed on page load. VfCsrf is highly relevant because the answer specifically mentions Visualforce page settings and the confirmationTokenRequired attribute, which is the primary mechanism this rule validates for CSRF protection in Visualforce pages.
Reasoning References