larry-zy commented on PR #1594:
URL: https://github.com/apache/dubbo-admin/pull/1594#issuecomment-6383981878

   **[P1] Redact credentials in JSON text before sending or indexing it**
   
   Reviewed head: `0f7c8a6ee72098e6c7deee0404b73fb6c35ddcda`.
   
   The credential-assignment pattern in 
[`ai/security/sanitizer.go:53`](https://github.com/apache/dubbo-admin/blob/0f7c8a6ee72098e6c7deee0404b73fb6c35ddcda/ai/security/sanitizer.go#L53)
 expects whitespace and an assignment separator immediately after the sensitive 
field name. It does not allow the closing quote between a JSON key and its 
colon. Consequently, this ordinary JSON text passes `SanitizeText` unchanged, 
with zero findings:
   
   ```json
   {"password":"review-fixture-secret","enabled":true}
   ```
   
   This affects real data boundaries, rather than only a standalone sanitizer 
API. 
[`modelInputView`](https://github.com/apache/dubbo-admin/blob/0f7c8a6ee72098e6c7deee0404b73fb6c35ddcda/ai/component/agent/react/model_view.go#L46-L58)
 filters message text with:
   
   ```go
   part.Text = sanitizer.SanitizeText(part.Text).Value
   ```
   
   A user pasting JSON configuration or a JSON log record therefore sends the 
credential to the model unchanged. The same text also passes 
`NewKnowledgeIndexPolicy().Prepare`, and a string log attribute containing it 
remains unredacted through `NewRedactingHandler`. Base64 encoding this JSON 
does not help: the decoded inspection uses the same pattern and also reports no 
findings. Structured Go maps are handled separately, so the existing nested-map 
tests do not cover these text cases.
   
   I reproduced all of the above at this head using synthetic credentials: the 
model-input copy retains the password, derived-index validation accepts it, and 
the JSON log output contains it. The canonical message remains unchanged, as 
intended. The same sanitizer regressions also reproduce at #1611's reviewed 
head `04fe99de`.
   
   Please handle quoted/escaped JSON sensitive keys at the text boundary, or 
safely inspect JSON text through the structured sanitizer, without rewriting 
canonical history. Add regressions for plain and encoded JSON at the 
model-input, logging, and derived-index boundaries.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to