Skip to content

Commit 134b9a2

Browse files
committed
fix: 收紧搜索 worker 兜底与 server 伪造段 evidence
兜底前端库识别把 search.<hash>.min.js 这种 mkdocs / docusaurus / vitepress 等文档站通用的搜索 worker 文件名加入 genericNames 黑名单——真实搜索库(Lunr / FlexSearch / Pagefind / Algolia)有专用规则和版权注释命中,兜底不该再多列一条「疑似前端库: search」。同时 Server / X-Powered-By 字段被反代叠加或伪造时(如 openresty, Microsoft-IIS/10.0),evidence 行只显示匹配命中的首段,避免用户看到拼接值误以为第二段也被采信。 将版本号提升到 1.3.45。
1 parent 857ae19 commit 134b9a2

4 files changed

Lines changed: 13 additions & 4 deletions

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "stackprism",
33
"private": true,
4-
"version": "1.3.44",
4+
"version": "1.3.45",
55
"type": "module",
66
"description": "StackPrism 用于检测网页前端、后端、CDN、SaaS、广告营销、统计、登录、支付、网站程序和主题模板线索。",
77
"scripts": {

src/background/dynamic-snapshot.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,9 @@ const isLikelyDynamicLibraryFileName = name => {
151151
'requirejs',
152152
'system',
153153
'systemjs',
154+
// 文档站 / 内容站常见的搜索 worker 文件名(mkdocs / docusaurus / vitepress 等都叫这名),
155+
// 真实的搜索库(Lunr / FlexSearch / Pagefind / Algolia)会通过专用规则或版权注释命中
156+
'search',
154157
// 站点自身的内部脚本,不是公共库
155158
'tgwallpaper'
156159
])

src/background/headers.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,14 +83,17 @@ const applyHeaderValueRuleList = (add: any, rules: any[], value: string, rawValu
8383

8484
// Server / X-Powered-By 字段正常只对应一个产品;带逗号往往是反代叠加或伪造
8585
// 只匹配第一段,避免被「openresty, Microsoft-IIS/10.0」这种伪造糊弄
86-
const primaryValue = headerName === 'server' || headerName === 'x-powered-by' ? value.split(',')[0].trim() : value
86+
const isSplitField = headerName === 'server' || headerName === 'x-powered-by'
87+
const primaryValue = isSplitField ? value.split(',')[0].trim() : value
8788
if (!primaryValue) return
89+
// evidence 也只显示首段,避免用户看到「server: openresty, Microsoft-IIS/10.0」误以为 IIS 也被采信
90+
const displayValue = isSplitField ? (rawValue?.split(',')[0]?.trim() ?? rawValue) : rawValue
8891

8992
for (const rule of rules) {
9093
if (!matchesHeaderPatterns(rule.patterns, primaryValue, rule)) continue
91-
const evidence = rule.evidence || `${headerName}: ${rawValue}`
94+
const evidence = rule.evidence || `${headerName}: ${displayValue}`
9295
add(rule.category || '其他库', rule.name, rule.confidence || '高', evidence)
93-
if (headerName === 'server' || headerName === 'x-powered-by') break // 这两个字段正常只标识一种产品
96+
if (isSplitField) break // 这两个字段正常只标识一种产品
9497
}
9598
}
9699

src/injected/page-detector.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -429,6 +429,9 @@ const detectPageTechnologies = async (ruleConfig: Record<string, unknown> = {})
429429
'requirejs',
430430
'system',
431431
'systemjs',
432+
// 文档站 / 内容站常见的搜索 worker 文件名(mkdocs / docusaurus / vitepress 等都叫这名),
433+
// 真实的搜索库(Lunr / FlexSearch / Pagefind / Algolia)会通过专用规则或版权注释命中
434+
'search',
432435
// 站点自身的内部脚本,不是公共库
433436
'tgwallpaper'
434437
])

0 commit comments

Comments
 (0)