I have a domain whitelist system to verify whether a site's domain is included in my whitelist. If a domain is on the list, it means the theme is verified and purchased. Otherwise, the code should not work.
My whitelist is stored in a Firebase Realtime Database JSON file at: https://sitelicenses-default-rtdb.firebaseio.com/domains.json
Problem:
Currently, if someone accesses this URL directly https://sitelicenses-default-rtdb.firebaseio.com/domains.json
, they can see the entire list of whitelisted domains. Instead, I want to restrict access so that:
If a request includes a specific domain as a parameter (e.g., https://sitelicenses-default-rtdb.firebaseio.com/domains.json/www.prothomalo-tenolent.blogspot.com
), it should return only that domain if it's in the list.
If accessed without a valid domain parameter (e.g., https://sitelicenses-default-rtdb.firebaseio.com/domains.json
), nothing should be shown.
My JSON Data Structure in Firebase:
[
"www.eatingfact-tenolent.blogspot.com",
"www.prothomalo-tenolent.blogspot.com"
]
I am using Firebase Realtime Database, and my firebase rules is now:
{
"rules": {
".read": true,
".write": true
}
}
Is there a way to enforce this restriction using Firebase rules or any other method? Is it possible to achieve this behavior securely? Any guidance would be appreciated!
I tried to Restrict Firebase Realtime Database Access to Specific Query Parameters