RANGER-5631: Fix setup passwords containing percent and backslash - #1159
Open
arnabnandy7 wants to merge 1 commit into
Open
RANGER-5631: Fix setup passwords containing percent and backslash#1159arnabnandy7 wants to merge 1 commit into
arnabnandy7 wants to merge 1 commit into
Conversation
Signed-off-by: Arnab Nandy <arnab_nandy7@yahoo.com>
arnabnandy7
force-pushed
the
fix/setup-password-special-characters
branch
from
August 15, 2026 08:03
decc6fa to
40de0a3
Compare
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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 changes were proposed in this pull request?
This pull request addresses RANGER-5631, where setup scripts fail when passwords contain
%or\.The proposed changes:
ConfigParserinterpolation in the UserSync, TagSync, and Ranger Admin upgrade scripts so%is treated as a literal character.shlex.quote()when adding database usernames and passwords to Unix Jisql commands.dba_script.pyanddb_setup.py.How was this patch tested?
The following lightweight local tests were performed:
%, such asTest%Pass1, is read literally with ConfigParser interpolation disabled.%and\round-trip unchanged through the Unixshlex.quote()andshlex.split()command-building path.Test\Pass1is accepted.git diff --checksuccessfully.Database integration tests were not run locally.
Relationship to the existing pull request
A separate pull request was opened because PR 1069 takes a broader approach that removes the complete Unix password denylist, including restrictions on single quotes, double quotes, and backticks.
Those characters are still interpolated into shell commands and database-specific SQL statements in several existing setup paths. Applying
shlex.quote()to Jisql connection arguments protects command-line argument construction, but it does not escape passwords embedded in SQL literals or protect otheros.system()call sites. Removing all restrictions before those paths are addressed could therefore introduce broken commands or command/SQL injection risks.This patch takes a narrower approach:
%handling by disabling ConfigParser interpolation in all affected copied property readers.shlex.quote()consistently to Unix Jisql credential arguments.dba_script.pyanddb_setup.py; changing only the DBA script would allow a password during database provisioning but leave the subsequent schema setup path inconsistent.This keeps the change scoped to the failures reported in RANGER-5631 while avoiding a broader relaxation of password validation without complete downstream escaping.