Re: Re: Tunnelling SQL over HTTP with MDB2

From: Date: Fri, 28 Apr 2006 16:53:59 +0000
Subject: Re: Re: Tunnelling SQL over HTTP with MDB2
References: 1 2 3  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-42408@lists.php.net to get a copy of this message
Olivier Guilyardi wrote: > Hi Greg, > Greg Beaver wrote: >> I think the authentication/security level is pretty darn critical. In >> addition, I don't think you'll find it is either more flexible or faster >> to send the entire SQL query over HTTP. Far better is define a web >> service that accepts data, and then does the necessary database access >> internally. >> >> Passing arbitrary SQL over HTTP is a recipe for complete and total >> disaster. You'll be giving everyone the same access to the database >> that the local user has, which probably includes the ability to do nice >> things like "DELETE FROM tablename." A web service can make this simply >> impossible to do, and is far more truly flexible. You may think your >> only problem is security, but in truth, you will have to find a way to >> debug SQL remotely, and will only encourage disorganized spaghetti code. > > About security: I do not follow you. If the tunnel is secure I don't see > where the problem is. As an example, what about the thousands of people > using SSH to administer remote servers ? They're root, they can rm the > whole filesystem, but SSH makes it safe. MDB2 could implement an > "internal HTTP tunnel" that handles such security transparently. > > In this situation, I don't see how debugging SQL would differ from using > MDB2 as one currently do. > >> Also, security is handled via simple mechanisms: SSL and HTTP Auth. >> This removes the need to tunnel altogether. Debugging works on several >> fronts, as you will have the HTTP access log to track access to widgets >> as well as other sources. > > Maybe that "tunnel" is not the right word. A diagram (see below) should > help clarifying. I think that what I call tunnel actually is a web > service that allows to send arbitrary SQL queries... That's a little > confusing, but still coherent I think. The security problem is that it is probably easier for a hacker to enter a web site and make use of the tunnel to run arbitrary queries, than it would be to temper with SSH (BTW: you should never be able to SSH directly into the root account, but instead SSH into regular user account, then "su") Anyway, if you have access to the remote db server to install a script, why not make that script return the data you want directly. Yes, this is less flexible than being able to run any SQL queries, but security always comes at a cost. If you want to go the MDB2-way, you'd have to think about your queries as stored procedures (which limits the security problem aforementioned), call them as resources of a web service, and wrap the result into a MDB2_Result in the client-side driver for MDB2. So, it would look like you're running SQL queries, but actually you would have to do some magic to turn a SQL query into a webservice call. Anyway, running arbitrary SQL queries through the HTTP tunnel is obviously possible, but doing so is a big security risk and shouldn't be used by someone who doesn't know what they're doing (no offense). -Philippe

« previous php.pear.dev (#42408) next »