feat: gate analyze-files PII masking on pii-detection-scope#845
Merged
Conversation
Masking only runs when the deployed policy's pii-detection-scope is "Both" or "Files", in addition to the existing feature-flag and pii-in-flight-agents gates. The scope check lives at the call site because the decision is flow-specific — a prompt-only caller would need a different scope set. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
cristian-groza
approved these changes
May 12, 2026
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.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.



Summary
_is_pii_scope_for_fileshelper inanalyze_files_tool.pyand extended the PII-masker gate to also requirepii-detection-scope∈ {Both,Files}.PiiMasker.is_policy_enabled) — the decision is flow-specific; a prompt-only caller would need a different scope set.uipath-langchainto0.10.23and bumped theuipath-agentsfloor to match.Both,Files,Prompts, missing scope,None/empty policy, case-sensitivity) and end-to-end tests covering: scope-excludes-files skips masker, scope=Filesinvokes masker. Updated two existing tests to include the scope key in their mocked policy.Test plan
uv run pytest tests/agent/tools/internal_tools/test_analyze_files_tool.py— all 33 tests pass"pii-detection-scope": "Both"or"Files"and the file-PII flag is on"Prompts"even with the file-PII flag enabled🤖 Generated with Claude Code