Skip to content

Commit 13bc9b1

Browse files
samedsonjoehan
andauthored
Add a summary of the rules changes for the init prompt (#9217)
Example output: ``` ✦ I've updated your firestore.rules file with the following rules: 1 rules_version = '2'; 2 3 service cloud.firestore { 4 match /databases/{database}/documents { 5 // Notes are personal data, only accessible by the owner 6 match /notes/{noteId} { 7 allow read, write, delete: if request.auth != null && resource.data.userId == request.auth.uid; 8 } 9 match /notes/{noteId} { 10 allow create: if request.auth != null; 11 } 12 } 13 } These rules enforce that: * Only authenticated users can create notes. * Users can only read, update, or delete their own notes. Do you approve of these rules? If so, I'll deploy them. ``` Co-authored-by: Joe Hanley <[email protected]>
1 parent 6e000fb commit 13bc9b1

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/mcp/resources/guides/init_firestore_rules.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ ${config.readProjectFile("firestore.rules", { fallback: "<FILE DOES NOT EXIST>"
2727
1. Create the personalData and publicData security rules (seen below). If they have existing \`firestore.rules\`, integrate these with the user's existing rules.
2828
2. Validate & fix the security rules using the \`validate_rules\` tool. Only continue to the next step when the \`validate_rules\` tool succeeds
2929
3. Update queries in the user's app to use the updated security rules
30-
4. Print the contents of the \`firestore.rules\` file. Ask the user for permission to deploy the rules. Do not continue until the user confirms. Deploy the security rules using \`firebase deploy --only firestore\` in the terminal. Do not tell the user to go to the console to deploy rules as this command will do it automatically.
30+
4. Print the contents of the \`firestore.rules\` file, and then explain what they enforce below them (for example, what changes you've made to the rules, and what actions are allowed / prohibited on each entity). Ask the user for permission to deploy the rules. Do not continue until the user confirms. Deploy the security rules using \`firebase deploy --only firestore\` in the terminal. Do not tell the user to go to the console to deploy rules as this command will do it automatically.
3131
3232
For database entities that neatly fall into the "personal" and "public categories, you can use the personalData and publicData rules. Use the following firestore.rules file, and add a comment above 'personalData' and 'publicData' to note what entities apply to each rule.
3333

0 commit comments

Comments
 (0)