Skip to content
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

Prevent tarantool injection & unsolicited code execution #3927

Closed
jobs-git opened this issue Jan 9, 2019 · 5 comments
Closed

Prevent tarantool injection & unsolicited code execution #3927

jobs-git opened this issue Jan 9, 2019 · 5 comments
Labels
question Further information is requested security sql

Comments

@jobs-git
Copy link

jobs-git commented Jan 9, 2019

In SQL, there is what we call SQL injection, and this was mitigated by using prepared statements, in tarantool what counter measures can we use so that we can prevent code injections from unsolicited users?

@jobs-git jobs-git changed the title Tarantool injection & unsolicited code execution Prevent tarantool injection & unsolicited code execution Jan 10, 2019
@kyukhin kyukhin added feature A new functionality security labels Feb 8, 2019
@kyukhin kyukhin added this to the wishlist milestone Feb 8, 2019
@Totktonada
Copy link
Member

Tarantool supports placeholders for parameters as for usual box.execute() requests as well as for prepared statements. Basic example:

tarantool> box.cfg{}
tarantool> box.execute([[create table bar(id integer primary key autoincrement, value varchar(100))]])
tarantool> box.execute([[insert into bar values (NULL, ?)]], {'one'})
tarantool> box.execute([[insert into bar values (NULL, ?)]], {'two'})
tarantool> box.execute([[insert into bar values (NULL, ?)]], {'three'})
tarantool> box.execute([[select * from bar]])
---
- metadata:
  - name: ID
    type: integer
  - name: VALUE
    type: string
  rows:
  - [1, 'one']
  - [2, 'two']
  - [3, 'three']
...

See more in the documentation.

See also the relevant discussion with the documentation team.

Feel free to reopen the issue if you have more questions.

@Totktonada Totktonada added question Further information is requested sql and removed feature A new functionality labels Sep 21, 2020
@kyukhin kyukhin removed this from the wishlist milestone Sep 21, 2020
@jobs-git
Copy link
Author

jobs-git commented Sep 27, 2020

I am glad that there is already an SQL prepared. Is there a native Tarantool prepared statement? Should I reopen one? @Totktonada @kyukhin

@Totktonada
Copy link
Member

Native requests are quite straightforward: they don't require parsing and generating of bytecode. There is no need to prepare them, because it would not give any performance benefits.

@jobs-git
Copy link
Author

I was thinking if it was possible to further strengthen tarantool security.

Native tarantool database calls might have a potential to do tarantool injection in the future.

Native tarantool prepare might be one solution to this.

@Totktonada
Copy link
Member

I see no relation. Please, show example of potentialy vulnerable userland code and I will able to respond something more certain (at least how to write it in a safe way).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested security sql
Projects
None yet
Development

No branches or pull requests

3 participants