I have a custom scripting engine that allows the user to execute queries on a TSQL data set. The query is free form and maps directly to a call to 'System.Data.Linq.DataContext.ExecuteQuery'
I want the user to be able to query data, and return results, but NOT modify the data as this would be a security issue.
Currently I check the string for the following keywords: insert, update, alter, create, delete, drop, truncate, merge and exec.
However, I suspect there is a better way, like setting the context to read only or some other method that doesn't rely on my remembering or parsing all possible sql statements, etc..