How to Integrate Hex and Firestore Safely
Teams pair hex and firestore to analyze live document data inside collaborative notebooks. Analysts run Python scripts to pull records and build visual charts for business users. This workflow turns raw operational documents into clear tables and charts. Data teams can explore app state and user trends without waiting on slow warehouse loads. Yet linking a shared notebook workspace to a live document store brings real security risks. How hex and firestore exchange data and permissions Hex do
Your coding agents run with your access.
Claude Code reaches prod with a developer's credentials, and approval prompts get clicked through. hoop.dev checks every query, masks sensitive data, and holds risky changes for a human.
Teams pair hex and firestore to analyze live document data inside collaborative notebooks. Analysts run Python scripts to pull records and build visual charts for business users.
This workflow turns raw operational documents into clear tables and charts. Data teams can explore app state and user trends without waiting on slow warehouse loads. Yet linking a shared notebook workspace to a live document store brings real security risks.
How hex and firestore exchange data and permissions
Hex does not use a standard SQL driver to read Google Cloud document stores. Instead, users load the official Google Cloud Python client inside a notebook cell. The notebook uses a cloud service account key to log in and fetch documents.
Admins store this JSON key as a secret variable inside the workspace project. When a user runs a cell, the Python client reads the secret and calls the database. The script pulls nested JSON documents and converts them into flat data frames.
From there, analysts can join the document data with tables from a cloud warehouse. They can also publish the notebook as an interactive data app for other teams. Every time the app runs, the workspace uses that same service account to read records.
This setup makes data work fast, but it ties every query to one static identity. The database sees the workspace service account, not the individual analyst who clicked run.
Common security gaps in notebook database links
The biggest risk comes from broad cloud roles attached to the service account. Teams often grant editor or owner roles just to make the connection work fast. If a notebook user writes a script that updates or deletes records, production data breaks.
Shared secret keys also create blind spots across the data team. When ten analysts share one project secret, audit logs only show one service account name. Security teams cannot tell which user pulled sensitive records or ran a heavy read job.
End-to-End Encryption: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
Another common issue is pulling unmasked personal data into notebook memory. Document collections often hold user emails, phone numbers, card numbers, or national IDs. Once a script loads those fields into a data frame, they can leak into charts. Anyone viewing the published data app might see private customer fields by mistake.
Unbounded queries also hurt database speed and drive up cloud bills. A notebook script that scans an entire collection without filters reads millions of documents. Because document stores bill by read count, one bad loop can cost a lot.
Scoping roles and network paths for safer analysis
Start by creating a dedicated cloud service account just for notebook read tasks. Grant this account a read-only role so scripts can never write or delete documents. Never reuse a service account that already runs your live backend apps.
Next, separate sensitive collections from analytics collections at the project level. If a collection holds card numbers or national IDs, keep it out of reach. You can also sync clean fields into a separate reporting collection for notebook users.
Rotate your service account keys on a strict schedule and remove old keys right away. Limit which workspace users can edit project secrets or view raw connection variables. Finally, check your cloud audit logs each week to spot strange read spikes early.
Add runtime guardrails and masking beside your databases and APIs
Login rules, role grants, and CI checks govern who connects to your stack. Yet any allowed script, engineer, or AI agent still runs commands with the full scope of its role. For workloads on Postgres, MySQL, SQL Server, MongoDB, ClickHouse, Kubernetes, SSH, or internal HTTP services, hoop.dev sits beside the service as an open-source proxy, a sidecar for your database or API.
Before a query runs, hoop.dev guardrails check the statement against your rules. An AI Analyzer you configure can score intent or hold risky calls for human review. Next, hoop.dev data masking rewrites sensitive fields in responses, and each verdict is logged per listener. Explore the MIT-licensed project on GitHub.
Frequently asked questions
Can Hex query Firestore using standard SQL cells?
No, it connects through a Python cell using the Google Cloud client library. Once the Python script loads documents into a data frame, SQL cells can query that frame.
What role should the Google Cloud service account have?
Use a read-only role that only permits viewing documents and collections. Never attach roles that allow creating, updating, or deleting live production records.
How do we protect personal data in document collections?
Restrict the service account from reading collections with raw emails, phone numbers, or card numbers. You can also mask matched fields in results before the data reaches the notebook.
Related guides
In this post