Skip to content

Commit 4e966e0

Browse files
authored
Add secrets detection tool pre-invoke hook (#94)
* Add secrets detection tool pre-invoke hook Signed-off-by: lucarlig <luca.carlig@ibm.com> * Strengthen secrets detection mutation coverage Signed-off-by: lucarlig <luca.carlig@ibm.com> * Address secrets hook review feedback Signed-off-by: lucarlig <luca.carlig@ibm.com> * Cover resource findings without redaction Signed-off-by: lucarlig <luca.carlig@ibm.com> * Handle copy-on-write dict scanning Signed-off-by: lucarlig <luca.carlig@ibm.com> --------- Signed-off-by: lucarlig <luca.carlig@ibm.com>
1 parent 5077ff9 commit 4e966e0

14 files changed

Lines changed: 935 additions & 92 deletions

File tree

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "secrets_detection"
3-
version = "0.3.1"
3+
version = "0.3.2"
44
edition.workspace = true
55
authors.workspace = true
66
license.workspace = true

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
description: "Detect likely credentials and secrets in prompt input, tool output, and resource content"
22
author: "ContextForge Contributors"
3-
version: "0.3.1"
3+
version: "0.3.2"
44
kind: "cpex_secrets_detection.secrets_detection.SecretsDetectionPlugin"
55
available_hooks:
66
- "prompt_pre_fetch"
7+
- "tool_pre_invoke"
78
- "tool_post_invoke"
89
- "resource_post_fetch"
910
default_configs:

plugins/rust/python-package/secrets_detection/cpex_secrets_detection/secrets_detection.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ def __init__(self, config) -> None:
2020
async def prompt_pre_fetch(self, payload, context):
2121
return self._core.prompt_pre_fetch(payload, context)
2222

23+
async def tool_pre_invoke(self, payload, context):
24+
return self._core.tool_pre_invoke(payload, context)
25+
2326
async def tool_post_invoke(self, payload, context):
2427
return self._core.tool_post_invoke(payload, context)
2528

plugins/rust/python-package/secrets_detection/cpex_secrets_detection/secrets_detection_rust/__init__.pyi

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ __all__ = [
1212
class SecretsDetectionPluginCore:
1313
def __new__(cls, config: typing.Any) -> SecretsDetectionPluginCore: ...
1414
def prompt_pre_fetch(self, payload: typing.Any, _context: typing.Any) -> typing.Any: ...
15+
def tool_pre_invoke(self, payload: typing.Any, _context: typing.Any) -> typing.Any: ...
1516
def tool_post_invoke(self, payload: typing.Any, _context: typing.Any) -> typing.Any: ...
1617
def resource_post_fetch(self, payload: typing.Any, _context: typing.Any) -> typing.Any: ...
1718

0 commit comments

Comments
 (0)