[freetds] readonly access with freetds and php
James K. Lowden
jklowden at freetds.org
Fri Dec 22 22:42:30 EST 2006
Joseph Harth wrote:
> I compiled php and freetds and it works like a charm. I would like to
> disable all kinds of updates to tables and allow only select queries
> with php. I am not sure if this is possible. I could create a user
> with read only access to the tables but scripts could be run under a
> different user that has more rights and open some holes.
A common practice is to make *all* tables read-only (or deny all access
the tables), and write stored procedures to support the application. Grant
privileges as necessary on the procedures to groups. Add users to the
groups. Done. No script can open a hole.
> Not sure if there is a way to
> hack freetds to disable updates deletes and drops of tables but if there
> is a way i would like to do that.
It's not possible. FreeTDS doesn't parse your SQL. It can't distinguish
between SELECT * FROM TABLENAME and DELETE TABLENAME or even DROP
More information about the FreeTDS