-
Notifications
You must be signed in to change notification settings - Fork 1
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
SQL sanitization #4
Comments
User inputs a source ID for display, validate, and ingest commands. A user could try to use SQL injection by supplying a source id such as Need to sanitize provided crawler_source_id input |
A side benefit of using a library such as Example: from sqlalchemy import select
statement = select(CrawlerSource).order_by(CrawlerSource.crawler_source_id).where(CrawerSource.crawler_source_id == 13) The python statement is meant to mimic what SQL would look like, but we don't get to write the SQL ourselves... |
Following up on this idea.... all crawler source IDs are integers, so we could use |
Related issue... Some of the data we get back as GeoJSON has unprintable characters in strings. In and of itself, this is not a problem. But sometimes, those characters are backspace and delete characters, which can mess with the strings that get inserted into SQL statements. A brute-force method for dealing with this is to encode strings as ASCII, replacing non-ASCII with |
Really? That should probably just be an error that the provider should have to fix? |
I discovered it in some of the GeoJSON ... but none that we actually use. that is, such characters were included in properties that we don't rely on. So we could probably get away with not manipulating the strings as I describe. But it is also a super-fast operation that guarantees clean strings. In terms of having the provider fix them... I could generate a list of records that contain non-printables so we can notify them. I'll see how many and from which providers. |
sqlalchemy does not offer API calls within its The only piece of that raw SQL that varies is the table name, which is adapted from the EDIT: I now sanitize the |
I have changed my perspective on this. I have refactored to have
Validates source 13
Validates all sources found in the |
means by which sql statements are sanitized to remove attempts at injection.
The text was updated successfully, but these errors were encountered: