Skip to content

db-pre-request / current_setting() variable replacement in select is safe? #2206

Answered by steve-chavez
SupaFuzz asked this question in Q&A
Discussion options

You must be logged in to vote

Hey Amy,

Yes, using current_setting is safe as it only returns text so if you got something like DROP BOBBY TABLES as an input it would only be a false WHERE condition.

Should I be concerned about sanitizing data found in token claims before using it in SQL statements?

Not for this case. You should only be concerned about this is if you are doing Dynamic SQL inside your function(which is a rare need). It is possible to make that safe as well though(example here).

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@SupaFuzz
Comment options

@SupaFuzz
Comment options

Answer selected by SupaFuzz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants