Skip to content

Instantly share code, notes, and snippets.

@DennisAlund
Last active September 6, 2018 00:51
Show Gist options
  • Select an option

  • Save DennisAlund/5a7b0276cecff3ae7f79f29b74f0197f to your computer and use it in GitHub Desktop.

Select an option

Save DennisAlund/5a7b0276cecff3ae7f79f29b74f0197f to your computer and use it in GitHub Desktop.
A sample Firebase database rules file for the article: https://medium.com/evenbit/securing-your-firebase-app-part-2-33260a84dc78
{
"rules": {
"queue": {
"tasks": {
"$task_id": {
".validate": "newData.hasChildren(['apiKey', 'someValue', 'anotherValue']) && root.child('apiKeys').child(apiKey).val() != null",
"apiKey": {
".validate": "newData.isString()"
},
"someValue": {
".validate": "newData.isNumber()"
},
"anotherValue": {
".validate": "newData.hasChildren()"
},
"$other": {
".validate": "false"
}
}
}
},
"apiKeys": {
"$apiKey": {
".validate": "newData.isString()"
},
".validate": "newData.hasChildren()"
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment