Hardening suggestions for codemodder-python / sqlp-formatop#362
Merged
andrecsilva merged 1 commit intosqlp-formatopfrom Mar 12, 2024
Merged
Hardening suggestions for codemodder-python / sqlp-formatop#362andrecsilva merged 1 commit intosqlp-formatopfrom
andrecsilva merged 1 commit intosqlp-formatopfrom
Conversation
| case cst.Name(): | ||
| target_acesses = self.find_accesses(node) | ||
| if target_acesses: | ||
| if target_acesses := self.find_accesses(node): |
Contributor
Author
There was a problem hiding this comment.
Replaces multiple expressions involving if operator with 'walrus' operator.
| new_target = self._handle_target(target.target) | ||
| if new_target: | ||
| if new_target := self._handle_target(target.target): | ||
| new_targets.append(target.with_changes(target=new_target)) |
Contributor
Author
There was a problem hiding this comment.
Replaces multiple expressions involving if operator with 'walrus' operator.
| match piece: | ||
| case cst.SimpleString() | cst.FormattedStringText(): | ||
| maybe_conversion = _convert_piece_and_parts( | ||
| if maybe_conversion := _convert_piece_and_parts( |
Contributor
Author
There was a problem hiding this comment.
Replaces multiple expressions involving if operator with 'walrus' operator.
| raw_value = extract_raw_value(node) | ||
| prefix = self.extract_prefix(node) | ||
| if prefix is not None: | ||
| if (prefix := self.extract_prefix(node)) is not None: |
Contributor
Author
There was a problem hiding this comment.
Replaces multiple expressions involving if operator with 'walrus' operator.
|
andrecsilva
added a commit
that referenced
this pull request
Mar 12, 2024
andrecsilva
pushed a commit
that referenced
this pull request
Mar 13, 2024
Use Assignment Expression (Walrus) In Conditional Co-authored-by: pixeebot[bot] <104101892+pixeebot[bot]@users.noreply.github.com>
andrecsilva
added a commit
that referenced
this pull request
Mar 13, 2024
andrecsilva
pushed a commit
that referenced
this pull request
Mar 14, 2024
Use Assignment Expression (Walrus) In Conditional Co-authored-by: pixeebot[bot] <104101892+pixeebot[bot]@users.noreply.github.com>
andrecsilva
added a commit
that referenced
this pull request
Mar 14, 2024
github-merge-queue bot
pushed a commit
that referenced
this pull request
Mar 14, 2024
* Format expressions initial implementation * Format expressions initial implementation * Transform to remove empty string formatting * Refactoring and documentation * Refactoring and documentation * Tests for printf style string parser * LinearizeStringExpression tests * Tests for SQL parameterization with printf format strings * Refactored and moved cleaning transformations * Refactoring and more tests * Linting * fixup! Refactoring and more tests * Hardening suggestions for codemodder-python / sqlp-formatop (#362) Use Assignment Expression (Walrus) In Conditional Co-authored-by: pixeebot[bot] <104101892+pixeebot[bot]@users.noreply.github.com> * fixup! Hardening suggestions for codemodder-python / sqlp-formatop (#362) * Small refactoring * fixup! Small refactoring * Better documentation * Disables RemoveUnnecessarFStr and test --------- Co-authored-by: pixeebot[bot] <104101892+pixeebot[bot]@users.noreply.github.com>
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.




I've reviewed the recently opened PR (361 - Adds support for format operators in SQLQueryParameterization) and have identified some area(s) that could benefit from additional hardening measures.
These changes should help prevent potential security vulnerabilities and improve overall code quality.
Thank you for your consideration!
docs | feedback
Powered by: pixeebot