-
Notifications
You must be signed in to change notification settings - Fork 55
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
Null character in text body crashes PG adapter #245
Comments
There is SQL escaping, but it's pretty minimal: https://github.com/geddy/model/blob/master/lib/datatypes.js#L62 That could use a lot of improvement, but could you at least add the null character there? |
@FlySwatter, I've invited you to the org, so you can just make the change and push it. If you need it in a release, make the change in the release branch, and merge back to master. I can push a version to NPM whenever you'd like. |
Oh wow, honored. Taking my shot at this! I have had some trouble running the model tests. I'm getting:
This is right in the Jakefile, so am I missing something? I've |
You're probably running an older (global) version of Jake. You can try updating your global Jake, or running it with the one installed locally ( |
I still mean to get to this, but in the meanwhile, including another note: Backslash characters are also not being escaped for postgres correctly. |
Added failing null character escaping test Fixes geddy#245
There's a character I'm getting as user input (have captured as a test), and it seems illegal to assign as a value in a
text
field with the Postgres adapter.In VIM it appears as
^@
, when I calltoString()
on the object, it displays as\\u0000\\n
. This seems to be the null character.I thought the adapter was escaping text in a way that this wouldn't happen. If this can crash Model's connection to PG, how I should be sanitizing my input differently to prevent this or other characters in the future from doing this?
The text was updated successfully, but these errors were encountered: