Skip to content

feat: gate analyze-files PII masking on pii-detection-scope#845

Merged
yashwagle1 merged 2 commits into
mainfrom
feat/ChangePolicyForPIIMasking
May 12, 2026
Merged

feat: gate analyze-files PII masking on pii-detection-scope#845
yashwagle1 merged 2 commits into
mainfrom
feat/ChangePolicyForPIIMasking

Conversation

@yashwagle1
Copy link
Copy Markdown
Contributor

Summary

  • Added _is_pii_scope_for_files helper in analyze_files_tool.py and extended the PII-masker gate to also require pii-detection-scope ∈ {Both, Files}.
  • Kept the scope check at the call site (not in PiiMasker.is_policy_enabled) — the decision is flow-specific; a prompt-only caller would need a different scope set.
  • Bumped uipath-langchain to 0.10.23 and bumped the uipath-agents floor to match.
  • Added unit tests for the new helper (Both, Files, Prompts, missing scope, None/empty policy, case-sensitivity) and end-to-end tests covering: scope-excludes-files skips masker, scope=Files invokes 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
  • Verify in a deployed environment that masking activates when policy carries "pii-detection-scope": "Both" or "Files" and the file-PII flag is on
  • Verify masking is skipped when scope is "Prompts" even with the file-PII flag enabled

🤖 Generated with Claude Code

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>
@yashwagle1 yashwagle1 marked this pull request as ready for review May 12, 2026 07:44
@yashwagle1 yashwagle1 changed the title (wip) feat: gate analyze-files PII masking on pii-detection-scope feat: gate analyze-files PII masking on pii-detection-scope May 12, 2026
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@sonarqubecloud
Copy link
Copy Markdown

@yashwagle1 yashwagle1 merged commit 9ff96d1 into main May 12, 2026
48 checks passed
@yashwagle1 yashwagle1 deleted the feat/ChangePolicyForPIIMasking branch May 12, 2026 18:00
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.

2 participants