aws-sdk-pandas icon indicating copy to clipboard operation
aws-sdk-pandas copied to clipboard

Sanitization of named parameters in athena.read_sql_query

Open frenchytheasian opened this issue 1 year ago • 4 comments

If I am reading the code for wr.athena.read_sql_query correctly, it looks like sanitization is not performed on named queries which are resolved client side. I think this would be a nice enhancement to the function, but am open to reason or arguments on leaving it out. If this is something that would be valuable in wrangler, I can work on a PR for this.

frenchytheasian avatar Dec 22 '23 17:12 frenchytheasian

Hi @frenchytheasian, could you please share a reference to the code where you believe Athena named queries are used within wr.athena.read_sql_query? AFAIK the user must supply the sql string at all times which is then sanitised.

jaidisido avatar Jan 02 '24 10:01 jaidisido

@jaidisido Sorry I misspoke in my original message. I don't believe sanitization is supported for named parameters (not named queries). The docs say that the formatter is applied client side here. It does not look any string values are sanitized for malicious characters.

frenchytheasian avatar Jan 03 '24 16:01 frenchytheasian

The _process_sql_parameters method is doing some validation around typing but not malicious characters. Additional sanitisation is always welcome so please feel free to contribute, thanks!

jaidisido avatar Jan 04 '24 09:01 jaidisido

@jaidisido Sounds good. Thanks for the responses! I'll try and tackle this hopefully soonish, but I won't make any promises on a timeline.

frenchytheasian avatar Jan 05 '24 16:01 frenchytheasian

Marking this issue as stale due to inactivity. This helps our maintainers find and focus on the active issues. If this issue receives no comments in the next 7 days it will automatically be closed.

github-actions[bot] avatar Mar 05 '24 18:03 github-actions[bot]