r/reactjs •

Beginner's Thread / Easy Questions (May 2020)

[deleted] — view deleted post

0 Upvotes

401 comments sorted by

View all comments

Show parent comment

0

u/[deleted] May 04 '20

[deleted] — view deleted comment

3

u/dlrwtllktgrtt May 04 '20

I did search the bundle, and yes the keys are all public in the bundle being served up, Amplify doesn't generate lambdas to handle this.

I've since discovered that the API keys are meant to be public.

Here's what the firebase docs had to say:

The content is considered public, including your platform-specific ID (entered in the Firebase console setup workflow) and values that are specific to your Firebase project, like your API Key, Realtime Database URL, and Storage bucket name. Given this, use security rules to protect your data and files in Realtime Database, Cloud Firestore, and Cloud Storage.

The approach then is to use security rules along with firebase auth to make sure no unauthorised person can read, write, modify or delete data.

A simple rule for eg can be:

allow read, update, delete: if request.auth.uid == userId;

more examples in the security rules docs I've linked to above.