@@ -92,6 +92,19 @@ async def test_prompt_pre_fetch_redacts_without_blocking(self, plugin):
9292 assert result .modified_payload .args ["input" ] == "AWS_ACCESS_KEY_ID=[REDACTED]"
9393 assert result .metadata == {"secrets_redacted" : True , "count" : 1 }
9494
95+ async def test_prompt_pre_fetch_leaves_clean_payload_unmodified (self , plugin ):
96+ payload = PromptPrehookPayload (
97+ prompt_id = "prompt-1" ,
98+ args = {"input" : "hello world" },
99+ )
100+
101+ result = await plugin .prompt_pre_fetch (payload , _make_context ())
102+
103+ assert result .continue_processing is True
104+ assert result .violation is None
105+ assert result .modified_payload is None
106+ assert result .metadata == {}
107+
95108 async def test_prompt_pre_fetch_blocks_without_redaction (self ):
96109 plugin = SecretsDetectionPlugin (_make_config (block_on_detection = True , redact = False ))
97110 payload = PromptPrehookPayload (
@@ -131,6 +144,22 @@ async def test_tool_post_invoke_redacts_mcp_content_payload(self, plugin):
131144 assert result .modified_payload .result ["isError" ] is False
132145 assert result .metadata == {"secrets_redacted" : True , "count" : 1 }
133146
147+ async def test_tool_post_invoke_leaves_clean_payload_unmodified (self , plugin ):
148+ payload = ToolPostInvokePayload (
149+ name = "writer" ,
150+ result = {
151+ "content" : [{"type" : "text" , "text" : "plain text" }],
152+ "isError" : False ,
153+ },
154+ )
155+
156+ result = await plugin .tool_post_invoke (payload , _make_context ())
157+
158+ assert result .continue_processing is True
159+ assert result .violation is None
160+ assert result .modified_payload is None
161+ assert result .metadata == {}
162+
134163 async def test_resource_post_fetch_redacts_text_content (self , plugin ):
135164 payload = ResourcePostFetchPayload (
136165 uri = "file:///tmp/secret.txt" ,
@@ -144,6 +173,19 @@ async def test_resource_post_fetch_redacts_text_content(self, plugin):
144173 assert result .modified_payload .content .text == "SLACK_TOKEN=[REDACTED]"
145174 assert result .metadata == {"secrets_redacted" : True , "count" : 1 }
146175
176+ async def test_resource_post_fetch_leaves_clean_payload_unmodified (self , plugin ):
177+ payload = ResourcePostFetchPayload (
178+ uri = "file:///tmp/secret.txt" ,
179+ content = ResourceContent (text = "plain text" ),
180+ )
181+
182+ result = await plugin .resource_post_fetch (payload , _make_context ())
183+
184+ assert result .continue_processing is True
185+ assert result .violation is None
186+ assert result .modified_payload is None
187+ assert result .metadata == {}
188+
147189 async def test_resource_post_fetch_blocks_when_threshold_met (self ):
148190 plugin = SecretsDetectionPlugin (
149191 _make_config (block_on_detection = True , redact = False , min_findings_to_block = 1 )
0 commit comments