Skip to content

dbms.security.procedures.roles not working with custom procedures and dbms.cluster.routing.getRoutingTable in ONgDB 3.6.0 with apoc 3.5.0.12 #77

@wtrevena

Description

@wtrevena

Expected Behavior

dbms.security.procedures.default_allowed & dbms.security.procedures.roles provide procedure level user access control for custom procedures defined via "CALL apoc.custom.asProcedure()" and for the dbms.cluster.routing.getRoutingTable procedure necessary for neo4j:// bolt+routing calls.

Actual Behavior

dbms.security.procedures.default_allowed & dbms.security.procedures.roles provide procedure level user access control for some procedures, but not for custom procedures or for the dbms.cluster.routing.* family.

How to Reproduce the Problem

wget https://cdn.graphfoundation.org/ongdb/dist/ongdb-enterprise-3.6.0-unix.tar.gz
tar -xzf ongdb-enterprise-3.6.0-unix.tar.g
wget https://cdn.graphfoundation.org/apoc/dist/org/neo4j/procedure/apoc/3.5.0.12/apoc-3.5.0.12-all.jar
mv apoc-3.5.0.12-all.jar plugins/apoc-3.5.0.12-all.jar
  1. Create a new role and assign a user to that role
"CALL dbms.security.createRole('lowlife')"
"CALL dbms.security.createUser('user','password')"
"CALL dbms.security.addRoleToUser('lowlife','user')"
  1. Define a custom procedure such as
"CALL apoc.custom.asProcedure('listcity','MATCH (n:city {stateabr:$stateabr}) RETURN n LIMIT 10','read',[['n','NODE']],[['stateabr','STRING']]);"
  1. Add the following lines to neo4j.conf
dbms.directories.plugins=/db/plugins
dbms.security.procedures.default_allowed=admin
dbms.security.procedures.roles=custom.*:lowlife;dbms.cluster.routing.getRoutingTable:lowlife
dbms.security.procedures.unrestricted=*
dbms.security.procedures.whitelist=*
  1. Start Neo4j
    /bin/neo4j start

  2. Call the custom procedure

"CALL custom.listcity('WA');"

Example of how dbms.security.procedures.roles works for some procedures but not others

"CALL custom.listcity('WA');" leads to this error message if you use neo4j:// and the configuration above

image

Or to this error message if you use bolt://

image

Furthermore, when I ran

"CALL dbms.procedures() YIELD name, roles WITH * WHERE name contains 'custom.listcity' RETURN *"

I received this output which illustrates that dbms.security.procedures.roles was not effective at allowing the lowlife role to use the custom.listcity procedure :

image

On the other hand, after editing the dbms.security.procedures.roles neo4j.conf line like this:

dbms.security.procedures.roles=apoc.broker.receive:lowlife

I ran

"CALL dbms.procedures() YIELD name, roles WITH * WHERE name contains 'apoc' RETURN *"

Which returned the following output illustrating that dbms.security.procedures.roles=apoc.broker.receive:lowlife worked properly in allowing the lowlife role to use the apoc.broker.receive procedure.:

image

Based on these results and other tests I did, it appears that there are a range of default procedures such as dbms.cluster.routing.getRoutingTable and custom procedures which dbms.security.procedures.roles is not capable of giving a role access to, but that there are other procedures such as apoc.broker.receive which roles can be given access to.

Versions

  • OS: Ubuntu 20.4
  • ONgDB 3.6.0
  • apoc 3.5.0.12

Any updates or assistance is greatly appreciated. You guys are doing great work, and I can't tell you how much I appreciate it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions