Skip to content

Commit 66cb906

Browse files
committed
ux(web): 消除浏览器上传弹框,主推 scan --open v0.7.19
- webkitdirectory 选文件夹必触发原生"上传到此网站"弹框(浏览器机制删不掉,观感不正规) - 主推 npx shellward scan --open(项目目录一行,自动出报告开浏览器,无上传无弹框不出本机) - web客户端本地输入改回路径栏+目录浏览(服务端直读,无弹框),页面顶部推荐--open - README首屏主推--open
1 parent 2bdd781 commit 66cb906

5 files changed

Lines changed: 24 additions & 13 deletions

File tree

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,14 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/),
66
and this project adheres to [Semantic Versioning](https://semver.org/).
77

8+
## [0.7.19] - 2026-06-23
9+
10+
### Changed — 消除浏览器"上传到此网站"弹框
11+
- 浏览器选文件夹(webkitdirectory)必然触发原生"上传 N 个文件到此网站"弹框(浏览器安全机制,代码无法去除,观感"不正规")
12+
- **主推 `npx shellward scan --open`**:在项目目录一行命令,自动出报告并在浏览器打开——无上传、无弹框、无需路径、不出本机(最干净)
13+
- web 客户端本地输入改回**路径栏 + 目录浏览**(服务端直读,**无浏览器弹框**),并在页面顶部推荐 `--open`
14+
- README 首屏改为主推 `--open`
15+
816
## [0.7.18] - 2026-06-23
917

1018
### Changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ npx shellward scan
4747

4848
> 检测重点:**境外大模型端点与 SDK 依赖(数据出境——中国独有、英文工具没有的概念)**、硬编码密钥、文件中的中文 PII、`.env` 暴露。扫到境外模型(如 `openai` 依赖)时,**直接给出境内合规替代**(通义千问 / DeepSeek / Kimi / 智谱)及其 OpenAI 兼容 `base_url`——多数迁移只需改一个 `base_url`
4949
50-
想要图形界面、不用命令行?`npx shellward web --local` —— 浏览器打开**上传项目文件夹**即可体检,私有代码不出本机
50+
**想在浏览器里看报告?** 在项目目录跑 `npx shellward scan --open` —— 自动扫描并在浏览器打开报告**无需上传、无弹框、数据不出本机**(最干净)。也可 `npx shellward web --local` 起本地图形界面(粘贴/点选路径,服务端直读)
5151

5252
更多命令、运行时防护(MCP / 插件)、与英文文档见下方 [English](#english) 章节。
5353

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "shellward",
3-
"version": "0.7.18",
3+
"version": "0.7.19",
44
"mcpName": "io.github.jnMetaCode/shellward",
55
"description": "AI agent security & MCP security middleware — prompt injection detection, AI firewall, runtime guardrails & data-loss prevention for LLM tool calls. 8-layer defense against data exfiltration & dangerous commands. Zero dependencies. SDK + OpenClaw plugin. Supports LangChain, AutoGPT, Claude Code, Cursor, OpenAI Agents, Hermes Agent.",
66
"keywords": [

src/web/scan-server.ts

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -271,15 +271,16 @@ function formPage(local: boolean): string {
271271
<p class="hint">仅支持公开仓库(GitHub / GitLab / Gitee / Bitbucket)。大仓库可能超时——${local ? '此时用上方「上传文件夹」更稳。' : '<b>大仓库 / 私有代码请用本地客户端或 CLI</b>:<code>npx shellward web --local</code> / <code>npx shellward scan</code>(不上传)。'}</p>
272272
</form>`
273273

274-
// 本地模式:上传项目文件夹(浏览器选文件夹 → 仅发送源码/配置到本机服务扫描
274+
// 本地模式:主推命令行 --open(最干净);网页内用路径输入(无浏览器上传弹框
275275
const localForms = local ? `
276-
<form id="dirform">
277-
<label>选择项目文件夹,开始体检</label>
278-
<input type="file" id="dir" webkitdirectory directory multiple>
279-
<button id="dbtn" type="submit">开始体检 →</button>
280-
<div id="status" class="status"></div>
281-
<p class="hint">📂 选你的项目文件夹即可。浏览器可能提示"上传 N 个文件"——<b>实际只发送源码/配置(自动跳过 node_modules、图片、超大文件),且只到本机的本地服务、不出本机</b>。</p>
282-
</form>
276+
<div class="rec">💡 <b>最干净的方式</b>:在你的项目目录运行 <code>npx shellward scan --open</code> —— 自动出报告、在浏览器打开,<b>无需上传、无弹框</b>。或在下方直接体检:</div>
277+
<label>体检本地项目(服务端直读本机 · 零上传 · 无弹框)</label>
278+
<div class="pathrow">
279+
<input id="pathbar" placeholder="粘贴项目绝对路径,或在下方点选文件夹" spellcheck="false" autocomplete="off">
280+
<button id="scanbtn" type="button">体检 →</button>
281+
</div>
282+
<div class="browser"><ul class="dirs" id="dirs"></ul></div>
283+
<p class="hint">粘贴路径直接体检,或点文件夹进入;自动跳过 node_modules。私有代码<b>不上传、不出本机、无浏览器弹框</b>。</p>
283284
<details class="alt"><summary>或:体检公开仓库 URL</summary>${urlForm}</details>` : ''
284285

285286
return page('ShellWard 合规体检', `
@@ -320,7 +321,7 @@ function formPage(local: boolean): string {
320321
</footer>
321322
</main>
322323
<div id="overlay" class="overlay"><div class="spin"></div><div id="ovtext">扫描中…</div></div>
323-
${local ? UPLOAD_SCRIPT : ''}`)
324+
${local ? BROWSE_SCRIPT : ''}`)
324325
}
325326

326327
// 本地:统一路径栏 + 目录浏览器。粘贴路径 / 点选填充 → 服务端直接扫(零上传,跳过 node_modules)
@@ -424,6 +425,8 @@ input[type=file]::file-selector-button:hover{background:#a80000}
424425
.status{display:none;margin:10px 0 0;padding:10px 14px;border-radius:8px;background:#f1f5f9;color:#334155;font-size:13.5px;border-left:3px solid #cb0000}
425426
.hint{font-size:12.5px;color:#64748b;margin:8px 0 0;line-height:1.55}
426427
code,.hint code{background:#eef2f7;padding:1px 6px;border-radius:5px;font-size:12.5px}
428+
.rec{background:#f0f9ff;border:1px solid #bae6fd;border-radius:10px;padding:12px 14px;margin-bottom:14px;font-size:13px;color:#0c4a6e;line-height:1.6}
429+
.rec code{background:#0f172a;color:#7dd3fc;padding:2px 8px;border-radius:6px;font-size:12.5px}
427430
.pathrow{display:flex;gap:8px;margin-top:6px}
428431
.pathrow input{flex:1;font-family:ui-monospace,Menlo,monospace;font-size:13px}
429432
.pathrow button{padding:14px 22px;white-space:nowrap}

test-web.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ async function main() {
3838
test('服务启动并响应', up)
3939
if (up) {
4040
const home = await (await fetch(base + '/')).text()
41-
test('首页含上传文件夹表单', home.includes('webkitdirectory') && home.includes('dirform'))
41+
test('首页含路径栏(无上传弹框)', home.includes('pathbar') && home.includes('id="dirs"'))
4242
test('首页含 URL 入口', home.includes('公开仓库地址'))
4343

4444
// 目录浏览器:列子目录(零上传)
@@ -98,7 +98,7 @@ async function main() {
9898
test('公网服务启动', pup)
9999
if (pup) {
100100
const phome = await (await fetch(pbase + '/')).text()
101-
test('公网首页不含本地上传(只 URL)', !phome.includes('webkitdirectory') && phome.includes('公开仓库地址'))
101+
test('公网首页不含本地路径栏(只 URL)', !phome.includes('pathbar') && phome.includes('公开仓库地址'))
102102
// 公网模式禁止目录浏览(防止扫服务器硬盘)
103103
const browseBlocked = await fetch(pbase + '/browse?dir=/etc')
104104
test('公网模式拒绝目录浏览 (403)', browseBlocked.status === 403, `status=${browseBlocked.status}`)

0 commit comments

Comments
 (0)