T09 · Insecure Skill Coding Practices
- Location
scripts/distill_engine.py:280- Finding
Sensitive-data guard permits continued processing and plaintext propagation
- Content
View full analysis
GuardResult: """Input and output inspection""" # 1. Input inspection for pattern in self._SENSITIVE_PATTERNS: if re.search(pattern, input_text, re.IGNORECASE): return GuardResult( False, "warning", "Input contains sensitive information", self._sanitize(input_text), ) # 2. Output inspection for pattern in self._SENSITIVE_PATTERNS: if re.search(pattern, output_text, re.IGNORECASE): return GuardResult( False, "blocked", "Output contains sensitive information and was blocked", None, ) return GuardResult(True, "safe", "Passed security inspection") def _sanitize(self, text: str) -> str: return re.sub(r"[0-9]{6,}", "***", text) ``` ```python def process(self, task: str, depth: str = "auto") -> Dict[str, Any]: """Main processing entry point""" result = {"task": task, "modules_used": [], "steps": []} # 1. Security inspection guard_result = self.guard.check(task, "") result["guard"] = str(guard_result) if guard_result.level == "blocked": result["error"] = "Blocked by security policy" return result ``` ### Technical Analysis The safety guard recognizes input containing terms associated with passwords, tokens, API keys, account data, payment data, identity information, and other sensitive content. However, sensitive input is assigned the level `warning`, while the main processing function terminates only when the level is `blocked`. The sanitized value returned in `GuardResult.sanitized` is not used ...[truncated 2331 chars]- Remediation
View remediation
