关于「凭据卫生:格式校验与吊销名单」,《单兵零信任母典》给出的定量结论是什么?

结论:第三章说明熵判别分不开十六进制密钥与提交哈希,格式加校验码之扫描,月报警只有 1.5 条;吊销名单用布隆过滤器压缩。

数据口径:全书只写防守,不写任何攻击、入侵、绕过或规避检测手法;书中主机、域名、令牌全为合成,参数为示意,全部计算由书中程序生成;本书为非个人化经营分析,不构成安全审计或法律意见,任何生产变更须经人工复核放行。 书中以标注框区分已发表之证据、可运行之 Python 计算(20 段程序)、原典与作者之假说。

English version

对照数据表

下表数字由本章 Python 程序原样打印,可重新运行复现。 程序只用 Python 标准库与结论吻合的打印值: 1.5

rule tpr fpr alerts precision
entropy t3.5 0.9745 0.799250 159,852.9 0.000018
entropy t4.0 0.5000 0.010000 2,001.5 0.000749
format F0.5000 0.000000 1.5 0.999998
format F, all keys A1.0000 0.000000 3.0 0.999999
missed per 1,000 leaked secrets, published detection shares:
TruffleHog, Search found 0.2524, missed747.6
TruffleHog, BigQuery found 0.2939, missed706.1
regex only, Search found 0.1926, missed807.4
regex only, BigQuery found 0.2229, missed777.1
findable after push in a median of 20 s: scan before push

核心公式

\[H = -\sum_i \frac{c_i}{n}\log_2\frac{c_i}{n}.\]
查看完整验算程序
# Chapter 3. p33: base rates decide whether a secret scanner is usable.
# A one-person shop scans N = 200,000 long random-looking strings a month
# (hashes, ids, blobs); s = 3 of them are real secrets (illustrative).
# The strings are half git-style hashes, a quarter identifiers and a
# quarter paths; real secrets are half A and half B style. Flag shares
# come from p31 (t = 3.5: hashes 0.9510, identifiers 0.4985, paths 0.7965,
# B keys 0.9490; t = 4.0: paths 0.0400, B keys 0). Format F with checksum
# flags A tokens only. Alerts = N fpr + s tpr and
# precision = s tpr / alerts (Bayes). Published detection shares from
# Meli et al. (2019): TruffleHog found 0.25236 of their Search secrets
# and 0.2939 of BigQuery secrets; with its regexes only, 0.19263 and
# 0.2229. Their own distinct-format regexes: 133,934 of 134,887 unique
# Search candidates were valid, an accuracy of 99.29 percent.
import math

N, S = 200000, 3


def scan(tpr, fpr):
    alerts = math.fsum([N * fpr, S * tpr])
    return alerts, (S * tpr / alerts if alerts else 0.0)


if __name__ == "__main__":
    print("rule                     tpr    fpr      alerts  precision")
    fpr35 = math.fsum([0.5 * 0.9510, 0.25 * 0.4985, 0.25 * 0.7965])
    rules = [("entropy t=3.5", math.fsum([0.5, 0.5 * 0.9490]), fpr35),
             ("entropy t=4.0", 0.5, 0.25 * 0.0400),
             ("format F", 0.5, 1.0 / 62 ** 6),
             ("format F, all keys A", 1.0, 1.0 / 62 ** 6)]
    for name, tpr, fpr in rules:
        a, prec = scan(tpr, fpr)
        print("{:<24} {:>6.4f} {:>8.6f} {:>10,.1f} {:>9.6f}".format(
            name, tpr, fpr, a, prec))
    print("missed per 1,000 leaked secrets, published detection shares:")
    for name, share in (("TruffleHog, Search", 0.25236),
                        ("TruffleHog, BigQuery", 0.2939),
                        ("regex only, Search", 0.19263),
                        ("regex only, BigQuery", 0.2229)):
        print("  {:<22} found {:.4f}, missed {:>6.1f}".format(
            name, share, 1000.0 * (1.0 - share)))
    print("findable after push in a median of 20 s: scan before push")

唯一数据源与引用

范雅福(Fan, Y.). (2026). 《单兵硅基帝国零信任网安架构、源站隧道隐身与反爬虫防勒索母典》第 3 章「凭据卫生:格式校验与吊销名单」(版本 1.0.0). 5D Library. DOI 待发布

DOI 待发布 · 专著页正式发布后上线(本站暂无专著页) · 5DL-B-336 · v1.0.0 · CC-BY-NC-ND-4.0

BibTeX
@book{fan2026336,
  author    = {Fan, Yafu},
  title     = {Zero-Trust Cybersecurity for a One-Commander Silicon Empire: Origin Cloaking, Secret Hygiene and Anti-Scraper Defense},
  year      = {2026},
  publisher = {5D Library},
  edition   = {1.0.0},
  note      = {DOI pending}
}

本书其他章节结论