MXS-2390 Firewall should reject statements prepared from var
Currently no practical way for checking what the statement actually does and thus blanket rejection is the only alternative.
This commit is contained in:
@ -1480,12 +1480,21 @@ int DbfwSession::routeQuery(GWBUF* buffer)
|
|||||||
if (qc_query_is_type(type, QUERY_TYPE_PREPARE_NAMED_STMT))
|
if (qc_query_is_type(type, QUERY_TYPE_PREPARE_NAMED_STMT))
|
||||||
{
|
{
|
||||||
analyzed_queue = qc_get_preparable_stmt(buffer);
|
analyzed_queue = qc_get_preparable_stmt(buffer);
|
||||||
mxb_assert(analyzed_queue);
|
|
||||||
|
// 'analyzed_queue' will be NULL if the statement is prepared from
|
||||||
|
// a variable like in : "prepare ps from @a".
|
||||||
}
|
}
|
||||||
|
|
||||||
SUser suser = find_user_data(this_thread->users(m_instance), user(), remote());
|
|
||||||
bool query_ok = false;
|
bool query_ok = false;
|
||||||
|
|
||||||
|
if (!analyzed_queue)
|
||||||
|
{
|
||||||
|
set_error("Firewall rejects statements prepared from a variable.");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
SUser suser = find_user_data(this_thread->users(m_instance), user(), remote());
|
||||||
|
|
||||||
if (command_is_mandatory(buffer))
|
if (command_is_mandatory(buffer))
|
||||||
{
|
{
|
||||||
query_ok = true;
|
query_ok = true;
|
||||||
@ -1546,6 +1555,7 @@ int DbfwSession::routeQuery(GWBUF* buffer)
|
|||||||
{
|
{
|
||||||
query_ok = true;
|
query_ok = true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (query_ok)
|
if (query_ok)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user