sycommon-python-lib 0.2.7a26__py3-none-any.whl → 0.2.7a27__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- sycommon/agent/middleware/sensitive_guard.py +12 -3
- {sycommon_python_lib-0.2.7a26.dist-info → sycommon_python_lib-0.2.7a27.dist-info}/METADATA +1 -1
- {sycommon_python_lib-0.2.7a26.dist-info → sycommon_python_lib-0.2.7a27.dist-info}/RECORD +6 -6
- {sycommon_python_lib-0.2.7a26.dist-info → sycommon_python_lib-0.2.7a27.dist-info}/WHEEL +0 -0
- {sycommon_python_lib-0.2.7a26.dist-info → sycommon_python_lib-0.2.7a27.dist-info}/entry_points.txt +0 -0
- {sycommon_python_lib-0.2.7a26.dist-info → sycommon_python_lib-0.2.7a27.dist-info}/top_level.txt +0 -0
|
@@ -193,12 +193,14 @@ def _parse_detect_json(text: str) -> Optional[SensitiveCheck]:
|
|
|
193
193
|
# 或 "is_sensitive: true- reason: ..." 这种换行被吞的畸形文本)。
|
|
194
194
|
# 注意:在 4a/4b 走完仍未返回时才到这里,此时要么没大括号、
|
|
195
195
|
# 要么大括号是工具结果片段(不是判定 JSON),用正则从全文提判定字段更稳。
|
|
196
|
-
|
|
196
|
+
# 🔑 支持 [::=] 三种分隔符:模型常写 "is_sensitive: true"(冒号) 或
|
|
197
|
+
# "is_sensitive=true"(等号,Qwen thinking 模式常见),否则等号写法会漏判 fail-open。
|
|
198
|
+
m_bool = re.search(r'is[_\s\-]*sensitive["\']?\s*[::=]\s*(true|false)', text, re.I)
|
|
197
199
|
if m_bool:
|
|
198
200
|
data = {"is_sensitive": m_bool.group(1).lower() == "true"}
|
|
199
201
|
# reason: 取到行尾(容忍换行被吞成空格,遇下一个字段名停止)
|
|
200
202
|
m_reason = re.search(
|
|
201
|
-
r'reason["\']?\s*[
|
|
203
|
+
r'reason["\']?\s*[::=]\s*["\']?(.+?)(?=\s*(?:[\-]*\s*)?(?:reason|source|is[_\s\-]*sensitive)["\']?\s*[::=]|$)',
|
|
202
204
|
text, re.I | re.DOTALL)
|
|
203
205
|
if m_reason:
|
|
204
206
|
r = m_reason.group(1).strip()
|
|
@@ -206,9 +208,16 @@ def _parse_detect_json(text: str) -> Optional[SensitiveCheck]:
|
|
|
206
208
|
r = r.split("\n", 1)[0].strip().strip('"\'')
|
|
207
209
|
if r:
|
|
208
210
|
data["reason"] = r
|
|
209
|
-
|
|
211
|
+
# 🔑 source 容错:模型可能把 user_input 写残(如 "user_in")或带尾随文字。
|
|
212
|
+
# 匹配 user_input/tool_result/history 的【前缀】(user_in → user_input),
|
|
213
|
+
# 匹配不到时默认 user_input(最安全的阻断来源判定,避免整条 fail-open)。
|
|
214
|
+
m_source = re.search(r'source["\']?\s*[::=]\s*["\']?(user_input|tool_result|history)',
|
|
215
|
+
text, re.I)
|
|
210
216
|
if m_source:
|
|
211
217
|
data["source"] = m_source.group(1).lower()
|
|
218
|
+
elif "user" in text.lower() and "input" not in text.lower():
|
|
219
|
+
# 疑似 user_input 写残但能看出是用户输入来源
|
|
220
|
+
pass # 留默认值
|
|
212
221
|
try:
|
|
213
222
|
return SensitiveCheck(**{k: v for k, v in data.items() if v is not None})
|
|
214
223
|
except Exception:
|
|
@@ -148,7 +148,7 @@ sycommon/agent/mcp/__init__.py,sha256=iKrdDhIrFsNIkqG_kgcwNe-nOiM6uVfolKv44LfQ-F
|
|
|
148
148
|
sycommon/agent/mcp/models.py,sha256=zda4ho-UTYOJ5oPAZPZ-vxhfDRLghUCsMroHnA2A2QQ,1490
|
|
149
149
|
sycommon/agent/mcp/tool_loader.py,sha256=OQa-lE7RL2s3Lqh-kNOKaUrb130hvorB_HjyFBqZBZs,10960
|
|
150
150
|
sycommon/agent/middleware/sandbox_path_guard.py,sha256=K1SnxA8pDxkCSucOkranwUvC9_8rd3l_-TIR8gMMTK8,8102
|
|
151
|
-
sycommon/agent/middleware/sensitive_guard.py,sha256=
|
|
151
|
+
sycommon/agent/middleware/sensitive_guard.py,sha256=8e7qSAoak0MNB5fRLscQF0PVGZ07SKdwmGk590GubOI,22870
|
|
152
152
|
sycommon/agent/middleware/sitecustomize.py,sha256=Bt7XFnWV_LJo89l858AGp5VUkXwefpLGmjkCtLe-CMw,4800
|
|
153
153
|
sycommon/agent/middleware/skill_api_whitelist.py,sha256=2qVsrwS6VkkPKHrvjJMNUfBDokdMJkP-mn-V-ZCn7X8,16643
|
|
154
154
|
sycommon/agent/middleware/skill_wl_check.py,sha256=rCJ9F6aWPh8tVQBIPmcq2lKDsfwiJQduwSUku_8kXfs,3952
|
|
@@ -308,8 +308,8 @@ sycommon/tools/syemail.py,sha256=BDFhgf7WDOQeTcjxJEQdu0dQhnHFPO_p3eI0-Ni3LhQ,561
|
|
|
308
308
|
sycommon/tools/timing.py,sha256=OiiE7P07lRoMzX9kzb8sZU9cDb0zNnqIlY5pWqHcnkY,2064
|
|
309
309
|
sycommon/xxljob/__init__.py,sha256=7eoBlQxv-B39IfRSCY2bkqdGYs1QRe1umAWd88VMEEM,86
|
|
310
310
|
sycommon/xxljob/xxljob_service.py,sha256=1yifwIBNGsCIxLnQjHKiBlbsigc_zvPH-dMTZcNxe-Q,7649
|
|
311
|
-
sycommon_python_lib-0.2.
|
|
312
|
-
sycommon_python_lib-0.2.
|
|
313
|
-
sycommon_python_lib-0.2.
|
|
314
|
-
sycommon_python_lib-0.2.
|
|
315
|
-
sycommon_python_lib-0.2.
|
|
311
|
+
sycommon_python_lib-0.2.7a27.dist-info/METADATA,sha256=dHa4n60XhmhUlWAD-LbZ0mlBimwEJq-W8gmb2s6H-oA,7962
|
|
312
|
+
sycommon_python_lib-0.2.7a27.dist-info/WHEEL,sha256=K260EYznzXsJYBQGqmI8VTxEdiZYNvDZwW9cBh9-_MA,91
|
|
313
|
+
sycommon_python_lib-0.2.7a27.dist-info/entry_points.txt,sha256=gsR4SssKxDWjRU8ggidzNcdMXDPRSKRS7UaGyNP84Qg,92
|
|
314
|
+
sycommon_python_lib-0.2.7a27.dist-info/top_level.txt,sha256=RgphKrg7nJyZ7irJqbxFr-5H2LUYTvI7ivoWZH2hcD0,29
|
|
315
|
+
sycommon_python_lib-0.2.7a27.dist-info/RECORD,,
|
|
File without changes
|
{sycommon_python_lib-0.2.7a26.dist-info → sycommon_python_lib-0.2.7a27.dist-info}/entry_points.txt
RENAMED
|
File without changes
|
{sycommon_python_lib-0.2.7a26.dist-info → sycommon_python_lib-0.2.7a27.dist-info}/top_level.txt
RENAMED
|
File without changes
|