Skip to content

Commit 3f0042e

Browse files
committed
Fix managed plugin kind metadata
Signed-off-by: lucarlig <luca.carlig@ibm.com>
1 parent e4c4a8b commit 3f0042e

9 files changed

Lines changed: 68 additions & 8 deletions

File tree

plugins/rust/python-package/encoded_exfil_detection/cpex_encoded_exfil_detection/plugin-manifest.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
description: "Detect suspicious encoded payload exfiltration patterns in prompts, tool outputs, and resources"
22
author: "ContextForge Contributors"
33
version: "0.2.0"
4+
kind: "cpex_encoded_exfil_detection.encoded_exfil_detection.EncodedExfilDetectorPlugin"
45
available_hooks:
56
- "prompt_pre_fetch"
67
- "tool_post_invoke"

plugins/rust/python-package/encoded_exfil_detection/pyproject.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ classifiers = [
1818
"Programming Language :: Python :: 3.13",
1919
]
2020

21+
[project.entry-points."cpex.plugins"]
22+
encoded_exfil_detection = "cpex_encoded_exfil_detection.encoded_exfil_detection:EncodedExfilDetectorPlugin"
23+
2124
[tool.maturin]
2225
module-name = "cpex_encoded_exfil_detection.encoded_exfil_detection_rust"
2326
python-source = "."

plugins/rust/python-package/retry_with_backoff/cpex_retry_with_backoff/plugin-manifest.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
description: "Rust-backed retry and backoff policy plugin for tool results"
22
author: "ContextForge Contributors"
33
version: "0.1.0"
4+
kind: "cpex_retry_with_backoff.retry_with_backoff.RetryWithBackoffPlugin"
45
available_hooks:
56
- "tool_post_invoke"
67
- "resource_post_fetch"

plugins/rust/python-package/retry_with_backoff/pyproject.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ classifiers = [
2121
"Programming Language :: Python :: 3.13",
2222
]
2323

24+
[project.entry-points."cpex.plugins"]
25+
retry_with_backoff = "cpex_retry_with_backoff.retry_with_backoff:RetryWithBackoffPlugin"
26+
2427
[tool.maturin]
2528
module-name = "cpex_retry_with_backoff.retry_with_backoff_rust"
2629
python-source = "."

plugins/rust/python-package/secrets_detection/cpex_secrets_detection/plugin-manifest.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
description: "Detect likely credentials and secrets in prompt input, tool output, and resource content"
22
author: "ContextForge Contributors"
33
version: "0.1.0"
4+
kind: "cpex_secrets_detection.secrets_detection.SecretsDetectionPlugin"
45
available_hooks:
56
- "prompt_pre_fetch"
67
- "tool_post_invoke"

plugins/rust/python-package/secrets_detection/pyproject.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ classifiers = [
1818
"Programming Language :: Python :: 3.13",
1919
]
2020

21+
[project.entry-points."cpex.plugins"]
22+
secrets_detection = "cpex_secrets_detection.secrets_detection:SecretsDetectionPlugin"
23+
2124
[tool.maturin]
2225
module-name = "cpex_secrets_detection.secrets_detection_rust"
2326
python-source = "."

plugins/rust/python-package/url_reputation/cpex_url_reputation/plugin-manifest.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
description: "Static URL reputation checks using blocked domains and URL patterns"
22
author: "ContextForge Contributors"
33
version: "0.1.1"
4+
kind: "cpex_url_reputation.url_reputation.URLReputationPlugin"
45
available_hooks:
56
- "resource_pre_fetch"
67
default_configs:

plugins/rust/python-package/url_reputation/pyproject.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ classifiers = [
1818
"Programming Language :: Python :: 3.13",
1919
]
2020

21+
[project.entry-points."cpex.plugins"]
22+
url_reputation = "cpex_url_reputation.url_reputation:URLReputationPlugin"
23+
2124
[tool.maturin]
2225
module-name = "cpex_url_reputation.url_reputation_rust"
2326
python-source = "."

tests/test_plugin_catalog.py

Lines changed: 52 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -173,28 +173,43 @@ def test_repo_validates_managed_plugins_layout(self) -> None:
173173
result = run_catalog("validate", str(REPO_ROOT))
174174
self.assertEqual(result.returncode, 0, result.stderr)
175175

176-
def test_repo_lists_rate_limiter_and_pii_filter(self) -> None:
176+
def test_repo_lists_all_managed_plugins(self) -> None:
177177
result = run_catalog("list", str(REPO_ROOT))
178178
self.assertEqual(result.returncode, 0, result.stderr)
179179

180180
payload = json.loads(result.stdout)
181181
self.assertEqual(
182182
{entry["slug"] for entry in payload["plugins"]},
183-
{"rate_limiter", "pii_filter"},
183+
{
184+
"encoded_exfil_detection",
185+
"pii_filter",
186+
"rate_limiter",
187+
"retry_with_backoff",
188+
"secrets_detection",
189+
"url_reputation",
190+
},
184191
)
185192
by_slug = {entry["slug"]: entry for entry in payload["plugins"]}
186193
self.assertEqual(
187194
{slug: entry["module_name"] for slug, entry in by_slug.items()},
188195
{
189-
"rate_limiter": "cpex_rate_limiter",
196+
"encoded_exfil_detection": "cpex_encoded_exfil_detection",
190197
"pii_filter": "cpex_pii_filter",
198+
"rate_limiter": "cpex_rate_limiter",
199+
"retry_with_backoff": "cpex_retry_with_backoff",
200+
"secrets_detection": "cpex_secrets_detection",
201+
"url_reputation": "cpex_url_reputation",
191202
},
192203
)
193204
self.assertEqual(
194205
{slug: entry["kind"] for slug, entry in by_slug.items()},
195206
{
196-
"rate_limiter": "cpex_rate_limiter.rate_limiter.RateLimiterPlugin",
207+
"encoded_exfil_detection": "cpex_encoded_exfil_detection.encoded_exfil_detection.EncodedExfilDetectorPlugin",
197208
"pii_filter": "cpex_pii_filter.pii_filter.PIIFilterPlugin",
209+
"rate_limiter": "cpex_rate_limiter.rate_limiter.RateLimiterPlugin",
210+
"retry_with_backoff": "cpex_retry_with_backoff.retry_with_backoff.RetryWithBackoffPlugin",
211+
"secrets_detection": "cpex_secrets_detection.secrets_detection.SecretsDetectionPlugin",
212+
"url_reputation": "cpex_url_reputation.url_reputation.URLReputationPlugin",
198213
},
199214
)
200215

@@ -1347,7 +1362,17 @@ def test_ci_selection_treats_shared_crate_changes_as_all_plugins(self) -> None:
13471362
def test_ci_selection_field_prints_json_and_bool_scalars(self) -> None:
13481363
result = run_catalog("ci-selection-field", str(REPO_ROOT), "all", "", "", "plugins")
13491364
self.assertEqual(result.returncode, 0, result.stderr)
1350-
self.assertEqual(json.loads(result.stdout), ["pii_filter", "rate_limiter"])
1365+
self.assertEqual(
1366+
json.loads(result.stdout),
1367+
[
1368+
"encoded_exfil_detection",
1369+
"pii_filter",
1370+
"rate_limiter",
1371+
"retry_with_backoff",
1372+
"secrets_detection",
1373+
"url_reputation",
1374+
],
1375+
)
13511376

13521377
result = run_catalog("ci-selection-field", str(REPO_ROOT), "all", "", "", "has_plugins")
13531378
self.assertEqual(result.returncode, 0, result.stderr)
@@ -1470,7 +1495,14 @@ def test_validator_rejects_maturin_python_source_drift(self) -> None:
14701495
self.assertIn("python-source", result.stderr)
14711496

14721497
def test_plugin_makefiles_expose_ci_targets(self) -> None:
1473-
for slug in ("rate_limiter", "pii_filter"):
1498+
for slug in (
1499+
"encoded_exfil_detection",
1500+
"pii_filter",
1501+
"rate_limiter",
1502+
"retry_with_backoff",
1503+
"secrets_detection",
1504+
"url_reputation",
1505+
):
14741506
makefile = (
14751507
REPO_ROOT
14761508
/ "plugins"
@@ -1480,15 +1512,27 @@ def test_plugin_makefiles_expose_ci_targets(self) -> None:
14801512
/ "Makefile"
14811513
)
14821514
text = makefile.read_text()
1483-
self.assertRegex(text, r"(?m)^\.PHONY:.*\bbench-no-run\b")
1484-
self.assertRegex(text, r"(?m)^bench-no-run:")
14851515
self.assertRegex(text, r"(?m)^\.PHONY:.*\binstall-wheel\b")
14861516
self.assertRegex(text, r"(?m)^install-wheel:")
14871517
self.assertRegex(text, r"(?m)^\.PHONY:.*\bci\b")
14881518
self.assertRegex(text, r"(?m)^ci:")
14891519
self.assertNotRegex(text, r"(?m)^ci:.*(?:^|\s)install(?:\s|$)")
14901520
self.assertRegex(text, r"(?m)^ci:.*\binstall-wheel\b")
14911521

1522+
def test_existing_benchmark_plugins_keep_bench_targets(self) -> None:
1523+
for slug in ("pii_filter", "rate_limiter"):
1524+
makefile = (
1525+
REPO_ROOT
1526+
/ "plugins"
1527+
/ "rust"
1528+
/ "python-package"
1529+
/ slug
1530+
/ "Makefile"
1531+
)
1532+
text = makefile.read_text()
1533+
self.assertRegex(text, r"(?m)^\.PHONY:.*\bbench-no-run\b")
1534+
self.assertRegex(text, r"(?m)^bench-no-run:")
1535+
14921536
def test_ci_workflow_uses_make_targets_for_plugin_checks(self) -> None:
14931537
workflow = (
14941538
REPO_ROOT / ".github" / "workflows" / "ci-rust-python-package.yaml"

0 commit comments

Comments
 (0)