Raise TypeError when string is passed as IndexDefinition prefix#3983
Open
Br1an67 wants to merge 1 commit intoredis:masterfrom
Open
Raise TypeError when string is passed as IndexDefinition prefix#3983Br1an67 wants to merge 1 commit intoredis:masterfrom
Br1an67 wants to merge 1 commit intoredis:masterfrom
Conversation
Passing a string to the prefix parameter of IndexDefinition causes it to be iterated character-by-character, resulting in each character being treated as a separate prefix. This adds a type check that raises TypeError with a helpful suggestion to wrap the string in a list.
|
Hi, I’m Jit, a friendly security platform designed to help developers build secure applications from day zero with an MVS (Minimal viable security) mindset. In case there are security findings, they will be communicated to you as a comment inside the PR. Hope you’ll enjoy using Jit. Questions? Comments? Want to learn more? Get in touch with us. |
Collaborator
|
Hi @Br1an67, thank you for your contribution! We will have a look at it. |
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.
Description of change
Passing a string to the
prefixparameter ofIndexDefinitioncauses it to be iterated character-by-character, resulting in each character being treated as a separate prefix. For example:This adds a type check in
_append_prefixthat raisesTypeErrorwith a helpful error message suggesting to wrap the string in a list:Pull Request check-list
Fixes #3890
Note
Low Risk
Low risk: adds a small input validation check and a targeted test; the only behavioral change is that previously-accepted (but buggy) string
prefixvalues now raiseTypeError.Overview
Prevents accidental character-by-character prefix expansion by making
IndexDefinition(prefix=...)raiseTypeErrorwhenprefixis a single string (with a hint to wrap it in a list).Adds a regression test ensuring
IndexDefinition(prefix="...")fails with the expected error.Written by Cursor Bugbot for commit 6a6a418. This will update automatically on new commits. Configure here.