Skip to content

MAINT: Make safe extract and converter helpers keyword-only - #4344

Merged
Roman Lutz (romanlutz) merged 2 commits into
microsoft:mainfrom
madhusudanpatnaik:maint/keyword-only-helpers
Nov 19, 2026
Merged

Roman Lutz (romanlutz) merged 2 commits into
microsoft:mainfrom
madhusudanpatnaik:maint/keyword-only-helpers

Conversation

@madhusudanpatnaik

Copy link
Copy Markdown
Contributor

Description

Migrate four private helpers across safe extraction and text converters to keyword-only parameters to reduce the keyword-only baseline.

  • Make _reject_path_traversal in pyrit/common/safe_extract.py require keyword-only dest_real.
  • Make _validate_template and _escape_string_literal in pyrit/converter/code_attack_converter.py require keyword-only parameters.
  • Make _token_recall in pyrit/converter/decomposition_converter.py require keyword-only got.
  • Update internal callers and unit tests.
  • Remove migrated entries from build_scripts/keyword_only_baseline.txt.

Relates to #4216

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 AI balanced review requested due to automatic review settings November 16, 2026 20:04

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 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

@romanlutz

Copy link
Copy Markdown
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.

@madhusudanpatnaik

Copy link
Copy Markdown
Contributor Author

@microsoft-github-policy-service agree

@romanlutz
Roman Lutz (romanlutz) added this pull request to the merge queue Nov 19, 2026
Merged via the queue into microsoft:main with commit 8624b9b Nov 19, 2026
65 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants