Skip to content

[codex] Add Firebase database rules#3

Merged
jody merged 12 commits into
mainfrom
codex/add-firebase-database-rules
Jun 14, 2026
Merged

[codex] Add Firebase database rules#3
jody merged 12 commits into
mainfrom
codex/add-firebase-database-rules

Conversation

@jody

@jody jody commented Jun 14, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds the Firebase Realtime Database rules file referenced by the setup guide and links to it from the README setup step.

Details

  • Adds firebase-rules.json with locked root defaults, authenticated-only database access, and basic shape validation for the app's session, poll, history, attendance, and poll set data.
  • Updates README Step 7 to link directly to firebase-rules.json.

Validation

  • Parsed firebase-rules.json as valid JSON.
  • Ran npm run build successfully.

@jody jody self-assigned this Jun 14, 2026
@jody
jody marked this pull request as ready for review June 14, 2026 19:39
@jody

jody commented Jun 14, 2026

Copy link
Copy Markdown
Contributor Author

I discovered errors with the set of proposed firebase-rules, which warranted adding a CI step to validate future proposed changes.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.json with default-deny rules plus per-path read/write/validate constraints.
  • Add firebase.json to point Firebase tooling/emulators at firebase-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.

Comment thread firebase-rules.json
Comment thread firebase-rules.json
Comment thread firebase-rules.json
@jody

jody commented Jun 14, 2026

Copy link
Copy Markdown
Contributor Author

Two concerns raised by Copilot that would have resulted in runtime errors have been addressed.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 6 out of 7 changed files in this pull request and generated 3 comments.

Comment thread scripts/validateFirebaseRules.mjs Outdated
Comment thread firebase-rules.json
Comment thread firebase-rules.json
jody and others added 6 commits June 14, 2026 14:23
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>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 6 out of 7 changed files in this pull request and generated 5 comments.

Comment thread firebase-rules.json
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 thread firebase-rules.json Outdated
Comment thread firebase-rules.json
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 thread firebase-rules.json
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 thread firebase-rules.json
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())"
}
jody and others added 2 commits June 14, 2026 15:16
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@jody
jody merged commit 4273388 into main Jun 14, 2026
1 check passed
@jody
jody deleted the codex/add-firebase-database-rules branch June 14, 2026 21:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants