When integrating a Python back-end with a front-end form, how can you secure the application against Cross-Site Request Forgery (CSRF) attacks?
- Disable JavaScript to prevent malicious form submissions.
- Use a unique token with each form submission and verify it on the server.
- Use HTTPS to encrypt form data.
- Validate user input on the front-end before submission.
To secure an application against CSRF attacks, you should use a unique token (CSRF token) with each form submission. This token is generated on the server and verified on the server to ensure that the request is legitimate and not forged by a malicious attacker.
Loading...
Related Quiz
- How can you detect a cycle in a linked list?
- How would you override a method defined in a superclass in Python?
- How would you organize a group of related functions into a module?
- You need to create a singleton class, i.e., a class that allows only one instance. Which Python concept can help you ensure that there is only one instance of the class in the system?
- Which Python keyword is primarily used in generator functions to yield values?