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

276 table names are now validated to prevent sql injection #1186

Merged

Conversation

ratara
Copy link
Contributor

@ratara ratara commented Jan 22, 2023

Well, I googled a lot because I thought this is no new problem. I found a library called psycopg2 that solves the problem for postgresql. I think this library would work here but there was to much overhead to integrate this library.
I decided to solve the problem with a self-written method to validate table names.

Please take a look because it felt too easy. Maybe I forgot major problems here.

See issue: #276

@ratara ratara changed the title table names are now validated to prevent sql injection 276 table names are now validated to prevent sql injection Jan 22, 2023
@AndreasHeine
Copy link
Member

maybe we should replace some caracters rather then dont accept them!

; can also be injected as %3B... so they should be disallowed as well!

@ratara
Copy link
Contributor Author

ratara commented Jan 22, 2023

maybe we should replace some caracters rather then dont accept them!

; can also be injected as %3B... so they should be disallowed as well!

I can not recommend to replace characters because this leads to table names that are wrong and unexpected.
For the URL encoding topic: I am not sure, if there is anybody in the call chain that re-interprets the string in that way, or are they?

@oroulet
Copy link
Member

oroulet commented Jan 22, 2023

I am really not en expert on that but OK..

@oroulet oroulet merged commit 22b6a75 into FreeOpcUa:master Jan 22, 2023
@ratara ratara deleted the 276_history_sql_is_not_injection_safe branch January 22, 2023 16:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants