feat(python): add dataflow for default parameter values#1876
Merged
cfabianski merged 3 commits intoBearer:mainfrom Dec 16, 2025
Merged
feat(python): add dataflow for default parameter values#1876cfabianski merged 3 commits intoBearer:mainfrom
cfabianski merged 3 commits intoBearer:mainfrom
Conversation
- analyzer.go: Create alias from parameter name to default value, enabling string resolution through function parameters - filters.go: Return matched content from regex filter instead of empty string, allowing variable references to be captured Enables tracing values through Python function default parameters.
cfabianski
reviewed
Dec 16, 2025
cfabianski
approved these changes
Dec 16, 2025
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.
Enables tracing values through Python function default parameters.
Description
This PR adds dataflow tracking for Python function parameters with default values.
Problem: Previously, when a function parameter with a default value was used inside the function body, Bearer couldn't trace it back to the default value string.
Solution:
analyzer.go, create an alias from the parameter name to its default value during parameter analysisfilters.go, return the matched node content from theregexfilter instead of an empty stringExample - Before:
def connect(host: str = "localhost"):
return open_connection(host=host) # host couldn't be resolvedExample - After:
def connect(host: str = "localhost"):
return open_connection(host=host) # host now resolves to "localhost"This enables rules to detect string values passed through function parameters when they originate from default values.
Checklist
If this is your first time contributing please sign the CLA