Repository navigation
MAINT: Make safe extract and converter helpers keyword-only - #4344
Merged
Roman Lutz (romanlutz) merged 2 commits intoNov 19, 2026
Merged
Roman Lutz (romanlutz) merged 2 commits into
Roman Lutz (romanlutz) merged 2 commits into
Conversation
Migrate private helpers to keyword-only parameters to reduce the baseline: - _reject_path_traversal in pyrit.common.safe_extract - _validate_template and _escape_string_literal in pyrit.converter.code_attack_converter - _token_recall in pyrit.converter.decomposition_converter Update internal callers and unit tests, and remove entries from build_scripts/keyword_only_baseline.txt. Relates to microsoft#4216
Copilot started reviewing on behalf of
Madhu Sudan Sathujoda (madhusudanpatnaik)
November 16, 2026 20:04
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues remain for the keyword-only helper migration.
No open issues 🎉
What changed in this PR
This PR advances #4216 by migrating four private helpers to keyword-only secondary parameters, reducing the baseline without changing their underlying behavior.
Changes:
- Require explicit keywords for helper parameters in safe extraction and two converters.
- Update internal callers and the affected safe-extraction unit test.
- Remove the four migrated signatures from the keyword-only baseline.
| File | Description |
|---|---|
tests/unit/common/test_safe_extract.py |
Updates the traversal-check test to pass dest_real by keyword. |
pyrit/converter/decomposition_converter.py |
Makes got keyword-only and updates the recall calculation call. |
pyrit/converter/code_attack_converter.py |
Makes template-path and encoding parameters keyword-only and updates callers. |
pyrit/common/safe_extract.py |
Makes dest_real keyword-only and updates archive validation. |
build_scripts/keyword_only_baseline.txt |
Removes the four migrated helper entries. |
Review effort: Balanced
Contributor
|
Thanks for the contribution! This PR covers modules from #4216 that were not claimed first. Per that issue's rules, please claim one module at a time on the issue and wait for maintainer confirmation before opening a PR, so we can coordinate and avoid duplicated effort. Leaving this open for review; the modules it touches are now recorded on #4216. |
Contributor
Author
|
@microsoft-github-policy-service agree |
Co-Authored-By: Claude Fable 5 <[email protected]>
Roman Lutz (romanlutz)
approved these changes
Nov 19, 2026
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
Migrate four private helpers across safe extraction and text converters to keyword-only parameters to reduce the keyword-only baseline.
_reject_path_traversalinpyrit/common/safe_extract.pyrequire keyword-onlydest_real._validate_templateand_escape_string_literalinpyrit/converter/code_attack_converter.pyrequire keyword-only parameters._token_recallinpyrit/converter/decomposition_converter.pyrequire keyword-onlygot.build_scripts/keyword_only_baseline.txt.Relates to #4216