Where should a developer introduce CSRF validation check for a customer address form?

Disable ads (and more) with a premium pass for a one time $4.99 payment

Prepare for the Salesforce B2C Commerce Developer Test with interactive flashcards and multiple-choice questions. Dive into comprehensive study materials, hints, and explanations. Ace your Salesforce exam with ease!

The appropriate place to introduce CSRF (Cross-Site Request Forgery) validation checks for a customer address form is during form submission handling. When a customer submits the form, it is essential to validate the CSRF token at that moment to ensure that the request is legitimate and comes from the authenticated session. This is because the integrity of the form data being submitted is crucial for preventing malicious attacks, where unauthorized entities may attempt to manipulate or submit data on behalf of users.

By implementing the CSRF validation in the controller function that processes the submitted form, the developer ensures that every incoming request that alters data is checked for a valid CSRF token. If the token is invalid or missing, the system can reject the request and prevent any unauthorized changes to the user's address, thereby protecting sensitive information.

While displaying the form could allow the inclusion of a CSRF token initially, it does not prevent attacks during submission. Middleware is typically used for handling authentication and other processes before reaching the controller, but the validation must specifically occur at the point where data is accepted. Lastly, model functions are not appropriate for CSRF checks since they are concerned with data persistence rather than request validation.

Thus, checking CSRF tokens in the controller function that handles the submitted form is the

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy