Repository navigation
fix(#21-#24) 多方案-sol-b:全面修复 4 个 issue - #26
Closed
Nicholas023 wants to merge 4 commits into
Closed
Nicholas023 wants to merge 4 commits into
Nicholas023 wants to merge 4 commits into
Conversation
…me 内绝对路径+符号链接逃逸写前校验
…扩展名锚定对齐、文件名清洗补 ~#&
Owner
Author
|
整合 PR #29 已吸收本方案精华并合并(lead 实测比对后取舍)。本 PR 关闭存档,diff 仍可通过本页查看。 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fix(#21-#24) 多方案-sol-b:全面修复 4 个 issue
#21 评审模型解析静默失败(js-yaml 依赖损坏被吞)
src/model-provider.js:65-74loadProfileLlmConfig() 的 catch 分支:空捕获改为catch (error),console.error输出真实错误原因(error?.message ?? error)并带[dsh-code-review]前缀便于检索;保持原return null契约不变(不抛异常)——scripts/switch-model-e2e.mjs 的check('解析出端点', !!ep)与运行态降级链均依赖「解析失败=返回 null 不抛」。#22 e2e/自检脚本在无 DeepSeek key 环境误报失败
scripts/engine-e2e-smoke.mjs:114:引擎存在判定后新增else ifkey 缺失分支——check('跳过引擎调用(key 缺失)')并短路,不再构造OCR_LLM_TOKEN: 'undefined'后 spawn 引擎空等 180s。scripts/sensitive-e2e-smoke.mjs:105-119:原整体嵌套在if (candidates.length > 0)内的断言重构——「报告文件已生成(评审链路未静默失败)」抽为独立判据无条件执行;「报告/引擎输出未含密钥值」两条泄露断言提到嵌套外,报告未落盘时也照常执行(reportPath 为空则跳过报告读取,不误报泄露)。评审失败本身被记录,杜绝静默假绿。#23 dsh-plugin.json 权限声明补安全校验承诺 —— 深度选择:声明 + 代码级校验(激进档)
dsh-plugin.json:19fs.write scope 补承诺:「写入前校验:目标须为 home 下绝对路径、解析符号链接后无目录遍历逃逸」。dsh-plugin.json:24process.spawn scope 补承诺:engine_bin「须为绝对路径且写入前校验文件存在、非符号链接、非 setuid 位」。dsh-plugin.json:30credentials.read reason 补承诺:「凭据仅用于 API 调用,绝不写入日志或评审报告」。src/set-config-tool.js:129-182新增 report_dir 代码级写前校验(观点:声明无代码背书 = 空洞承诺,自审一眼可识破「声明与实现脱节」;report_dir 与 engine_bin 同为「提示注入可指路径」攻击面,已有同风格范式,平移成本低)。实现:~展开/resolve → 必须落在homedir()之下(带分隔符前缀比较);对「最近存在的祖先」realpath 后仍在 home 内(防符号链接逃逸;报告目录消费端自动 mkdir,故目录不存在=合法输入);存在但非目录则拒绝;拒绝时删字段不入配置、原因进成功回显,整单仅剩被拒字段时返回「写入被拒」;落盘保存规范化绝对路径(消费端 expandHome 幂等)。#24 sensitive-list.js 敏感名单 4 处残留
:48token 词边界:tokens?后加(?=[._-]|$)——token 后必须分隔符或行尾,堵住「token 只是词前缀」业务命名(tokenizer-decoder.yml / tokenizer.config)误收。:31hidden-secret 归一:\.[^/]*secret(宽泛子串)→\.([^/]*[.\-_])?secrets?(?=[.\-_]|$)(secret 独立词段),与:60(secrets?|credentials?)明确分工:隐藏点文件归 :31、非隐藏归 :60,消除重叠。:40凭据扩展名锚定:(\.|$)→(\.[^/]+)?$,与 .env 行锚定形态对齐(.key.bak.bak 同口径)。:133报告文件名清洗:字符类补~ # &(防文件名注入报告格式)。门禁测试结果
环境说明:本机无引擎二进制(repo 未提交 bin/),故 e2e 三项的引擎调用形态 = 快速失败/跳过,全部 <1 分钟自然结束、无挂死、无新增异常形态,失败项均有明确 check 输出(符合任务判据:无 key/无引擎环境的失败/跳过形态允许)。
已知取舍