Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ on:
push:
branches:
- main
- 'release/**'

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

should this just be always on?

paths:
- pyproject.toml

Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@ on:
push:
branches:
- main
- 'release/**'
paths-ignore:
- pyproject.toml
Comment on lines 5 to 9
pull_request:
branches:
- main
- 'release/**'

jobs:
commit-lint:
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "uipath-langchain"
version = "0.16.7"
version = "0.16.7.post1"
description = "Python SDK that enables developers to build and deploy LangGraph agents to the UiPath Cloud Platform"
Comment on lines 1 to 4
readme = { file = "README.md", content-type = "text/markdown" }
requires-python = ">=3.11"
Expand Down
12 changes: 9 additions & 3 deletions src/uipath_langchain/agent/tools/internal_tools/pii_masker.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,14 +153,20 @@ def rehydrate(self, text: str) -> str:
return rehydrated

def _entity_thresholds_from_policy(self) -> list[PiiEntityThreshold]:
"""Extract enabled entity thresholds from the policy's ``pii-entity-table``."""
"""Extract entity thresholds from the policy's ``pii-entity-table``.

Every row in the table is requested. ``pii-entity-is-enabled`` is not
consulted: built-in categories carry it as ``true`` while custom rows
(e.g. ``FINationalID`` at 0.8) omit it entirely, so keying off it dropped
those rows from ``entityThresholds``. The service treats that list as an
allowlist, meaning a dropped row is never detected and its PII reaches
Comment on lines +158 to +162
the model unmasked.
"""
if not self._policy:
return []
table = self._policy.get("data", {}).get("pii-entity-table", [])
thresholds: list[PiiEntityThreshold] = []
for entry in table:
if not entry.get("pii-entity-is-enabled", False):
continue
category = entry.get("pii-entity-category")
confidence = entry.get("pii-entity-confidence-threshold")
if category is None or confidence is None:
Expand Down
39 changes: 36 additions & 3 deletions tests/agent/tools/internal_tools/test_pii_masker.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,15 @@ def test_returns_empty_when_table_missing(self):
masker = PiiMasker(Mock(), {"data": {}})
assert masker._entity_thresholds_from_policy() == []

def test_filters_disabled_entries(self):
def test_ignores_the_enabled_flag(self):
"""``pii-entity-is-enabled`` is not consulted, even when explicitly false.

Deliberate: the flag is absent on custom rows, so honouring it dropped
those categories from ``entityThresholds`` and, since the service treats
that list as an allowlist, left their PII unmasked. Presence in
``pii-entity-table`` is the only signal, so an explicit ``false`` no
longer disables a category — de-selecting one must remove its row.
"""
policy = {
"data": {
"pii-entity-table": [
Expand All @@ -111,7 +119,31 @@ def test_filters_disabled_entries(self):
]
}
}
assert PiiMasker(Mock(), policy)._entity_thresholds_from_policy() == []
assert PiiMasker(Mock(), policy)._entity_thresholds_from_policy() == [
PiiEntityThreshold(category="Email", confidence_threshold=0.5),
]

def test_includes_entry_without_enabled_flag(self):
"""Custom rows omit ``pii-entity-is-enabled`` entirely and must survive.

Regression: such rows were dropped from ``entityThresholds``, and since
the service treats that list as an allowlist the category was then never
detected.
"""
policy = {
"data": {
"pii-entity-table": [
{
"identifier": "FINationalID0.8",
"pii-entity-category": "FINationalID",
"pii-entity-confidence-threshold": 0.8,
},
]
}
}
assert PiiMasker(Mock(), policy)._entity_thresholds_from_policy() == [
PiiEntityThreshold(category="FINationalID", confidence_threshold=0.8),
]

def test_filters_entries_with_missing_category_or_confidence(self):
policy = {
Expand All @@ -130,7 +162,7 @@ def test_filters_entries_with_missing_category_or_confidence(self):
}
assert PiiMasker(Mock(), policy)._entity_thresholds_from_policy() == []

def test_returns_enabled_entries_as_thresholds(self):
def test_returns_every_table_row_as_a_threshold(self):
policy = {
"data": {
"pii-entity-table": [
Expand All @@ -157,6 +189,7 @@ def test_returns_enabled_entries_as_thresholds(self):

assert thresholds == [
PiiEntityThreshold(category="Email", confidence_threshold=0.5),
PiiEntityThreshold(category="Phone", confidence_threshold=0.7),
PiiEntityThreshold(category="SSN", confidence_threshold=0.9),
]

Expand Down
4 changes: 2 additions & 2 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading