|
11 | 11 | from __future__ import annotations |
12 | 12 |
|
13 | 13 | import ast |
14 | | -import os |
15 | | -from typing import Any, Iterator |
16 | 14 |
|
17 | | -from trpc_agent_sdk.tools.safety._exceptions import SafetyScannerError |
18 | 15 | from trpc_agent_sdk.tools.safety._facts import ( |
19 | 16 | ConcurrencyFact, |
20 | 17 | DependencyInstallFact, |
|
37 | 34 | ) |
38 | 35 | from trpc_agent_sdk.tools.safety._models import ScriptLanguage |
39 | 36 | from trpc_agent_sdk.tools.safety._rules import _LanguageScannerRule, SafetyRule |
40 | | -from trpc_agent_sdk.tools.safety._policy import is_sensitive_env_key |
41 | 37 | from trpc_agent_sdk.tools.safety._redaction import contains_secret_literal |
42 | 38 |
|
43 | 39 | # Networks libs and the attribute used to extract a host arg. |
@@ -404,10 +400,6 @@ def _pathlib_write(self, node: ast.Call, canonical: str) -> FileWriteFact: |
404 | 400 | if isinstance(node.func, ast.Attribute) \ |
405 | 401 | and isinstance(node.func.value, ast.Call): |
406 | 402 | target = _const_str(_first_arg(node.func.value)) or "" |
407 | | - size = None |
408 | | - if node.args: |
409 | | - data_arg = node.args[0] if node.args else None |
410 | | - size = self._static_size(data_arg) |
411 | 403 | if not target: |
412 | 404 | explicit = False |
413 | 405 | target = "<dynamic>" |
@@ -836,11 +828,10 @@ def _handle_sink_call(self, node: ast.Call, canonical: str) -> None: |
836 | 828 | if sink_kind is None and isinstance(node.func, ast.Attribute): |
837 | 829 | method = node.func.attr |
838 | 830 | if method in {"info", "debug", "warning", "warn", "error", "critical", "exception", "log"}: |
839 | | - if isinstance(node.func.value, ast.Name) \ |
840 | | - and node.func.value.id.lower() in {"log", "logger", |
841 | | - "logging"}: |
842 | | - sink_kind = "output" |
843 | | - sink_name = f"log.{method}" |
| 831 | + if isinstance(node.func.value, ast.Name): |
| 832 | + if node.func.value.id.lower() in {"log", "logger", "logging"}: |
| 833 | + sink_kind = "output" |
| 834 | + sink_name = f"log.{method}" |
844 | 835 | if sink_kind is None: |
845 | 836 | return |
846 | 837 | if not self._tainted_flows_into_call(node): |
|
0 commit comments