Why should critical business logic (such as price calculations or access control) always be implemented on the back-end rather than the front-end?
- A.Front-end code is visible and modifiable by users; back-end code runs in a trusted environment the user cannot alter
- B.Back-end code is faster
- C.Browsers cannot execute complex logic
- D.Front-end frameworks do not support conditional logic
Why A is correct
Front-end JavaScript can be viewed, modified, and bypassed in the browser's developer tools. An attacker could change a price or skip a validation check. Back-end code runs on a server the user does not control, making it the authoritative location for security-sensitive logic.
Know someone studying for Web App Fundamentals? Send them this one.