roles/recommender.firestoredatabasefirebaserulesViewerautorizzazioni, più recommender.firestoreDatabaseFirebaseRulesRecommendations.update recommender.firestoreDatabaseFirebaseRulesInsights.update
Per saperne di più sui ruoli e sulla concessione dell'accesso, consulta le seguenti risorse:
Puoi visualizzare i suggerimenti per le regole di sicurezza di Firestore solo se hai configurato database non vuoti e in uso con regole esposte a un ampio accesso. Il progetto
deve essere attivo da almeno 30 giorni per poter generare consigli.
Puoi visualizzare i suggerimenti/gli approfondimenti sulle regole di sicurezza di Firestore in diversi modi:
Visualizza i suggerimenti
Console Google Cloud
Per visualizzare i consigli, procedi nel seguente modo:
Vai alla console Google Cloud o utilizza il pulsante seguente:
I consigli possono essere visualizzati nella pagina Hub dei suggerimenti o Database Center.
Cerca Consigli per accedere alla pagina dell'hub dei suggerimenti.
Puoi selezionare una categoria specifica di consigli e visualizzarli.
Cerca Database Center.
Puoi applicare il filtro dei prodotti e visualizzare i problemi specifici della flotta.
Interfaccia a riga di comando gcloud
Per elencare i suggerimenti per le regole di sicurezza di Firestore utilizzando gcloud, esegui il comando
gcloud recommender recommendations list
come segue:
I suggerimenti e gli approfondimenti sulle regole di sicurezza di Firestore sono
disponibili senza costi. Per informazioni sugli altri livelli di prezzo, consulta la sezione
Prezzi di Recommender.
[[["Facile da capire","easyToUnderstand","thumb-up"],["Il problema è stato risolto","solvedMyProblem","thumb-up"],["Altra","otherUp","thumb-up"]],[["Difficile da capire","hardToUnderstand","thumb-down"],["Informazioni o codice di esempio errati","incorrectInformationOrSampleCode","thumb-down"],["Mancano le informazioni o gli esempi di cui ho bisogno","missingTheInformationSamplesINeed","thumb-down"],["Problema di traduzione","translationIssue","thumb-down"],["Altra","otherDown","thumb-down"]],["Ultimo aggiornamento 2025-09-04 UTC."],[],[],null,["# Firestore Security Rules recommender\n====================================\n\nThe Firestore Security Rules recommender supports the following recommendation subtype:\n\n- [Update Insecure Policy](/firestore/docs/security/insecure-rules)\n\nwhich are security concerns for Firestore customers providing users\nextra access than the users intend.\n\nThis document describes how to enable and view your recommendations\nand insights to improve the security of your databases.\n\nBefore you begin\n----------------\n\nBefore you can view Firestore Firestore Security rules\nrecommendations and insights, do the following:\n\n1. Enable the Recommender API as described in\n [Enable the API](/recommender/docs/enabling).\n\n2. Ensure that you have sufficient permissions.\n You must have one of the following roles, which provide the necessary\n permissions:\n\n\n \u003cbr /\u003e\n\n These Recommender roles provide the following API permissions:\n\n\n \u003cbr /\u003e\n\n For more information about roles and about granting access, see the\n following:\n - [Understanding roles](/iam/docs/understanding-roles)\n - [Managing access to projects, folders, and organizations](/iam/docs/granting-changing-revoking-access)\n\nYou can view Firestore Security rules recommendations only if you have non-empty, in-use databases that have any rules exposed to broad access configured. The project\nmust be at least 30 days old for recommendations to be generated for it.\n\nYou can view Firestore Security rules recommendations/insights in different ways:\n\nView recommendations\n--------------------\n\n### Google Cloud console\n\n\nYou can view your recommendations by doing following:\n\nGo to the Google Cloud console, or use the following button:\n\n[Go to Google Cloud console](https://console.cloud.google.com/)\n\nRecommendations can be viewed on **Recommendation Hub** or **Database Center** page.\n\n1. Search for **Recommendations** which will lead to the Recommendation Hub page.\n You can select specific category of recommendation and view them.\n\n2. Search for **Database Center**.\n You can apply product filter and view the specific fleet issues.\n\n\u003cbr /\u003e\n\n### gcloud CLI\n\n\nTo list Firestore Security rules recommendations by using `gcloud`, run the\n[`gcloud recommender recommendations list`](/sdk/gcloud/reference/recommender/recommendations/list)\ncommand as follows: \n\n gcloud recommender recommendations list \\\n --project=\u003cvar translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-n\"\u003ePROJECT_ID\u003c/span\u003e\u003c/var\u003e \\\n --location=\u003cvar translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-n\"\u003eLOCATION\u003c/span\u003e\u003c/var\u003e \\\n --recommender=google.firestore.database.\u003cvar\u003eRECOMMENDER\u003c/var\u003e\n\nReplace the following:\n\n- \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e: Your project ID\n- \u003cvar translate=\"no\"\u003eLOCATION\u003c/var\u003e: A region, such as `us-central1`\n- \u003cvar translate=\"no\"\u003eRECOMMENDER\u003c/var\u003e: The ID of the recommender as `FirebaseRulesRecommender`.\n\n\u003cbr /\u003e\n\n### Recommender API\n\n\nTo list your Firestore Security rules recommendations by using the\n[Recommendations API](/recommender/docs/using-api), call the\n[`recommendations.list`](/recommender/docs/reference/rest/v1beta1/projects.locations.recommenders.recommendations/list)\nmethod as follows: \n\n curl -H \"Authorization: Bearer $(gcloud auth print-access-token)\" \\\n -H \"x-goog-user-project: \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e\" \\\n \"https://recommender.googleapis.com/v1/projects/\u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e/locations/\u003cvar translate=\"no\"\u003eLOCATION\u003c/var\u003e/recommenders/google.firestore.database.\u003cvar translate=\"no\"\u003eRECOMMENDER\u003c/var\u003e/recommendations\"\n\nReplace the following:\n\n- \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e: Your project ID.\n- \u003cvar translate=\"no\"\u003eLOCATION\u003c/var\u003e: A region, such as `us-central1`.\n- \u003cvar translate=\"no\"\u003eRECOMMENDER\u003c/var\u003e: The ID of the recommender as `FirebaseRulesRecommender`.\n\nFor more information, see [Using the API - Recommendations](/recommender/docs/using-api).\n\nView insights\n-------------\n\nYou can view insights and detailed recommendations about Firestore Security\nrules in different ways. \n\n### gcloud CLI\n\n\nTo view insights by using `gcloud`, run the\n[`gcloud recommender insights list`](/sdk/gcloud/reference/recommender/insights/list)\ncommand as follows: \n\n gcloud recommender insights list \\\n --project=\u003cvar translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-nx\"\u003ePROJECT_ID\u003c/span\u003e\u003c/var\u003e \\\n --location=\u003cvar translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-nx\"\u003eLOCATION\u003c/span\u003e\u003c/var\u003e \\\n --insight-type=google.firestore.database.\u003cvar translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-nx\"\u003eINSIGHT_TYPE\u003c/span\u003e\u003c/var\u003e\n\nReplace the following:\n\n- \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e: Your project ID.\n- \u003cvar translate=\"no\"\u003eLOCATION\u003c/var\u003e: A region, such as `us-central1`.\n- \u003cvar translate=\"no\"\u003eINSIGHT_TYPE\u003c/var\u003e: The ID of the insight type as `FirebaseRulesInsight`.\n\n \u003cbr /\u003e\n\n### Recommender API\n\n\nTo list your insights by using the\nRecommender API, run the following command: \n\n curl -H \"Authorization: Bearer $(gcloud auth print-access-token)\" \\\n\n \"https://recommender.googleapis.com/v1/projects/\u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e/locations/\u003cvar translate=\"no\"\u003eLOCATION\u003c/var\u003e/insightTypes/google.firestore.database.\u003cvar translate=\"no\"\u003eINSIGHT_TYPE\u003c/var\u003e/insights\"\n\nReplace the following:\n\n- \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e: Your project ID.\n- \u003cvar translate=\"no\"\u003eLOCATION\u003c/var\u003e: A region, such as `us-central1`.\n- \u003cvar translate=\"no\"\u003eINSIGHT_TYPE\u003c/var\u003e: The ID of the insight type as `FirebaseRulesInsight`.\n\nFor more information, see [Using the API - Insights](/recommender/docs/insights/using-api).\n\n\u003cbr /\u003e\n\nApply recommendations\n---------------------\n\nFor more information about how to improve your database security, see\n[Structure security rules](/firestore/docs/security/rules-structure).\n\nPricing\n-------\n\nFirestore Security rules recommendations and insights are\navailable free of charge. For information about other pricing tiers, see\n[Recommender pricing](/recommender/pricing)."]]