Exercise 2: Why the Firebase Config Object Isn't a Secret — Possible Solution ==================================================================== WHY IT'S SAFE TO EXPOSE ------------------------------ Per this chapter, Firebase's client-side config values (apiKey, projectId, etc.) only identify WHICH Firebase project a request is talking to - they don't, by themselves, grant any access to data or functionality. Unlike a traditional server API key, possessing these config values doesn't let someone read or write anything they wouldn't otherwise be allowed to. WHAT ACTUALLY ENFORCES ACCESS CONTROL INSTEAD ------------------------------ Security Rules, evaluated on Firebase's own servers for every single read and write request, regardless of what config values the client presents. Access is granted or denied based on those rules - not based on secrecy of the config object. A genuine secret (for example, an API key for a third-party service that must never reach the browser) is handled completely differently: it's kept inside a Cloud Function, which runs server-side and is never exposed to client code at all. WHY THIS WORKS AS AN ANSWER ------------------------------ It correctly explains that the config object only identifies the project rather than granting access, correctly names Security Rules as the actual enforcement mechanism, and correctly distinguishes this from a genuine secret, which is protected by keeping it inside a Cloud Function instead.