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.Back-end code runs faster than browser code; all pricing rules need that speed and the front-end cannot match it
- B.Front-end frameworks lack math libraries; every price calculation needs a server and a database for precision
- C.Front-end code is visible and modifiable by users; back-end code runs in a trusted environment the user cannot alter
- D.Browsers refuse to run business rules; scripts never touch the cart and the server must do the arithmetic
Why C 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.