Neo4j Access Control

Published
Length
3 min read

Luis Felipe Dias

All posts

Neo4j access control uses roles and rules to limit who reads and writes graph data. Admins assign users to roles that allow or deny actions on nodes and links. Most teams start by giving devs broad admin roles to move fast. Broad roles let one bad query delete nodes or expose private user data. How built-in neo4j access control works The graph database manages security through its own system database. Every user account links to one or more custom or built-in roles. Each role holds a list of

Role-Based Access Control (RBAC): the complete guide

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

Free white paper. No spam. Unsubscribe anytime.

Neo4j access control uses roles and rules to limit who reads and writes graph data. Admins assign users to roles that allow or deny actions on nodes and links. Most teams start by giving devs broad admin roles to move fast. Broad roles let one bad query delete nodes or expose private user data.

How built-in neo4j access control works

The graph database manages security through its own system database. Every user account links to one or more custom or built-in roles. Each role holds a list of rules for graph actions and admin tasks. Rules can target the whole database, specific node labels, or link types. You can also set rules down to single property keys on nodes.

When a user logs in, the system checks their assigned roles first. As the user runs a query, the engine checks every rule in memory. A rule can grant read, traverse, or write rights to the user. Traverse rights let a user walk across the graph without reading properties. Read rights let the user see the actual values inside those properties. Write rights let the user add, change, or delete graph items.

Admins can also set deny rules to block access to sensitive items. In this system, a deny rule always beats a grant rule. If a role denies read rights on a key, that key stays hidden. The query still runs, but the blocked value returns as null instead. Teams can link these roles to external identity tools for group login.

How to set up roles for graph teams

Start by breaking your team into clear groups based on daily work. Data readers only need to traverse nodes and read safe property keys. App accounts need to write new nodes and update links in one graph. Database admins need rights to manage users, roles, and index rules. Never share one master account across your devs and background apps.

Build custom roles that start with zero rights by default. Add traverse rules first so users can walk the graph paths. Next, add read rules for the exact node labels each group needs. Use deny rules on property keys that hold emails or card numbers. Test every new role with a test user before giving it to devs. Check the system logs often to spot failed login tries or denied queries.

Role-Based Access Control (RBAC): architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

What native roles solve and what they miss

Native roles do a good job of sorting users into stable groups. They keep read-only analysts from dropping indexes or deleting core graph data. Deny rules help hide whole property keys from broad groups of users. Linking roles to external identity groups also cuts down on manual user setup.

Still, static database roles only check who logs into the session. They do not inspect the context of a live query in flight. If an engineer needs temporary write rights, admins must edit roles by hand. People often forget to remove those extra rights after the fix is done. Static roles also struggle when you want to mask only part of a field. If a dev has read rights on a key, they get the raw text. Rewriting matched emails or phone numbers in query results requires extra runtime checks.

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

What is the difference between traverse and read rights in a graph?

Traverse rights let a query find and walk through nodes and links. Read rights let the user see the data stored inside node properties. A user can traverse a node without seeing its secret property values.

How do deny rules work with grant rules in graph roles?

A deny rule always overrides a grant rule on the same graph item. If one role grants read access and another denies it, access fails. This helps admins block sensitive properties even when users hold multiple roles.

Why are static roles hard to manage for live incident fixes?

Static roles stay active until an admin removes them by hand. During an outage, teams often grant broad write rights to fix bad data. Without auto-expiring rules, those wide rights keeps the session active long after the fix.

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.