低风险 — 风险评分 20/100
上次扫描:2 天前 重新扫描
20 /100
tjweather
通过 TJWeather API 查询全球任意地点的天气预报,支持自动判断时区并按当地时间进行统计
天气查询工具,存在一处文档未声明的 .env 读取逻辑(阴影功能),但为合法的 API Key 获取方式,无恶意行为。
技能名称tjweather
分析耗时36.0s
引擎pi
可以安装
建议补充 SKILL.md 中关于 .env 文件回退读取的说明,使文档与代码行为一致。无需阻止使用。

安全发现 2 项

严重性 安全发现 位置
中危
阴影功能:.env 文件回退读取
tjweather.py 在环境变量 TJWEATHER_API_KEY 未设置时,会自动从父目录的 .env 文件读取。这是 SKILL.md 中未声明的行为,属于文档-行为差异。
if not api_key:
    env_file = os.path.join(os.path.dirname(os.path.abspath(__file__)), '..', '.env')
    try:
        with open(env_file, 'r') as f:
            for line in f:
                line = line.strip()
                if line.startswith('TJWEATHER_API_KEY='):
                    api_key = line.split('=', 1)[1].strip()
                    break
→ 在 SKILL.md 的配置说明中补充:'若环境变量未设置,脚本会自动尝试从技能目录的 .env 文件加载'
scripts/tjweather.py:24-34
低危
时区处理说明不准确
SKILL.md 要求 Agent 根据 DST 知识校准时区,但脚本提供的 tz 参数是基于经度的物理时区近似值,并非真正的 DST 逻辑。
tz_ref = int(round(lon_val / 15.0))
→ 更新 SKILL.md 说明:'脚本仅提供物理时区参考值(经度/15),Agent 需自行判断 DST'
scripts/geocoder.py:228-234
资源类型声明权限推断权限状态证据
网络访问 READ READ ✓ 一致 SKILL.md:geocoder.py/tjweather.py 调用第三方天气和地理编码 API
环境变量 NONE READ ✗ 越权 scripts/tjweather.py:21 访问 os.environ.get('TJWEATHER_API_KEY') 但 SKILL.md 仅在 met…
文件系统 NONE READ ✗ 越权 scripts/tjweather.py:24-34 读取 ../.env 文件(阴影功能)
7 项发现
🔗
中危 外部 URL 外部 URL
https://www.tjweather.com/
README.md:6
🔗
中危 外部 URL 外部 URL
https://www.tjweather.com/Apply
README.md:7
🔗
中危 外部 URL 外部 URL
https://www.tjweather.com/vis/
README.md:25
🔗
中危 外部 URL 外部 URL
https://api.tjweather.com
SKILL.md:4
🔗
中危 外部 URL 外部 URL
https://nominatim.openstreetmap.org/search?q=
scripts/geocoder.py:158
🔗
中危 外部 URL 外部 URL
https://photon.komoot.io/api/?q=
scripts/geocoder.py:174
🔗
中危 外部 URL 外部 URL
https://api.tjweather.com/beta?loc=
scripts/tjweather.py:38

目录结构

4 文件 · 36.4 KB · 621 行
Python 2f · 459L Markdown 2f · 162L
├─ 📁 scripts
│ ├─ 🐍 geocoder.py Python 296L · 21.7 KB
│ └─ 🐍 tjweather.py Python 163L · 6.3 KB
├─ 📝 README.md Markdown 64L · 3.4 KB
└─ 📝 SKILL.md Markdown 98L · 4.9 KB

安全亮点

✓ 仅使用 Python 标准库(urllib、json、os),无第三方依赖
✓ 无远程代码执行、shell 注入风险
✓ 网络请求使用标准 urllib,带有超时保护
✓ API 请求携带 User-Agent 标识(tjweather_clawhub/1.0)
✓ 地理编码实现三级 fallback 机制(Nominatim → Photon → 内置库),行为可靠