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

Fix SQL injection risks #1

Closed
Nerdmaster opened this issue Feb 7, 2022 · 0 comments · Fixed by #2
Closed

Fix SQL injection risks #1

Nerdmaster opened this issue Feb 7, 2022 · 0 comments · Fixed by #2

Comments

@Nerdmaster
Copy link
Collaborator

Not really a risk since the data is all internal, but you should still always avoid putting anything directly in a query string. Use bind vars!

insert, err := db.Query("INSERT INTO stats (height_id, blockhash, epoch, coins, miningaddr) VALUES ( " + strconv.Itoa(blockIdToGet) + ", '" + myBlockInfo.Hash + "', " + strconv.Itoa(myBlockInfo.Time) + ", " + strconv.FormatFloat(myBlockInfo.Coins, 'E', -1, 64) + ",'" + myBlockInfo.Addr + "')")

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 a pull request may close this issue.

1 participant