Cortex Database

Published
Length
3 min read

Luis Felipe Dias

All posts

You set up a cortex database by creating scoped roles and granting table permissions. You then link your app or AI tool to that database role. Many teams start by sharing one broad admin role across their whole team. That fast setup gives every user and bot full read and write power. One bad query or prompt can expose private rows or change live tables. How a cortex database role setup works A cortex database stores your core data or powers your AI search tasks. Native database security relie

Database Access Proxy + Cortex Security: the complete guide

Architecture patterns, implementation strategies, and security best practices. Delivered to your inbox.

Free white paper. No spam. Unsubscribe anytime.

You set up a cortex database by creating scoped roles and granting table permissions. You then link your app or AI tool to that database role. Many teams start by sharing one broad admin role across their whole team. That fast setup gives every user and bot full read and write power. One bad query or prompt can expose private rows or change live tables.

How a cortex database role setup works

A cortex database stores your core data or powers your AI search tasks. Native database security relies on users, roles, and object grants. First, an admin creates a role for a specific job or app. Next, the admin grants that role read or write rules on chosen schemas. Finally, the admin assigns the role to a human user or service account.

When a user logs in, the database checks their key or password. Once inside, the session inherits every permission tied to that active role. If you use Snowflake for your data warehouse, you assign a role for Cortex functions. That role lets the session run models and read source tables at the same time. The database engine checks permissions at the object level before running the task.

Teams often group permissions into reader roles, writer roles, and admin roles. Reader roles can pull rows from tables and views for reports. Writer roles can add new rows, update records, or delete old entries. Admin roles can create tables, drop schemas, and change grants for other people. Keeping these roles separate is the first step in basic database safety.

Why native roles leave gaps during live queries

Native roles do a good job of deciding who can log in. They also control which tables a role can read or update. Still, native grants are static and apply to the whole session at once. Once a session starts, the database allows any query that matches the role grants. The native setup cannot judge the context of each query in flight.

For example, a support engineer might need to read a customer table today. A standard read grant lets that engineer pull one row or ten million rows. That same read grant returns raw emails, phone numbers, card numbers, and national IDs. If an AI agent uses that role, those sensitive fields go into the model prompt. Dynamic data masking rewrites matched fields in results before they reach the user or model.

Database Access Proxy + Cortex Security: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Static roles also make it hard to manage temporary production fixes. When an engineer needs to fix one broken row, they often get a permanent write role. That role stays active long after the ticket closes. If a script runs a bad update later, the database allows the change. Teams need a way to approve single queries and mask fields in real time.

Best practices for safer database workflows

Start by removing shared admin keys from your team apps and scripts. Give every person and service account its own unique login identity. Group your tables by sensitivity so public data stays away from private records. Grant read rules only on the exact views a workflow needs to run.

Next, review how your team runs ad hoc queries against live data. Replace standing write grants with a step that requires peer review before execution. Make sure every query log ties back to a real person, not a shared role. Add field masking so queries rewrite emails, phone numbers, and card numbers in results.

Govern statements and responses across databases and APIs

Good config and scoped roles are needed setup. They do not check single queries in flight or mask sensitive fields in returned rows. Across Postgres, MySQL, SQL Server, MongoDB, ClickHouse, Kubernetes APIs, SSH, and internal HTTP endpoints, hoop.dev runs beside each supported service as an open-source proxy, a sidecar for your database or API.

First, hoop.dev guardrails block banned queries before they run. Then hoop.dev data masking rewrites matched sensitive values in responses in memory. The audit trail records every statement and verdict per resource. Furthermore, hoop.dev holds SOC 2 Type II and is open source on GitHub.

Frequently asked questions

What is a cortex database used for?

Teams use it to store structured records, metrics, or vector data for AI apps. It lets users and models search data and run analytics in one place.

Why are static database roles risky for AI tools?

AI tools generate queries on the fly based on user prompts. If the tool has a broad role, it can pull private fields into prompts.

How does data masking protect sensitive fields in query results?

Masking inspects query results in flight and rewrites emails, phone numbers, and card numbers. The query still runs, but sensitive values are replaced before the client reads them.

Save the open-source gateway.

hoop is MIT-licensed infrastructure for controlling how AI agents reach production data. Star hoophq/hoop so you can inspect it, deploy it, or share it when your team starts governing agent access.