/neo4j-skills:neo4j-security-skillfrom neo4j-skills
Manages Neo4j security programmatically via Cypher on the system database: RBAC/ABAC, user lifecycle, role lifecycle, privilege grants/denies/revokes, property-level and sub-graph access control, SHOW PRIVILEGES, and auth provider config (LDAP, OIDC/SSO). Requires Enterprise Edition for property-level security and ABAC.
Ships in neo4j-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
SHOW PRIVILEGES)neo4j-cypher-skillneo4j-cli-tools-skillneo4j-driver-*-skillBefore executing ANY of the following, show the planned command and wait for explicit confirmation:
CREATE USER / ALTER USER / DROP USERCREATE ROLE / DROP ROLEGRANT / DENY / REVOKE (any privilege)CREATE AUTH RULE / DROP AUTH RULENever auto-execute privilege changes. Show exact Cypher, annotate impact, get "yes".
All security Cypher runs against the system database:
// Neo4j auto-routes CREATE/ALTER/SHOW USER|ROLE|PRIVILEGE to system
// If using cypher-shell: cypher-shell -d system
// If using driver: use database="system"
CREATE USER alice SET PASSWORD 'change-me-2026' CHANGE NOT REQUIRED;
// min length 8 by default (dbms.security.auth_minimum_password_length); shorter → error 22N85
// CHANGE REQUIRED (default): forces password change on first login
// CHANGE NOT REQUIRED: password valid immediately
// SET STATUS ACTIVE (default) | SUSPENDED [Enterprise]
Community: users only — CREATE USER ... SET PASSWORD, ALTER USER ... SET PASSWORD, DROP USER, SHOW USERS work. SET STATUS, SET HOME DATABASE, tags, ALTER USERS, and all role/privilege commands fail with "not supported in community edition".
CREATE USER $username SET PASSWORD $password CHANGE NOT REQUIRED;
Password minimum rises 8 → 16 chars — Aura with 2027.01 upgrade (Jan 2027); self-managed default after 2026 LTS unless dbms.security.auth_minimum_password_length set explicitly. Enforced on new users and password change/reset only; existing passwords keep working. Generate ≥16-char passwords in provisioning scripts now.
ALTER USER alice SET PASSWORD $newPw CHANGE NOT REQUIRED;
ALTER USER alice SET STATUS SUSPENDED; // lock account [Enterprise]
ALTER USER alice SET STATUS ACTIVE; // unlock [Enterprise]
ALTER USER alice SET HOME DATABASE mydb; // default db on connect [Enterprise]
ALTER USER alice IF EXISTS SET PASSWORD $pw; // safe if missing
Tags are arbitrary strings on the native user object, readable in ABAC rules via abac.native.user_tags().
CREATE USER jake SET PASSWORD $pw SET TAGS ['finance', 'auditor']; // single STRING, LIST<STRING> or parameter — never comma-separated strings
ALTER USER jake REMOVE TAG 'auditor' ADD TAG 'on-call'; // REMOVE before ADD before SET
ALTER USER jake SET TAGS ['finance', 'auditor']; // replaces all existing tags
ALTER USER jake REMOVE ALL TAGS;
ALTER USERS jake, alice ADD TAGS 'pii-access'; // bulk tag edit
SET/ADD/REMOVE TAG[S] requires SET USER METADATA; reading tag values requires SHOW USER METADATA:
GRANT SET USER METADATA ON DBMS TO userAdmin;
GRANT SHOW USER METADATA ON DBMS TO auditor;
GRANT USER METADATA MANAGEMENT ON DBMS TO userManager; // both of the above
SHOW USERS YIELD user, roles, passwordChangeRequired, suspended, home
WHERE suspended = false
RETURN user, roles ORDER BY user;
// Community: suspended and roles are null → this WHERE returns no rows
// tags column returns null without SHOW USER METADATA [2026.06+]
SHOW USERS YIELD user, roles, tags;
// runnable CREATE USER commands for the whole DBMS [2026.09]
// requires SHOW USER + SHOW USER CREDENTIALS; tags omitted without SHOW USER METADATA
SHOW USERS AS COMMANDS;
SHOW USERS WITH AUTH AS COMMANDS; // adds provider + auth columns
// caller identity combined with other system-db SHOW commands [2026.10, Cypher 25]
USE system
SHOW CURRENT USER YIELD user, home
SHOW DATABASES YIELD name, aliases
WHERE name = home
RETURN user, name AS database, aliases;
Combined SHOW CURRENT USER query: every clause must be allowed on system (no MATCH, SHOW INDEXES) — run graph reads as separate query.
Both SHOW USERS AS COMMANDS and SHOW USERS WITH AUTH AS COMMANDS expose password hashes (SET ENCRYPTED PASSWORD '1,<hash>,<salt>' in every command); WITH AUTH adds provider/auth columns and one row per auth provider. Use either only for secured backup/restore handling. Never paste auth-export output into plaintext docs, logs, tickets, or source control.
DROP USER alice IF EXISTS;
CREATE ROLE analyst;
CREATE ROLE analyst IF NOT EXISTS;
DROP ROLE analyst IF EXISTS;
GRANT ROLE analyst TO alice;
GRANT ROLE analyst, writer TO alice, bob; // bulk
REVOKE ROLE analyst FROM alice;
SHOW ROLES WITH USERS YIELD role, member ORDER BY role; // member exists only WITH USERS
SHOW ROLE analyst PRIVILEGES AS COMMANDS; // returns runnable GRANT commands
SHOW POPULATED ROLES YIELD role; // only roles with members
// runnable CREATE ROLE commands for the whole DBMS [2026.09]
SHOW ROLES AS COMMANDS;
SHOW ROLES WITH USERS AS COMMANDS; // adds GRANT ROLE ... TO user
SHOW ROLES WITH AUTH RULES AS COMMANDS; // adds GRANT ROLE ... TO AUTH RULE
| Goal | Command |
|---|---|
| Allow db connection | GRANT ACCESS ON DATABASE mydb TO analyst |
| Read all graph data | GRANT MATCH {*} ON GRAPH mydb ELEMENTS * TO analyst |
| Read specific label | GRANT MATCH {*} ON GRAPH mydb NODES Person TO analyst |
| Read specific rel type | GRANT MATCH {*} ON GRAPH mydb RELATIONSHIPS KNOWS TO analyst |
| Read one property | GRANT READ {email} ON GRAPH mydb NODES Person TO analyst |
| Traverse but hide properties | GRANT TRAVERSE ON GRAPH mydb NODES Person TO analyst |
| Write (create/set) | GRANT WRITE ON GRAPH mydb TO writer |
| Create nodes only | GRANT CREATE ON GRAPH mydb NODES Person TO writer |
| Delete nodes only | GRANT DELETE ON GRAPH mydb NODES Person TO writer |
| Execute procedure | GRANT EXECUTE PROCEDURE apoc.* ON DBMS TO analyst |
| Execute function | GRANT EXECUTE USER DEFINED FUNCTION apoc.* ON DBMS TO analyst |
| All on one db | GRANT ALL ON DATABASE mydb TO dba |
| Full DBMS admin | GRANT ALL ON DBMS TO dba |
| Manage users | GRANT USER MANAGEMENT ON DBMS TO secadmin |
| Manage user tags [2026.06] | GRANT USER METADATA MANAGEMENT ON DBMS TO secadmin |
| Manage roles | GRANT ROLE MANAGEMENT ON DBMS TO secadmin |
| Schema changes | GRANT NAME MANAGEMENT ON DATABASE mydb TO schemaadmin (or CREATE NEW NODE LABEL / CREATE NEW RELATIONSHIP TYPE / CREATE NEW PROPERTY NAME) |
// Analyst can read Person but NOT the ssn property
GRANT MATCH {*} ON GRAPH mydb NODES Person TO analyst;
DENY READ {ssn} ON GRAPH mydb NODES Person TO analyst;
REVOKE GRANT READ {email} ON GRAPH mydb NODES Person FROM analyst;
REVOKE DENY READ {ssn} ON GRAPH mydb NODES Person FROM analyst;
REVOKE MATCH {*} ON GRAPH mydb NODES Person FROM analyst; // removes both grant+deny
CREATE ROLE analyst IF NOT EXISTS;
GRANT ACCESS ON DATABASE mydb TO analyst;
GRANT MATCH {*} ON GRAPH mydb ELEMENTS * TO analyst;
GRANT EXECUTE PROCEDURE apoc.* ON DBMS TO analyst;
CREATE ROLE writer IF NOT EXISTS;
GRANT ACCESS ON DATABASE mydb TO writer;
GRANT MATCH {*} ON GRAPH mydb ELEMENTS * TO writer;
GRANT WRITE ON GRAPH mydb TO writer;
CREATE ROLE limited_reader IF NOT EXISTS;
GRANT ACCESS ON DATABASE mydb TO limited_reader;
GRANT TRAVERSE ON GRAPH mydb ELEMENTS * TO limited_reader; // can traverse
GRANT MATCH {*} ON GRAPH mydb NODES Person TO limited_reader; // Person props visible
GRANT MATCH {*} ON GRAPH mydb NODES Company TO limited_reader; // Company props visible
// Other labels: traversable but properties invisible
CREATE ROLE dba IF NOT EXISTS;
GRANT ALL ON DBMS TO dba;
GRANT ALL ON DATABASE * TO dba;
Restrict read access to individual properties:
// Grant read on all Person props, then deny sensitive ones
GRANT MATCH {*} ON GRAPH mydb NODES Person TO analyst;
DENY READ {ssn, dateOfBirth} ON GRAPH mydb NODES Person TO analyst;
Property-based pattern matching (sub-graph access):
// Only see Person nodes where classification = 'public'
GRANT MATCH {*} ON GRAPH mydb
FOR (n:Person) WHERE n.classification = 'public'
TO analyst;
// Block access to classified nodes
DENY MATCH {*} ON GRAPH mydb
FOR (n) WHERE n.classification <> 'UNCLASSIFIED'
TO regularUsers;
// List-valued property contains a value [2026.08, Cypher 25]
GRANT MATCH {*} ON GRAPH mydb
FOR (n) WHERE 'gold' IN n.clearanceLevels
TO goldTier;
GRANT READ {*} ON GRAPH mydb FOR (n) WHERE 'EU' IN n.regions TO regularUsers;
GRANT MATCH {*} ON GRAPH mydb FOR (n) WHERE NOT 'EU' IN n.regions TO regularUsers;
// Property on the right-hand side of a comparison [2026.08, Cypher 25]
GRANT MATCH {*} ON GRAPH mydb
FOR (n) WHERE 1 > n.level
TO analyst;
GRANT READ {*} ON GRAPH mydb FOR (n) WHERE 3 < n.securityLevel TO regularUsers;
// Dynamic row-level security: property matches caller's native user tags [2026.10, Enterprise]
GRANT TRAVERSE ON GRAPH * FOR (n:Project) WHERE n.department IN abac.native.user_tags() TO projectTeam;
n.prop IN abac.native.user_tags() [2026.10] — one role serves every tag value; needs native in dbms.security.abac.authorization_providers (see §6). Cannot negate with NOT → grant on positive tag match insteadvalue IN n.listProp — list property contains valuen.prop IN [v1, v2] — scalar-against-listPBAC edge cases and export patterns → references/privilege-reference.md
Constraints:
FOR pattern applies to read privileges only — not writen.prop <op> <literal> or maintain a scalar flag propertyTRAVERSE rules cost more than READABAC grants roles dynamically from OIDC/JWT claims or native user tags rather than explicit GRANT ROLE ... TO user.
# neo4j.conf — every entry must also appear in dbms.security.authorization_providers, same name
dbms.security.authorization_providers=oidc-<alias>,native
dbms.security.abac.authorization_providers=oidc-<alias>,native # native [2026.06+]
Unlisted provider → its accessor function (abac.oidc.user_attribute(), abac.native.user_tags()) unavailable and rules referencing it fail (no silent default).
CREATE AUTH RULE salesRule
SET CONDITION abac.oidc.user_attribute('department') = 'sales';
GRANT ROLE analyst TO AUTH RULE salesRule;
CREATE OR REPLACE AUTH RULE seniorRule
SET CONDITION abac.oidc.user_attribute('department') = 'engineering'
AND abac.oidc.user_attribute('level') >= 5;
GRANT ROLE senior_engineer TO AUTH RULE seniorRule;
SHOW AUTH RULES YIELD name, condition, enabled, roles;
ALTER AUTH RULE salesRule SET ENABLED false; // disable without dropping
RENAME AUTH RULE salesRule TO salesDeptRule;
DROP AUTH RULE salesDeptRule;
REVOKE ROLE analyst FROM AUTH RULE salesRule;
Native users [2026.06+]: tag native DB users (see User tags) and match tags in rules via abac.native.user_tags() — no OIDC required:
CREATE AUTH RULE nativeSalesRule
SET CONDITION 'sales' IN abac.native.user_tags();
GRANT ROLE analyst TO AUTH RULE nativeSalesRule;
// require several tags at once
CREATE AUTH RULE financeAuditRule
SET CONDITION all(tag IN ['finance', 'auditor'] WHERE tag IN abac.native.user_tags());
// combine tags with OIDC claims and temporal conditions
CREATE AUTH RULE onCallRule
SET CONDITION 'on-call' IN abac.native.user_tags()
AND abac.oidc.user_attribute('department') = 'engineering'
AND time.transaction('UTC').hour >= 9;
❌ Never condition on tag absence: NOT ('restricted' IN abac.native.user_tags()) — any user created without tags satisfies it, escalating privileges.
✅ Require presence of a tag: 'unrestricted' IN abac.native.user_tags().
Notes:
abac.oidc.user_attribute(); native user tags via abac.native.user_tags() [2026.06+]. LDAP has no accessor function — tag the LDAP user's native user object insteadREAD only, granted on the virtual database [2026.07+, not on Aura] — see references/privilege-reference.md// All privileges in the system
SHOW PRIVILEGES YIELD *;
// Privileges for a specific user (as runnable commands)
SHOW USER alice PRIVILEGES AS COMMANDS;
// Privileges for a specific role
SHOW ROLE analyst PRIVILEGES YIELD access, action, resource, graph, segment, role;
// Privileges of roles granted to an auth rule [2026.09]
SHOW AUTH RULES salesRule PRIVILEGES AS COMMANDS;
// Find who has access to a database
SHOW PRIVILEGES YIELD *
WHERE graph = 'mydb'
RETURN role, action, resource, segment ORDER BY role;
// Find all DENY rules
SHOW PRIVILEGES YIELD *
WHERE access = 'DENIED'
RETURN role, action, resource, segment;
| Role | Scope |
|---|---|
admin | Full DBMS + all databases |
architect | Schema changes + write on all databases |
publisher | Write on all databases |
editor | Write excluding schema changes |
reader | Read-only on all databases |
public | All users implicitly; default home database access |
Assign built-in roles: GRANT ROLE reader TO alice;
dbms.security.auth_enabled=true
dbms.security.auth_max_failed_attempts=3 # lockout threshold
dbms.security.authentication_providers=ldap,native # drop native to disable fallback
dbms.security.authorization_providers=ldap,native
dbms.security.ldap.host=ldap://ldap.example.com
dbms.security.ldap.authentication.mechanism=simple
dbms.security.ldap.authentication.user_dn_template=uid={0},ou=users,dc=example,dc=com
dbms.security.ldap.authorization.group_membership_attributes=memberOf
dbms.security.ldap.authorization.group_to_role_mapping=\
"cn=analysts,ou=groups,dc=example,dc=com" = analyst;\
"cn=admins,ou=groups,dc=example,dc=com" = admin
# enable provider — without these two lines the oidc.<alias>.* keys are ignored
dbms.security.authentication_providers=oidc-<alias>,native
dbms.security.authorization_providers=oidc-<alias>,native
dbms.security.oidc.<alias>.display_name=Okta
dbms.security.oidc.<alias>.auth_flow=pkce # `implicit` deprecated 2026.06, removal planned — keep pkce
dbms.security.oidc.<alias>.well_known_discovery_uri=https://example.okta.com/.well-known/openid-configuration
dbms.security.oidc.<alias>.audience=neo4j
dbms.security.oidc.<alias>.claims.username=email
dbms.security.oidc.<alias>.claims.groups=groups
dbms.security.oidc.<alias>.authorization.group_to_role_mapping=\
"neo4j-analysts" = analyst;\
"neo4j-admins" = admin
Config changes require server restart. Roles referenced in mappings must exist in Neo4j (native or created via Cypher).
CREATE ROLE ... IF NOT EXISTSSHOW ROLE ... PRIVILEGES AS COMMANDS to verifyGRANT ROLE ... TO ...SHOW USER ... PRIVILEGES AS COMMANDSFull privilege syntax → references/privilege-reference.md
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
neo4j-security, rbac, abac, user-management, privilege-management, cypher-security
npx claudepluginhub neo4j/agent-skills --plugin neo4j-skills30 skills in this plugin
/neo4j-agent-memory-skillAuthoritative reference for the neo4j-agent-memory Python package — a graph-native memory system for AI agents built on Neo4j — and for the hosted service (NAMS) at memory.neo4jlabs.com. Use this skill whenever the user mentions neo4j-agent-memory, agent memory with Neo4j, context graphs, the POLE+O model, MemoryClient/MemorySettings, the memory MCP server, or any of the framework integrations (LangChain, PydanticAI, CrewAI, AWS Strands, Google ADK, Microsoft Agent Framework, OpenAI Agents, LlamaIndex). Also use when the user mentions the hosted service at memory.neo4jlabs.com, NAMS, the Neo4j Agent Memory Service, the `nams_` API key prefix, or the hosted MCP endpoint. Also use when writing documentation, blog posts, tutorials, PRDs, or code samples for the project, when comparing agent memory approaches, or when positioning graph-native memory against vector-only approaches — even if the user doesn't explicitly name the package. Does NOT handle GraphRAG pipelines — use neo4j-graphrag-skill./neo4j-aura-agent-skillManages Neo4j Aura Agents via the v2beta1 REST API — create, list, get, update, delete, and invoke Aura agents backed by an AuraDB instance. Use when configuring Aura Agent tools (CypherTemplate, SimilaritySearch, Text2Cypher), setting system prompts, deploying agents to REST or MCP endpoints, invoking agents with natural language queries, or generating evaluation datasets (max 50 questions) for the Aura Agent evaluation feature. Covers OAuth2 auth, organization/project scoping, tool parameter schemas, and InvokeAgentResponse format. Does NOT cover AuraDB instance provisioning — use neo4j-aura-provisioning-skill. Does NOT cover vector index creation — use neo4j-vector-index-skill.Other plugins' skills for the same job