[codex] Add Firebase database rules#3
Merged
Conversation
jody
marked this pull request as ready for review
June 14, 2026 19:39
Contributor
Author
|
I discovered errors with the set of proposed firebase-rules, which warranted adding a CI step to validate future proposed changes. |
There was a problem hiding this comment.
Pull request overview
This PR adds a Firebase Realtime Database rules file to the repository (as referenced by the setup guide), wires it into Firebase CLI config, and adds CI validation steps so rule syntax is checked on every push/PR.
Changes:
- Add
firebase-rules.jsonwith default-deny rules plus per-path read/write/validate constraints. - Add
firebase.jsonto point Firebase tooling/emulators atfirebase-rules.json. - Add npm scripts + a GitHub Actions workflow to validate the rules JSON and run the Firebase Database emulator, and update README to link to the rules file.
Reviewed changes
Copilot reviewed 5 out of 6 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| README.md | Links Step 7 directly to the committed rules file for easier setup. |
| package.json | Adds scripts to validate the rules JSON and start the database emulator in CI. |
| firebase.json | Configures Firebase tooling to load RTDB rules from firebase-rules.json. |
| firebase-rules.json | Introduces RTDB rules (default deny, auth-gated reads, and shape validation). |
| .gitignore | Ignores RTDB emulator debug log output. |
| .github/workflows/ci.yml | Adds CI job to validate rules and build the app. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Contributor
Author
|
Two concerns raised by Copilot that would have resulted in runtime errors have been addressed. |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Comment on lines
+13
to
+15
| "activePoll": { | ||
| ".write": "auth != null && (!newData.exists() || (newData.hasChildren(['id', 'question', 'options', 'duration', 'resultPolicy', 'correctPolicy', 'startedAt', 'ended', 'revealResults', 'revealCorrect']) && newData.child('id').isString() && newData.child('question').isString() && newData.child('options').hasChildren() && newData.child('duration').isNumber() && newData.child('duration').val() >= 1 && newData.child('duration').val() <= 3600 && newData.child('resultPolicy').isString() && newData.child('correctPolicy').isString() && newData.child('startedAt').isNumber() && newData.child('ended').isBoolean() && newData.child('revealResults').isBoolean() && newData.child('revealCorrect').isBoolean()))", | ||
| "responses": { |
Comment on lines
+21
to
+24
| "queue": { | ||
| ".write": "auth != null", | ||
| ".validate": "!newData.exists() || (newData.hasChildren(['setId', 'setName', 'currentIndex', 'totalPolls', 'sessionKey']) && newData.child('setId').isString() && newData.child('setName').isString() && newData.child('currentIndex').isNumber() && newData.child('totalPolls').isNumber() && newData.child('sessionKey').isString())" | ||
| } |
Comment on lines
+40
to
+45
| "pollSets": { | ||
| ".read": "auth != null", | ||
| "$set": { | ||
| ".write": "auth != null", | ||
| ".validate": "!newData.exists() || (newData.hasChildren(['id', 'name', 'createdAt', 'defaults']) && newData.child('id').isString() && newData.child('name').isString() && newData.child('createdAt').isNumber())" | ||
| } |
Comment on lines
+7
to
+11
| "students": { | ||
| "$student": { | ||
| ".write": "auth != null && (!newData.exists() || (newData.hasChildren(['joinedAt', 'date']) && newData.child('date').isString()))", | ||
| ".validate": "!newData.exists() || (newData.hasChildren(['joinedAt', 'date']) && (newData.child('joinedAt').isNumber() || newData.child('joinedAt/.sv').val() == 'timestamp') && newData.child('date').isString())" | ||
| } |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds the Firebase Realtime Database rules file referenced by the setup guide and links to it from the README setup step.
Details
firebase-rules.jsonwith locked root defaults, authenticated-only database access, and basic shape validation for the app's session, poll, history, attendance, and poll set data.firebase-rules.json.Validation
firebase-rules.jsonas valid JSON.npm run buildsuccessfully.