@huaqiu/dsh-log 0.0.0-stage → 1.1.2
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.
- package/README.md +532 -2
- package/audit-core.ts +1149 -0
- package/dsh-log.yml +71 -0
- package/index.ts +848 -0
- package/package.json +36 -4
- package/tools/audit-log.mjs +391 -0
package/dsh-log.yml
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
# dsh-log.yml — configuration reference (spec §8)
|
|
2
|
+
#
|
|
3
|
+
# NOTE (real DSH deployment): this file documents the plugin configuration in
|
|
4
|
+
# the spec's standalone form. The DeepSeek Harness profile loader does NOT read
|
|
5
|
+
# this file directly — it composes the tree from the profile's cordis.patch.yml
|
|
6
|
+
# patch entries. Register the plugin there with the SAME values under `config`:
|
|
7
|
+
#
|
|
8
|
+
# - insert:
|
|
9
|
+
# - id: dsh-log
|
|
10
|
+
# name: ./dsh-log/index.ts
|
|
11
|
+
# config:
|
|
12
|
+
# apiAllowHosts: [api.example.com]
|
|
13
|
+
# scriptAllowDir: /opt/dsh/scripts/
|
|
14
|
+
# defaultTimeoutMs: 30000
|
|
15
|
+
# maxTimeoutMs: 120000
|
|
16
|
+
# maxReqLogBytes: 2048
|
|
17
|
+
# maxRespLogBytes: 2048
|
|
18
|
+
# maxOutputLogBytes: 512
|
|
19
|
+
#
|
|
20
|
+
# Field names map 1:1 to the spec's keys (api_allow_hosts → apiAllowHosts,
|
|
21
|
+
# script_allow_dir → scriptAllowDir, default_timeout → defaultTimeoutMs,
|
|
22
|
+
# maxReqLogSize → maxReqLogBytes, ...). See README.md.
|
|
23
|
+
#
|
|
24
|
+
# RENAMED (2026-11-05): plugin formerly known as api-script-log-skill.
|
|
25
|
+
# Host log files written before the rename keep the old
|
|
26
|
+
# `api-script-log-skill-*.jsonl` prefix and are no longer auto-discovered by
|
|
27
|
+
# tools/audit-log.mjs (pass --file to read them).
|
|
28
|
+
|
|
29
|
+
name: dsh-log
|
|
30
|
+
description: 提供API调用、外部脚本执行能力,输出结构化审计日志 (provides external API calls + whitelisted script execution with structured audit logging)
|
|
31
|
+
version: 1.1.2
|
|
32
|
+
author: custom
|
|
33
|
+
# 审计记录字段 (v1.0.1 起每条记录都带 phase: start|finished|error 与 seq: 1|2,
|
|
34
|
+
# 便于判断一次调用的记录是否完整;旧记录无这两个字段,读取端按字段推断)
|
|
35
|
+
config:
|
|
36
|
+
# API域名白名单 (API host whitelist — SSRF protection, exact host match, http/https only)
|
|
37
|
+
# 注意:只做精确字符串匹配,插件无法察觉某个条目本身就是元数据服务或内网主机。
|
|
38
|
+
# v1.1.2 因此在启动时静态分类每个条目:私有/链路本地/元数据地址与私有后缀域名会
|
|
39
|
+
# 记一条 WARN 事件 allowlist-risk(回环地址仅记 INFO,不告警),并在启动记录的
|
|
40
|
+
# allowlist 字段里列出全部发现;每次调用还会在 request.addressClass 上标记地址类别。
|
|
41
|
+
# 仅告警、不拒绝——访问内网 API 可能是合法的部署需求。
|
|
42
|
+
api_allow_hosts:
|
|
43
|
+
- api.example.com
|
|
44
|
+
# 脚本白名单目录 (script whitelist directory — bare file names only, path traversal refused;
|
|
45
|
+
# also the default working directory of the child process)
|
|
46
|
+
script_allow_dir: /opt/dsh/scripts/
|
|
47
|
+
# 脚本工作目录,留空则用 script_allow_dir (script working dir; empty → script_allow_dir)
|
|
48
|
+
script_working_dir: ""
|
|
49
|
+
# 默认超时毫秒 (timeout budget in ms; both tools, overridable per call via the `timeoutMs` arg)
|
|
50
|
+
default_timeout: 30000
|
|
51
|
+
# 单次调用超时上限 (ceiling for a per-call timeoutMs override; must be >= default_timeout)
|
|
52
|
+
max_timeout: 120000
|
|
53
|
+
# 日志单段最大字节,防止日志膨胀 (max bytes per log segment; overflow → [TRUNCATED])
|
|
54
|
+
maxReqLogSize: 2048
|
|
55
|
+
maxRespLogSize: 2048
|
|
56
|
+
maxOutputLogSize: 512
|
|
57
|
+
# 请求体上限字节:超出则零 I/O 直接拒绝 (max request BODY bytes; an oversized request is
|
|
58
|
+
# refused before any I/O — the symmetric counterpart of the response-body cap)
|
|
59
|
+
max_request_bytes: 1048576
|
|
60
|
+
# 响应体上限字节:超出则中止请求 (max response BODY bytes buffered; the live request is
|
|
61
|
+
# aborted beyond it — memory protection against a hostile endpoint)
|
|
62
|
+
max_response_bytes: 10485760
|
|
63
|
+
# 审计日志保留天数 / 单文件轮转上限 (retention days / per-file rotation budget)
|
|
64
|
+
log_retention_days: 14
|
|
65
|
+
max_log_file_size_bytes: 20971520
|
|
66
|
+
# 远端日志开关 v1.0先关闭,v1.2迭代 (remote log push — NOT implemented in v1.0;
|
|
67
|
+
# the host-log JSON lines emitted by this plugin are the v1.2 hook point)
|
|
68
|
+
enable_otel: false
|
|
69
|
+
tools:
|
|
70
|
+
- call_external_api
|
|
71
|
+
- run_external_script
|