potiuk commented on PR #33328:
URL: https://github.com/apache/airflow/pull/33328#issuecomment-1675825804

   > > In the linked issue, I see:
   > > ```
   > > fillename = " file; SELECT * FROM DUAL" 
   > > ```
   > > 
   > > 
   > >     
   > >       
   > >     
   > > 
   > >       
   > >     
   > > 
   > >     
   > >   
   > > Does your change remove the leading space? If not, could you add a strip 
on `re.sub` result?
   > 
   > The change doesn't remove leading spaces. I presumed the issue was with 
SQL commands following any `;` - not sure if leading spaces cause any problems 
here. Happy to include a `strip()` though!
   
   I think it's a little bit more complex though, sheer presence of ";" is not 
enough, it will be "  ';" that will trigger it.
   
   I am thinking that better solution will be to actually use prepared 
statement in this case. Not sure if that works for this command (but there is 
no reason it should not):
   
   
https://dev.mysql.com/doc/connector-python/en/connector-python-api-mysqlcursorprepared.html
   
   This is the ultimate way how you can avoid sql injection type of problems 
like this one. 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to