|
|
|
|
|
by torgard
1679 days ago
|
|
Just a heads-up, you might want to take down the example website. Now that it's been posted to HN you might see malicious actors. I also think it's prone to SQL injection at the moment? At least, it's raising a syntax error when inputting an apostrophe. |
|
https://github.com/rehacktive/caffeine/blob/master/database/...
"INSERT INTO %v (id, data) VALUES('%v','%v') ON CONFLICT (id) DO UPDATE SET data = '%v'"
Use prepared statements and parameters passed to the db driver, not building strings with strings or you are vulnerable to sqli.
I'd also avoid using %v anyway when building strings - safer to use a specific type like %d for int.