I'm contemplating the construction of an interface for advanced or
dedicated users of a database, with a text box in which they type
their queries as XQuery modules.  (Non-advanced and non-dedicated
users will make do with a variety of pre-defined queries; this interface
is intended to provide an open-ended query interface for the few
users who will need it.)

One issue that arises is security:  any use of an eval() function opens
the door to code injection attacks.  For now, I'm inclined to think that
BaseX's rule that xquery:eval() does not accept updating expressions
suffices to protect the database from harm.  Parsing the query and
declining potentially harmful queries is also a possibility, if I can persuade
myself I can distinguish harmful from harmless queries.  (Comments
and advice on this topic welcome, even though it's not the focus of this
question.)

A second issue is resource usage.  Imagine a hostile user who writes
a query designed to tie up the server for a long time and consume a lot
of memory.  Or imagine a non-hostile but naive user who unintentionally
concocts an extremely expensive query.

Is there a way to put a call to eval() (or any call to the BaseX HTTP server)
into some kind of box and specify limits on the amount of CPU time, the
amount of clock time, and/or the amount of storage to be available for
its evaluation? 

Michael 


-- 
****************************************************************
* C. M. Sperberg-McQueen, Black Mesa Technologies LLC
* http://www.blackmesatech.com 
* http://cmsmcq.com/mib                 
* http://balisage.net
****************************************************************




_______________________________________________
BaseX-Talk mailing list
BaseX-Talk@mailman.uni-konstanz.de
https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk

Reply via email to