-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Do not flush schema on failed authentication #71
Comments
Your user doesn't know about existence and ID of 'space_conn', there's no way to get this messge. |
@rybakit so what's the problem now? FirstInput script:
Output:
SecondInput script:
Output:
|
instance.lua: box.cfg {
listen = 3301,
log_level = 6,
wal_mode = 'none',
snap_dir = '/tmp',
slab_alloc_arena = .1,
}
box.schema.user.grant('guest', 'read,write,execute', 'universe')
local credentials = {
user_foo = 'foo',
}
for username, password in pairs(credentials) do
if box.schema.user.exists(username) then
box.schema.user.drop(username)
end
box.schema.user.create(username, { password = password })
end
local function create_space(name)
if box.space[name] then
box.space[name]:drop()
end
return box.schema.space.create(name, {temporary = true})
end
local space = create_space('space_conn')
space:create_index('primary', {type = 'tree', parts = {1, 'num'}}) test1.php: <?php
$t = new Tarantool();
$t->authenticate('user_foo', 'foo');
$t->select('space_conn'); Output: Fatal error: Uncaught exception 'Exception' with message 'No space 'space_conn' defined' in ... test2.php: <?php
$t = new Tarantool();
$t->select('space_conn');
$t->authenticate('user_foo', 'foo');
$t->select('space_conn'); Output: Fatal error: Uncaught exception 'Exception' with message 'Query error 55: Read access denied for user 'user_foo' to space 'space_conn'' in ... So, the second script is leaking info about the space existence. I also checked the python driver, it has the same issue: import tarantool
con = tarantool.Connection('127.0.0.1', 3301)
# the fist select has influence on error type
# generated by the second select
# comment out the following line to test the difference
con.select('space_conn')
con.authenticate('user_foo', 'foo')
con.select('space_conn') It looks like it's Tarantool server issue, but @kostja asked me to open an issue here, in the driver repo first. |
It was related to schema, that wasn't flushed when authenticate was called. Must be fixed in latest master. |
👍 thanks |
@bigbes What do you think about flushing the schema only on successful authentication? Although it might be a very rare case, it can save at least 3 extra selects (according to my test) in the worst case in scenarios like this: $res = $t->select('my_space', 1);
try {
$t->authenticate('user_foo', 'incorrect_password');
} catch (Exception $e) {
$res = $t->select('my_space', 2);
} |
@rybakit we may do this, but i'm not sure that it's worth it. I'll do it on PHP7 branch. |
I'm not sure either ;) |
Updated the title to reflect what is expected to do within the issue. |
prints
No space 'space_conn' defined
error message, which is wrong asspace_conn
does exist.After uncommenting the second line the script starts throwing the correct message
Query error 55: Read access denied for user 'user_foo' to space 'space_conn'
.The text was updated successfully, but these errors were encountered: