You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I use the database in two different modes, one inserts data to it periodically or in a semi-streaming mode. The other is analysis of the data to find interesting nuggets of information in the data, this is done using rethink-miner and also the Data Explorer. Rethink-miner and the data explorer both allow arbitrary queries to be executed on the database and that may lead to an erroneous deletion of the table.
It would be nice if the connection could be marked as read-only and then the modification commands would not be accepted (i.e. insert, delete, update, etc.)
@baruch -- thanks for feature request! I'd like to understand the use case a little better. Do you want to mark connections as read-only as a precaution from running potentially erroneous code, or as a precaution from potentially malicious users?
If it's the latter, then I think what we really want here is a real permissions system (on the radar, but won't be scheduled for some time). If it's the former, a flag to the connection would be one possible solution, but I think this case would also be covered by a permissions system.
We could implement a flag in the interim, but since it's really hacky (and we'd likely have to maintain it), I'd really prefer to wait until we can put a full-blown permissions system in instead.
I wouldn't deploy something like rethink-miner openly for all so I don't expect anyone malicious to touch it. I'm mostly interested in something to ensure that no mistake in copy-paste or the like will result in any loss of data which may go undetected.
It does mean I would need a connection that is read-only and another that is read-write for the application purposes itself such as editing its own tables.
As for scheduling. that is obviously left up to you. It isn't a critical feature but it would give a good feeling and make me sleep better if I know that no one could edit the database through the interface that I give them.
I could also implement some sort of firewall of my own on the rethinkdb query logic, either by changing the methods or by parsing the query in advance and filtering. It's just something that if it can happen in the database sounds like a better solution.
Ok, moving to backlog for now. I'm going to leave this open until we get a permissions system done. I'd like to avoid implementing a read-only connection feature, since there is a more general, elegant solution that we're going to do anyway.
Does the current RethinkDB support read-only replicas and could this be used as a securish workaround for having a read-only "connection" to a database with no secret data?
This would be crucial to my use case right now where having a private server with write access and a public read-only replica of it to which the changes would be consolidated. I could even live with manual hacks, eg putting the other replica's data files on read-only filesystem and having some downtime while manually consolidating the stuff.
@jampekka This isn't yet possible unfortunately. Mounting on a read-only file system will make the server just not start up.
The best way to implement a read-only server at the moment would be routing all queries through a custom "proxy", that destructs the query, checks which terms are used in it, and then only passes it on to the actual server if the occurring terms are save (i.e. none of r.http, delete, insert, update, replace, dbDrop, dbCreate, tableDrop, tableCreate, indexDrop, indexCreate). This is definitely a bit of work though.
@danielmewes I'm not sure I'm comfortable with that approach, as it would be easy to miss some cases, although I may resort to it. How certain are you that these cover all the non-safe cases?
The scenario is that I'd (very very much) like to do a browser data visualization application that would use ReQL directly when feasible. I'm so fed up in writing pointless back end "service layers", I may end up hurting myself and others if I have to do one more, and in the I'd have to waste yet more countless hours in frustrating manual ceremony. ReQL finally could offer a real possibility of getting rid of such pointless labor.
Also to any possible commenters: please refrain from the knee-jerk reactions that "this is a bad idea" without any real arguments ("best practice" and "because it's been always done this way" don't count as such).
@jampekka I'd probably go for a white list approach for filtering, though it's definitely a significant amount of work.
The better longer term solution to this are going to be server-side user accounts with configurable permissions (#218). It's still not scheduled as of now, but it's on the shorter list of things that I'd really like to get to some time within the next couple releases.
I'd also appreciate something similar to this. I'd like to be able to issue an auth key for every user programmatically accessing the DB – this includes other clusters. Each key would be have an access level read, write, or both.
One immediate use for this is we have a staging db that we want to give many people access to, but we'd like to only give them read access, and we'd like to ensure we can revoke keys (e.g. if an employee leaves, or a key gets leaked).
I'm bumping this to subsequent.
It sounds like we can satisfy a couple of use cases without having to implement a full-fledged permission system. It seems reasonable to support read-only connections first, and add fine-grained control some time later.
Activity
coffeemug commentedon Dec 30, 2013
@baruch -- thanks for feature request! I'd like to understand the use case a little better. Do you want to mark connections as read-only as a precaution from running potentially erroneous code, or as a precaution from potentially malicious users?
If it's the latter, then I think what we really want here is a real permissions system (on the radar, but won't be scheduled for some time). If it's the former, a flag to the connection would be one possible solution, but I think this case would also be covered by a permissions system.
We could implement a flag in the interim, but since it's really hacky (and we'd likely have to maintain it), I'd really prefer to wait until we can put a full-blown permissions system in instead.
baruch commentedon Dec 30, 2013
I wouldn't deploy something like rethink-miner openly for all so I don't expect anyone malicious to touch it. I'm mostly interested in something to ensure that no mistake in copy-paste or the like will result in any loss of data which may go undetected.
It does mean I would need a connection that is read-only and another that is read-write for the application purposes itself such as editing its own tables.
As for scheduling. that is obviously left up to you. It isn't a critical feature but it would give a good feeling and make me sleep better if I know that no one could edit the database through the interface that I give them.
I could also implement some sort of firewall of my own on the rethinkdb query logic, either by changing the methods or by parsing the query in advance and filtering. It's just something that if it can happen in the database sounds like a better solution.
coffeemug commentedon Dec 31, 2013
Ok, moving to backlog for now. I'm going to leave this open until we get a permissions system done. I'd like to avoid implementing a read-only connection feature, since there is a more general, elegant solution that we're going to do anyway.
rcoh commentedon Jan 3, 2014
It seems like this could be best handled with modifications to the rethink driver rather having to modify the db core.
coffeemug commentedon Jan 14, 2014
Related to #218.
jampekka commentedon Mar 2, 2015
Does the current RethinkDB support read-only replicas and could this be used as a securish workaround for having a read-only "connection" to a database with no secret data?
This would be crucial to my use case right now where having a private server with write access and a public read-only replica of it to which the changes would be consolidated. I could even live with manual hacks, eg putting the other replica's data files on read-only filesystem and having some downtime while manually consolidating the stuff.
danielmewes commentedon Mar 2, 2015
@jampekka This isn't yet possible unfortunately. Mounting on a read-only file system will make the server just not start up.
The best way to implement a read-only server at the moment would be routing all queries through a custom "proxy", that destructs the query, checks which terms are used in it, and then only passes it on to the actual server if the occurring terms are save (i.e. none of
r.http,delete,insert,update,replace,dbDrop,dbCreate,tableDrop,tableCreate,indexDrop,indexCreate). This is definitely a bit of work though.May I ask what your usage scenario looks like?
jampekka commentedon Mar 3, 2015
@danielmewes I'm not sure I'm comfortable with that approach, as it would be easy to miss some cases, although I may resort to it. How certain are you that these cover all the non-safe cases?
The scenario is that I'd (very very much) like to do a browser data visualization application that would use ReQL directly when feasible. I'm so fed up in writing pointless back end "service layers", I may end up hurting myself and others if I have to do one more, and in the I'd have to waste yet more countless hours in frustrating manual ceremony. ReQL finally could offer a real possibility of getting rid of such pointless labor.
Also to any possible commenters: please refrain from the knee-jerk reactions that "this is a bad idea" without any real arguments ("best practice" and "because it's been always done this way" don't count as such).
I have discussed this before on RethingDBs facebook page: https://www.facebook.com/permalink.php?story_fbid=905976462776201&id=155296331177555
danielmewes commentedon Mar 3, 2015
@jampekka I'd probably go for a white list approach for filtering, though it's definitely a significant amount of work.
The better longer term solution to this are going to be server-side user accounts with configurable permissions (#218). It's still not scheduled as of now, but it's on the shorter list of things that I'd really like to get to some time within the next couple releases.
joeybaker commentedon Jun 5, 2015
I'd also appreciate something similar to this. I'd like to be able to issue an auth key for every user programmatically accessing the DB – this includes other clusters. Each key would be have an access level read, write, or both.
One immediate use for this is we have a staging db that we want to give many people access to, but we'd like to only give them read access, and we'd like to ensure we can revoke keys (e.g. if an employee leaves, or a key gets leaked).
danielmewes commentedon Jun 11, 2015
I'm bumping this to
subsequent.It sounds like we can satisfy a couple of use cases without having to implement a full-fledged permission system. It seems reasonable to support read-only connections first, and add fine-grained control some time later.
coffeemug commentedon Jun 16, 2015
👍
opavader commentedon Oct 28, 2015
+1