-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
postgres.db_create: fix handling of empty string #33261
Merged
cachedout
merged 4 commits into
saltstack:develop
from
orymate:postgres-db_create-fix-handling-empty-string-args
May 16, 2016
Merged
postgres.db_create: fix handling of empty string #33261
cachedout
merged 4 commits into
saltstack:develop
from
orymate:postgres-db_create-fix-handling-empty-string-args
May 16, 2016
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
return None | ||
if quote in value: # detect trivial sqli | ||
raise SaltInvocationError( | ||
'Unsupported character {0} in value: {0}'.format(quote, value)) |
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.
The second interpolation here should be {1}
.
Hi @orymate This looks good. Just one small concern that I noted inline and the rest should be good. Thanks! |
cachedout
added
Pending-Discussion
The issue or pull request needs more discussion before it can be closed or merged
Awesome
labels
May 16, 2016
orymate
force-pushed
the
postgres-db_create-fix-handling-empty-string-args
branch
from
May 16, 2016 14:17
27fd64d
to
7dfc9ea
Compare
Thanks, fixed the format string. |
The code responsible for collecting the parameters used in the CREATE DATABASE query works unexpectedly in case for values which are evaluated to False as bool, but are not None. This caused queries with missing rvalues like this one (lc_collate=""): 2016-05-13 16:04:05,243 [salt.loaded.int.module.cmdmod][ERROR ][2990] stderr: ERROR: syntax error at or near "OWNER" LINE 1: ..._production" WITH ENCODING = 'utf8' LC_COLLATE = OWNER = "g... Please note that proper escaping or a different approach would be needed here.
orymate
force-pushed
the
postgres-db_create-fix-handling-empty-string-args
branch
from
May 16, 2016 14:24
7dfc9ea
to
4b01d5d
Compare
Super! Thank you, @orymate |
gitebra
pushed a commit
to gitebra/salt
that referenced
this pull request
May 16, 2016
* commit '319a4d8288697de13b52b6f9e8ccf680820ea60f': Files without pkg.owner are not skipped (saltstack#33202) Fix two pure python errors causing UnboundLocalErrors (saltstack#33268) postgres.db_create: fix handling of empty string (saltstack#33261) new runner for vistara (saltstack#33263) linux_acl: Allow '-' as a separation character in ACL permissions. Fixes saltstack#31270 (saltstack#33172) Unbreak passwd change/expire reading on OpenBSD (saltstack#33227)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Awesome
Pending-Discussion
The issue or pull request needs more discussion before it can be closed or merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Fix handling of empty strings as parameters of postgres.db_create.
What issues does this PR fix or reference?
The code responsible for collecting the parameters used in the CREATE
DATABASE query works unexpectedly in case for values which are evaluated
to False as bool, but are not None.
This caused queries with missing rvalues like this one for db_create(..., lc_collate=""):
Please note that proper escaping or a different approach would be needed
here.
Previous Behavior
New Behavior
Success.
Tests written?
Yes