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

pushing predicate generation into backend (important security issue) #60

Closed
tracyhenry opened this issue Feb 28, 2019 · 4 comments · Fixed by #147
Closed

pushing predicate generation into backend (important security issue) #60

tracyhenry opened this issue Feb 28, 2019 · 4 comments · Fixed by #147
Assignees

Comments

@tracyhenry
Copy link
Owner

right now the predicate functions are run in the client. The resulting predicates are then passed to the backend. This will invite SQL injections...

Tentative solution is to put the generation back into the backend. Also, it's necessary to write a parser to ensure the predicates generated are in "good form"

@tracyhenry
Copy link
Owner Author

been thinking about how to fix this.

In general, predicates are generated in two ways:

  • Initial predicates specified using the declarative model;
  • produced by the predicate function of a jump

Backend knows the initial predicates and the predicate functions. So to completely have the backend generate the predicates, we just need to have the client send the input (which is a data tuple) of the predicate function.

However, it is still possible for a hacker to send an "evil tuple" which causes the predicate function to generate an evil predicate. So I think we need to do some validations of the predicates generated... e.g. do not contain semicolons.

@asah
Copy link
Collaborator

asah commented Mar 29, 2019 via email

tracyhenry added a commit that referenced this issue Apr 22, 2020
@tracyhenry
Copy link
Owner Author

in the latest PR I basically did what you suggested -- writing a parser which only allows predicates conforming to a format like OR(AND(col1='str', col2='str'), AND(...)) no udf is allowed at the moment given no applications so far required it (most predicates we've seen are pk-fk).

@asah
Copy link
Collaborator

asah commented May 5, 2020

nice!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants