-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
I've set Firebase's security to make firepads IDs secret.
[This commit doesn't do anything by itself, just documents the config change]
- Loading branch information
Showing
2 changed files
with
48 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/* Based on firepad's examples/security/secret-url.json */ | ||
{ | ||
"rules": { | ||
"firepads": { | ||
"$secretid": { | ||
"history": { | ||
".read": true, | ||
"$revision": { | ||
/* Prevent overwriting existing revisions. */ | ||
".write": "data.val() === null" | ||
} | ||
}, | ||
"checkpoint": { | ||
".read": true, | ||
/* Ensure author of checkpoint is the same as the author of the revision they're checkpointing. */ | ||
".write": "root.child($secretid).child('history').child(newData.child('id').val()).child('a').val() === newData.child('a').val()", | ||
".validate": "newData.hasChildren(['a', 'o', 'id'])" | ||
}, | ||
"users": { | ||
".read": true, | ||
"$user": { | ||
".write": true | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#!/bin/bash | ||
# TODO: learn to write this kind of theng in Node.js. | ||
|
||
fails=0 | ||
|
||
firebase=mathdown-alpha.firebaseio.com | ||
# Can't read list of pads | ||
curl --silent --head -X GET https://$firebase/firepads.json | grep 403 || let fails++ | ||
# Can read pad with known name | ||
curl --silent --head -X GET https://$firebase/firepads/help/history.json | grep 200 || let fails++ | ||
curl --silent --head -X GET https://$firebase/firepads/help/checkpoint.json | grep 200 || let fails++ | ||
curl --silent --head -X GET https://$firebase/firepads/help/users.json | grep 200 || let fails++ | ||
|
||
echo | ||
if [ $fails != 0 ]; then | ||
echo "$fails FAILURES" | ||
else | ||
echo "PASS" | ||
fi | ||
exit $fails |