From: Kirill Shcherbatov <kshcherbatov@tarantool.org>
To: tarantool-patches@freelists.org, korablev@tarantool.org
Cc: Kirill Shcherbatov <kshcherbatov@tarantool.org>
Subject: [tarantool-patches] [PATCH v2 2/9] box: fix _trigger and _ck_constraint access check
Date: Wed, 30 Jan 2019 11:59:09 +0300 [thread overview]
Message-ID: <3226bb82065bbaea578a909f5382571bbe01fa3b.1548838034.git.kshcherbatov@tarantool.org> (raw)
In-Reply-To: <cover.1548838034.git.kshcherbatov@tarantool.org>
Fixed missed access checks for _trigger and _fk_constraint space.
---
src/box/alter.cc | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/src/box/alter.cc b/src/box/alter.cc
index 0589c9678..ab3dd2e22 100644
--- a/src/box/alter.cc
+++ b/src/box/alter.cc
@@ -3521,6 +3521,11 @@ on_replace_dd_trigger(struct trigger * /* trigger */, void *event)
uint32_t space_id =
tuple_field_u32_xc(old_tuple,
BOX_TRIGGER_FIELD_SPACE_ID);
+ struct space *space = space_by_id(space_id);
+ assert(space != NULL);
+ access_check_ddl(space->def->name, space->def->id,
+ space->def->uid, SC_SPACE, PRIV_A);
+
char *trigger_name =
(char *)region_alloc_xc(&fiber()->gc,
trigger_name_len + 1);
@@ -3574,6 +3579,10 @@ on_replace_dd_trigger(struct trigger * /* trigger */, void *event)
"trigger space_id does not match the value "
"resolved on AST building from SQL");
}
+ struct space *space = space_by_id(space_id);
+ assert(space != NULL);
+ access_check_ddl(space->def->name, space->def->id,
+ space->def->uid, SC_SPACE, PRIV_A);
struct sql_trigger *old_trigger;
if (sql_trigger_replace(trigger_name,
@@ -3889,6 +3898,8 @@ on_replace_dd_fk_constraint(struct trigger * /* trigger*/, void *event)
fk_def->name,
"referencing space can't be VIEW");
}
+ access_check_ddl(child_space->def->name, child_space->def->id,
+ child_space->def->uid, SC_SPACE, PRIV_A);
struct space *parent_space =
space_cache_find_xc(fk_def->parent_id);
if (parent_space->def->opts.is_view) {
@@ -3896,6 +3907,8 @@ on_replace_dd_fk_constraint(struct trigger * /* trigger*/, void *event)
fk_def->name,
"referenced space can't be VIEW");
}
+ access_check_ddl(parent_space->def->name, parent_space->def->id,
+ parent_space->def->uid, SC_SPACE, PRIV_A);
/*
* FIXME: until SQL triggers are completely
* integrated into server (i.e. we are able to
@@ -4018,6 +4031,10 @@ on_replace_dd_fk_constraint(struct trigger * /* trigger*/, void *event)
space_cache_find_xc(fk_def->child_id);
struct space *parent_space =
space_cache_find_xc(fk_def->parent_id);
+ access_check_ddl(child_space->def->name, child_space->def->id,
+ child_space->def->uid, SC_SPACE, PRIV_A);
+ access_check_ddl(parent_space->def->name, parent_space->def->id,
+ parent_space->def->uid, SC_SPACE, PRIV_A);
struct fkey *old_fkey =
fkey_grab_by_name(&child_space->child_fkey,
fk_def->name);
--
2.19.2
next prev parent reply other threads:[~2019-01-30 8:59 UTC|newest]
Thread overview: 41+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-30 8:59 [tarantool-patches] [PATCH v2 0/9] sql: Checks on server side Kirill Shcherbatov
2019-01-30 8:59 ` [tarantool-patches] [PATCH v2 1/9] box: fix upgrade script for _fk_constraint space Kirill Shcherbatov
2019-03-11 18:44 ` [tarantool-patches] " n.pettik
2019-03-13 11:36 ` Kirill Yukhin
2019-01-30 8:59 ` Kirill Shcherbatov [this message]
2019-03-11 19:29 ` [tarantool-patches] Re: [PATCH v2 2/9] box: fix _trigger and _ck_constraint access check n.pettik
2019-03-22 9:29 ` Vladislav Shpilevoy
2019-03-26 10:59 ` Kirill Shcherbatov
2019-04-01 14:06 ` n.pettik
2019-03-13 11:38 ` Kirill Yukhin
2019-03-13 11:44 ` Kirill Yukhin
2019-01-30 8:59 ` [tarantool-patches] [PATCH v2 3/9] box: fix Tarantool upgrade from 2.1.0 to 2.1.1 Kirill Shcherbatov
2019-03-12 11:45 ` [tarantool-patches] " n.pettik
2019-03-20 15:12 ` n.pettik
2019-03-20 15:38 ` Kirill Shcherbatov
2019-03-21 15:23 ` n.pettik
2019-03-21 15:36 ` Vladislav Shpilevoy
2019-03-22 9:28 ` Vladislav Shpilevoy
2019-03-22 10:18 ` Kirill Shcherbatov
2019-03-22 10:21 ` Vladislav Shpilevoy
2019-03-26 9:52 ` Kirill Yukhin
2019-01-30 8:59 ` [tarantool-patches] [PATCH v2 4/9] box: fix on_replace_trigger_rollback routine Kirill Shcherbatov
2019-03-11 20:00 ` [tarantool-patches] " n.pettik
2019-03-13 11:39 ` Kirill Yukhin
2019-01-30 8:59 ` [tarantool-patches] [PATCH v2 5/9] schema: add new system space for CHECK constraints Kirill Shcherbatov
2019-03-22 9:29 ` [tarantool-patches] " Vladislav Shpilevoy
2019-03-22 9:52 ` n.pettik
2019-03-26 10:59 ` Kirill Shcherbatov
2019-04-01 19:45 ` n.pettik
2019-04-16 13:51 ` Kirill Shcherbatov
2019-01-30 8:59 ` [tarantool-patches] [PATCH v2 6/9] sql: disallow use of TYPEOF in Check Kirill Shcherbatov
2019-03-26 10:59 ` [tarantool-patches] " Kirill Shcherbatov
2019-04-01 19:52 ` n.pettik
2019-01-30 8:59 ` [tarantool-patches] [PATCH v2 7/9] sql: refactor sqlite3_reset routine Kirill Shcherbatov
2019-03-26 10:59 ` [tarantool-patches] " Kirill Shcherbatov
2019-01-30 8:59 ` [tarantool-patches] [PATCH v2 8/9] box: exported sql_bind structure and API Kirill Shcherbatov
2019-03-26 10:59 ` [tarantool-patches] " Kirill Shcherbatov
2019-01-30 8:59 ` [tarantool-patches] [PATCH v2 9/9] sql: run check constraint tests on space alter Kirill Shcherbatov
2019-03-26 10:59 ` [tarantool-patches] " Kirill Shcherbatov
2019-04-02 14:14 ` n.pettik
2019-04-16 13:51 ` Kirill Shcherbatov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3226bb82065bbaea578a909f5382571bbe01fa3b.1548838034.git.kshcherbatov@tarantool.org \
--to=kshcherbatov@tarantool.org \
--cc=korablev@tarantool.org \
--cc=tarantool-patches@freelists.org \
--subject='Re: [tarantool-patches] [PATCH v2 2/9] box: fix _trigger and _ck_constraint access check' \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox