-
Notifications
You must be signed in to change notification settings - Fork 5
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
Use raw string for PostgreSQL connection string #209
base: develop
Are you sure you want to change the base?
Use raw string for PostgreSQL connection string #209
Conversation
The password, in particular, may contain backslash literals. This will ensure that such backslashes are not treated as the first character in a Python escape sequence.
Pull Request Test Coverage Report for Build 13640008976Details
💛 - Coveralls |
Hi Shane @jsf9k , just one comment, in the src/guacscanner/guacscanner.py file the instances where cursor.execute(ENTITY_COUNT_QUERY, (entity_name, entity_type)) is used these are examples of string concatenation which is a possible vulnerability for SQL injection. What's your thoughts? |
In this project I think it's OK. The values being concatenated do not originate from users but from the AWS API, and the latter is a trusted source. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense, but we should still test that this actually works as intended.
The only real way to test is to add a backslash to the PostgreSQL password in, say, our dev-a COOL environment. I will get @dav3r's assistance with that when we finish up the current cisagov/skeleton-packer Lineage wave. |
🗣 Description
This pull request modifies the Python code to use a raw string for the PostgreSQL connection string.
💭 Motivation and context
If the PostgreSQL password, for example, contains a literal backslash (
\
) character then we do not want it to be interpreted as the first character in a Python string escape sequence.It is highly unlikely that anyone would choose a host name, database name, username, or password that genuinely contains special characters like
\n
,\t
, etc.; therefore, it should be safe to treat all backslashes in the PostgreSQL connection string as literal backslashes.🧪 Testing
All automated tests pass.
✅ Pre-approval checklist
✅ Pre-merge checklist
✅ Post-merge checklist