-
-
Notifications
You must be signed in to change notification settings - Fork 606
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
Extra spaces added by bandit.code.utils.concat_string #1009
Comments
Looks like all that is needed is to delete the space in the return statement |
concat_string is an internal function with a specific use. The problem as stated above implies this is a open function for any application. That is not its intention. Please describe how this affects Bandit and ideally an example use case. For example, how does it affect the injection_sql plugin? |
As I understand it concat_string is an internal function for revealing a string which has non-trivial construction within the source code. A contrived example for the injection_sql plugin would be something like sneaky_sql = 'SEL'+'ECT * FROM table1 WHERE %s' % (param, ) This wouldn't be detected. Whilst I'm not really concerned that this is a likely use case, I am looking into analyzing other data contained within strings which could be a security issue. It seemed reasonable to use the concat_string function to deal with non-trival strings, which is how I found this issue. I'm happy to put up a pull request to fix the issue, but the fix is just to remove the space from the .join |
tested and forked on my branch adding space rewritten func
Explanation: empty list called |
@OClark23 |
@DanOwens02 The code implementation is to extract string values from an abstract syntax tree and concatenate them into a single space-separated string that can be used for further processing. It would be easier to add a test for the code implementation you provided because it separates the string extraction process into a more readable and manageable format. it is all preference. |
Describe the bug
When calling bandit.code.utils.concat_string extra spaces are added between the strings which are concatenated.
Reproduction steps
Expected behavior
Extra spaces should not be added.
Remove the space used to .join() the strings on
bandit/bandit/core/utils.py
Line 305 in 72fa5a7
Bandit version
1.7.5 (Default)
Python version
3.9
Additional context
No response
The text was updated successfully, but these errors were encountered: