▶ Cinematic fable · Watch on YouTube ▶ 影片版寓言 · 在 YouTube 观看

南陵药局烧出来的青瓷药瓮,封上火漆,要在各州府的常平仓里放上整整十年,等大疫之年才启封救命。

各州医官不认药工的脸,只认瓮口火漆上那方铁印——那是南陵三号窑主温衡的私章。规矩传了三代:药瓮要存十年,那方铁印就得管用十年。

既然铁印十年不能废,温衡就得替它操十年的心。白日里拴在腰间,夜里锁进床底樟木匣,连沐浴都不敢离身。可千日防贼终有一失:第七年冬夜,梁上君子撬开樟木匣,把那方铁印摸走了。

第二天一早,整座南陵药局陷入了死局。

若发公文宣告温衡的铁印作废,十二州府仓里存着的四万只真药瓮一夜之间全成了无凭之物——倒掉,大疫来时无药可救;留着,谁也分不清哪只是三年前封的真药,哪只是贼人昨夜拿真印盖出来的砒霜。

新请来的验封司主事苏绾站在窑口,听众掌柜吵了一上午,只说了一句话:

“印之所以会被偷,是因为你们非要留着它过夜。”

她定了一条让所有老师傅瞪圆眼睛的新规矩:从今日起,谁也不许存印。每封一批药瓮,当场抓一把软泥刻一方新章,往火漆上一按,转身就把泥章扔进白炽的窑火里烧成碎渣——每一方印,只许活一刻钟。

温衡第一个摇头:”苏主事,我今日捏个梅花纹扔了,明日捏个水波纹又扔了。十年后千里之外的医官开仓,他连这花纹见都没见过,凭什么信这是我温衡封的药,不是街口卖假药的随便捏的泥巴?”

苏绾指了指窑门外的牌坊:”你每日巳时进三号窑当值,总门不是刚给你发了一块当日当值腰牌吗?你捏好新泥章,先拿当值腰牌到我的验封窗前亮一亮。我核准是你本人当班,就在一张官凭纸上拓下你这枚新泥章的印样,再盖上我验封司的总印,写明——此临时泥章确系三号窑温衡所持,仅限今日巳时二刻至三刻有效。 你把官凭贴上瓮口,泥章照旧扔进窑火。”

满堂掌柜刚要拍手叫好,站在角落里的巡检官陆峥忽然按刀上前,拦住了众人。

“慢着!”陆峥盯着那只药瓮,一字一句地问,”苏主事,官凭上写的可是’仅限今日巳时二刻至三刻有效’?”

“不错,只活一刻钟。”

“那十年之后,外州医官开仓验药时,这张官凭岂不是已经过期整整十年了?到时候医官问起来,你必定教他们:’虽然官凭早已过期,但只要验封司总印是真的,照样算数。’既然过期十年也算数——”陆峥目光一凛,”倘若有个心怀鬼胎的学徒,在巳时二刻领了官凭,假装把泥章扔进窑火,实则藏进靴筒里带回家呢?三年之后,他半夜摸出这枚旧泥章,盖在一百瓮砒霜上,硬说这是三年前那一刻钟里封的旧货!火漆干了可不会开口说话,谁能戳穿他?再退一步,倘若有人半夜偷了温衡的当值腰牌,悄悄去你窗前领了一张一刻钟官凭,偷偷封十瓮毒药专害一家人,温衡天亮还蒙在鼓里,又当如何?”

窑房里鸦雀无声。泥印毁没毁,外人看不见;印是哪一年按下去的,火漆自己证不出。

苏绾却笑了。她推开后窗,指着镇子正中央那座人来人往的钟楼。

钟楼底下立着一卷十丈长的《公验长编》,各省药商每日傍晚都要抄录副本带回本省,谁也涂改不得半个字。

“印自己当然证不出时辰,”苏绾缓缓道,”所以规矩还有后半截——趁你那张官凭还活着的这一刻钟里,你必须抱着瓮号、印迹和官凭,穿过院子去钟楼底下登簿。守楼人抬头看一眼铜漏:眼下是巳时二刻半,官凭还活着!他当场把你的瓮号与印迹写进长编第八万四千九百一十二行,再给你开一张盖着钟楼铁戳的入簿时辰回执,一并封在瓮口。等巳时三刻一过,哪怕你的泥章没烧化、被人藏进了靴筒里,再去钟楼,守楼人连门都不会让他进。”

陆峥怔住了,在心里默默推演了一遍十年后的场景:

十年后,外州医官启封一只药瓮,只看三样东西——

  1. 看验封司总印与官凭:这枚临时印章当年确实发给了三号窑的温衡;
  2. 看官凭效期:早已过期十年——好得很,说明今天世上没人能再拿它去钟楼登新账;
  3. 看钟楼的入簿时辰回执:这只药瓮的印迹,确确实实是在十年前那活着的十五分钟窗口里写进《公验长编》的。

更妙的是,第二年春天,真有个内鬼半夜偷拿了三号窑的腰牌去领临时官凭。可只要登进《公验长编》,天下药商人人可见——天还没亮,三号窑负责盯账的学徒就在长编新页上看见一行”温衡寅时三刻封瓮十只”,当场敲钟追到码头,连人带船截在了闸口。

从那以后,南陵药局再也没有锁过一只樟木匣。每炉药封完,只听窑火里”啪”的一声轻响,泥印化作青烟,而真凭实据早已刻进了全天下都看得见的石头与长卷里。

——到这儿你大概已经认出来了:这就是云原生软件供应链里的无密钥签名(Keyless Code Signing,以 Sigstore / Cosign 为代表)。温衡腰间那块当日当值腰牌是 CI 流水线里的短期 OIDC ID Token;当场捏完就扔进窑火的泥章是内存里临时生成的一次性密钥对(ephemeral keypair);苏绾开出的”仅活一刻钟”官凭是 Fulcio 签发的短期 X.509 代码签名证书;而钟楼底下那卷公开防篡改的《公验长编》与入簿时辰回执,正是透明日志 Rekor 与它的签名录入时间戳(Signed Entry Timestamp, SET)。

这是什么

传统代码签名(PGP 或长期私钥文件)有一个根本悖论:签名必须比软件活得一样久,所以私钥也跟着被迫活那么久。 你今天构建一个容器镜像,两年后生产集群扩容拉取时还要验签。为了两年后能验过,那把私钥就得在开发者的笔记本、CI 系统的 Secret 变量或密钥库里躺上好几年——成了一块高价值的静态靶子。一旦私钥泄露撤销,要么过去几年的合法镜像集体失效,要么攻击者拿旧钥匙随意伪造签名。

Sigstore(由 Linux 基金会托管,核心组件为 Cosign、Fulcio、Rekor)把”管好长期钥匙”彻底改写成了“把身份换成十分钟短证书,再用公开透明日志钉死签名时刻”:

  1. 临时密钥与 OIDC 身份交换(Fulcio):构建任务(如 GitHub Actions Pod)在内存里生成一对全新的临时公私钥,私钥从不落盘。接着任务向 OIDC 提供方申请一枚短期身份令牌(证明”我是某仓库 main 分支某次构建”),连同临时公钥发给证书机构 Fulcio。Fulcio 校验令牌后,签发一张把临时公钥与工作负载身份(SAN 扩展) 绑在一起的 X.509 证书,有效期通常只有 10 分钟。
  2. 签名并写入透明日志(Rekor):构建任务用临时私钥对镜像摘要(digest)签名,随后立刻把签名、公钥证书与制品哈希提交进基于 Merkle 树的只追加公开透明日志 Rekor,然后直接在内存里销毁临时私钥。Rekor 校验证书在当前时刻仍然有效后,返回一条包含可信时间戳的录入回执(SET / 包含性证明 inclusion proof)。
  3. 跨年离线/在线验证:哪怕两年后那张 10 分钟证书早已过期,验证方(如 Kubernetes 准入控制器)也不看”证书今天有没过期”,而是验证三件事:证书链归属可信 Fulcio 根且身份匹配预期仓库 + 签名与镜像摘要匹配 + Rekor 的时间戳证明这次签名就发生在该证书当年存活的那 10 分钟窗口之内。

为什么重要

因为它第一次让开源社区与企业 CI/CD 在不保管任何长期私钥的前提下,拿到了密码学级别的供应链溯源与防篡改保证——这也是为什么 Kubernetes 官方镜像、Python(PyPI)、npm 来源证明(provenance)和 Homebrew 纷纷转向 Sigstore。

工程上落地这套机制时,故事里陆峥挑出的两个死穴,恰恰是生产配置最容易踩空的坑:

  • 只验签名、不绑身份,等于没验。 在传统公私钥里,你手里只有一把自家公钥,验过就代表是自家人;但在 Sigstore 里,全世界所有 GitHub 仓库都在用同一个公共 Fulcio 根证书!如果你运行 cosign verify 或配置 Kyverno / PolicyController 时不显式锁定 --certificate-identity(哪条工作流)和 --certificate-oidc-issuer(哪家身份源),任何攻击者用自己的免费 GitHub 账号跑一遍 Actions,同样能拿到一张 Fulcio 签发的合法证书与 Rekor 记录,大摇大摆通过你的准入检查。
  • 没有公开监控,透明日志只用了一半。 如果攻击者窃取了你的 CI 权限或某次构建被注入恶意步骤,他确实能拿到 10 分钟真证书完成签名;但正因为 Fulcio 的证书透明日志与 Rekor 全网公开可查,安全团队只要订阅自己仓库身份的日志监控(如 rekor-monitor),任何半夜冒出来的非预期签名都会像三号窑那十只寅时药瓮一样无所遁形。

它揭示了一个极漂亮的密码学设计范式:最安全的私钥,是签完名就已经不存在的那一把;而让一把”已死之钥”在十年后依然可信的秘诀,是把”我是谁”和”我在哪一刻出过手”拆开证明。

隐喻对应表

  • 要在常平仓存放十年的青瓷药瓮 —— 生命周期长达数年的软件制品、容器镜像或二进制包
  • 锁在床底樟木匣里的十年铁印 —— 传统长期代码签名私钥(PGP / 静态 cosign.key),泄露与轮换代价极高
  • 当场捏制、盖完即扔进窑火烧碎的泥章 —— 仅存在于内存中的一次性临时密钥对(ephemeral keypair),签完即毁
  • 总门发放的当日当值腰牌 —— CI/CD 或工作负载持有的短期 OIDC ID Token(证明仓库、分支与运行身份)
  • 苏绾的验封司窗口与”仅活一刻钟”官凭 —— Fulcio CA 校验 OIDC 令牌后签发的 10 分钟短期 X.509 签名证书
  • 把泥章偷藏靴筒、三年后盖砒霜冒充旧货 —— 数字签名自身不包含可信时间,若仅凭过期证书验签会遭事后盗钥回溯伪造
  • 钟楼底下公开只追加的《公验长编》 —— 基于 Merkle 树的公开防篡改透明日志 Rekor
  • 盖着钟楼铁戳的入簿时辰回执 —— Rekor 返回的签名录入时间戳(SET)与树包含性证明(inclusion proof)
  • 十年后核验”官凭真伪 + 回执落在当年一刻钟窗口内” —— 验证证书链、OIDC 身份扩展(SAN)及签名时间处于 [notBefore, notAfter] 有效期内
  • 天亮前在长编新页抓出”寅时三刻封瓮十只” —— 持续监控公开透明日志,第一时间发现身份被盗用签发的异常制品

The celadon medicine jars fired at the Nanling Apothecary Kiln are sealed in red lacquer and stacked inside provincial granaries for ten full years, waiting for a plague year before anyone breaks the clay.

County physicians hundreds of miles away do not know the potters’ faces. They know only the iron seal pressed into the lacquer on the lid — the private mark of Master Wen Heng of Kiln Three. For three generations the rule never changed: if a jar must sit ten years in storage, the seal that vouches for it must stay valid for ten years.

Because the seal could not be retired for ten years, Wen Heng spent ten years losing sleep over it. By day it hung from his belt; by night it sat triple-locked in a camphor box beneath his bed. Yet a thief needs only one night in three thousand. In the seventh winter, someone pried open the camphor box and walked off with the iron seal.

By dawn the entire Nanling Kiln was trapped.

Declare Wen Heng’s iron seal void, and forty thousand genuine medicine jars already sitting in granaries across twelve provinces turn untrusted overnight — dump them and people die when the plague comes; keep them and no physician on earth can tell a genuine jar sealed three years ago from a jar of arsenic stamped by the thief last night.

Su Wan, newly appointed mistress of the Assay Office, stood by the kiln mouth listening to the elders argue until noon. Then she spoke one sentence:

“A seal can only be stolen because you insist on keeping it overnight.”

She laid down a rule that made every old master stare: from today on, nobody keeps a seal. For each batch of jars, grab a lump of wet clay on the spot, carve a fresh stamp, press it into the lacquer once, and hurl the clay stamp straight into the white-hot kiln to shatter into slag. No seal may live longer than one quarter-hour.

Wen Heng shook his head first. “Mistress Su, if I carve plum blossoms today and smash the stamp, then carve river waves tomorrow and smash that too, a county physician ten years from now has never laid eyes on either pattern. Why should he trust it came from Wen Heng of Kiln Three and not a street peddler?”

Su Wan pointed to the archway outside. “When you enter Kiln Three for the morning shift, the Guild Gate already hands you today’s shift tally, does it not? Bring your freshly carved clay stamp and your live shift tally to my Assay Window. Once I see you are on shift in person, I take an impression of your new stamp on a slip of official paper, press my Assay Master Crest beside it, and write: This temporary stamp belongs to Wen Heng of Kiln Three — valid today from the second quarter of the Si hour to the third quarter only. Paste that voucher onto the jar lid, and throw the clay stamp into the fire as promised.”

The elders were halfway into applause when Inspector Lu Zheng stepped out from the corner, hand on his sabre, and stopped them.

“Wait,” Lu Zheng said, eyes fixed on the jar. “Your voucher reads valid today from the second quarter to the third quarter only?”

“One quarter-hour,” Su Wan said.

“Then ten years from now, when a provincial physician opens the granary, that voucher will be ten years expired. You will have to instruct every physician in the empire: Even though the voucher expired ten years ago, so long as the Assay Crest is genuine, trust the jar. Well, if an expired voucher still counts —” Lu Zheng’s voice dropped, “what if a crooked apprentice claims his voucher at the second quarter, pretends to toss his clay stamp into the furnace, slips it into his boot instead, and walks home? Three years later he pulls that old stamp out at midnight, presses it onto a hundred jars of arsenic, and swears they were sealed back during that valid quarter-hour three years ago! Dried lacquer cannot tell you what year it hardened. Worse still — what if a night-thief steals Wen Heng’s shift tally at three in the morning, gets a valid fifteen-minute voucher, seals ten poisoned jars for one chosen victim, and Wen Heng wakes at dawn never knowing his name was used?”

Silence fell across the kiln floor. Nobody outside can see whether a stamp truly burned, and a seal impression never proves when it was pressed.

Su Wan smiled and pushed open the rear lattice window, pointing to the drum tower in the middle of the market square.

Beneath the drum tower stood the Grand Public Chronicle — a hundred-foot ledger copied every evening by medicine merchants from every province, where no clerk could scratch out a single line without a hundred copies betraying him.

“A seal alone never proves the hour,” Su Wan said. “That is why the rule has a second half. While your fifteen-minute voucher is still alive, you carry the jar’s batch number, seal impression, and voucher across the square to the Chronicle. The keeper glances up at the bronze water-clock: half-past the second quarter — the voucher still breathes. He writes your batch and seal impression onto Line 84,912 of the public scroll, and hands you a stamped Chronicle Time-Receipt to seal onto the lid. Once the third quarter strikes, even if someone hid an unbroken stamp in his boot and crept back three years later, the Chronicle keeper wouldn’t let him through the door.”

Lu Zheng stood still, tracing what a physician ten years and a thousand miles away would check:

  1. Check the Assay Crest and voucher: this temporary stamp really was issued to Wen Heng of Kiln Three.
  2. Check the voucher’s window: expired ten years ago — good, which means nobody alive today can register new jars under it.
  3. Check the Chronicle Time-Receipt: this jar’s exact impression entered the Public Chronicle at Si-hour, 2.5 quarters ten years ago — squarely inside the fifteen minutes when the voucher was alive.

Better yet, the following spring an insider really did steal a Kiln Three shift tally before dawn to claim a temporary voucher. Because every entry went straight onto the public scroll in the open square, Kiln Three’s morning clerk spotted an unexpected line — Wen Heng, Yin-hour third quarter, ten jars — before sunrise, rang the alarm bell, and intercepted the boat at the river lock.

From that day on, Nanling Kiln never locked another camphor box. Whenever a batch was sealed, a soft crack sounded inside the white-hot kiln as the clay stamp turned to ash — while the proof lived on in open ink for ten years and more.

— By now you’ve probably recognised it: this is keyless code signing in cloud-native software supply chains, pioneered by Sigstore (Cosign, Fulcio, and Rekor). Wen Heng’s daily shift tally from the gate is a short-lived CI OIDC ID Token; the wet-clay stamp hurled into the kiln right after pressing is an in-memory ephemeral keypair whose private key is never written to disk; Su Wan’s fifteen-minute voucher is a short-lived X.509 code-signing certificate from Fulcio; and the open, append-only Grand Public Chronicle with its time-receipt is the Rekor transparency log and its Signed Entry Timestamp (SET).

What it is

Traditional code signing (PGP keys or long-lived .key files) suffers from a structural paradox: a signature must remain verifiable for the entire multi-year lifetime of an artifact, which forces the signing key to stay valid for years too. Build a container image today and a production cluster scaling up two years from now still needs to verify it. So that long-lived private key sits on a developer laptop, in a CI secret store, or inside an HSM wrapper year after year — a high-value static target. When it leaks and gets revoked, either years of legitimate releases break at once or attackers forge signatures indistinguishable from old ones.

Sigstore (hosted by the Linux Foundation around Cosign, Fulcio, and Rekor) replaces long-lived secret custody with short-lived workload identity plus an immutable timestamped log:

  1. Ephemeral keys + OIDC identity exchange (Fulcio): A build job (such as a GitHub Actions runner or Kubernetes workload) generates a fresh keypair purely in memory. It requests a short-lived OIDC ID Token from its identity provider (proving “I am workflow release.yml on main at commit SHA ...“), and sends that token plus the ephemeral public key to the Fulcio certificate authority. Fulcio verifies the token and issues an X.509 certificate binding the ephemeral public key to the OIDC workload identity (in X.509 SAN extensions), valid for just 10 minutes.
  2. Sign, log, and destroy (Rekor): The job signs the artifact digest with the ephemeral private key, immediately submits the signature, certificate, and artifact hash to Rekor — a public, append-only Merkle transparency log — and discards the private key from memory. Rekor verifies that the certificate is currently valid and returns a Signed Entry Timestamp (SET) and Merkle inclusion proof.
  3. Verification years later: When a verifier (such as a Kubernetes admission controller) checks the image years after that 10-minute certificate expired, it does not ask whether the certificate is unexpired today. It verifies three facts together: the certificate chains to Fulcio and carries the expected OIDC identity + issuer, the signature matches the artifact digest, and Rekor’s timestamp proves the signature was recorded inside that certificate’s 10-minute [notBefore, notAfter] window.

Why it matters

Keyless signing gave open-source ecosystems and enterprise CI/CD cryptographic provenance without anyone ever storing, rotating, or leaking a signing private key — which is why official Kubernetes container releases, PyPI, npm provenance, and Homebrew adopted Sigstore.

In production, the two loopholes Inspector Lu Zheng raised map directly onto the two sharpest operational failure modes:

  • Verifying a Sigstore signature without pinning identity verifies almost nothing. With a classic static keypair, trusting your own public key implicitly pins who signed. With public Sigstore, every repository on GitHub shares the same public Fulcio root CA. If you run cosign verify or configure Kyverno / PolicyController without explicitly pinning both --certificate-identity (which repo/workflow) and --certificate-oidc-issuer (which OIDC provider), any attacker can sign a malicious image from their own free GitHub repo, get a completely genuine Fulcio cert and Rekor entry, and sail straight past admission control.
  • Transparency only catches stealth compromise if someone watches the log. If an attacker briefly hijacks a CI workflow, they can obtain a real 10-minute certificate during that run. Because both Fulcio’s certificate log and Rekor are globally auditable, running a log monitor (rekor-monitor) watching for your identity turns silent supply-chain signing into a loud, public event that gets caught like those ten pre-dawn jars at the lock.

The underlying cryptographic move is worth remembering far beyond containers: the safest private key is one that already ceased to exist five seconds after signing — and the way you keep a dead key trustworthy for a decade is to separate proving who held it from proving when it struck.

Metaphor mapping

  • Celadon medicine jars stored ten years in provincial granaries — long-lived software artifacts, container images, and release binaries
  • Wen Heng’s ten-year iron seal locked in a camphor box — a traditional long-lived code-signing private key (cosign.key / PGP), vulnerable to theft and painful revocation
  • The wet-clay stamp pressed once and hurled into the white-hot kiln — an in-memory ephemeral keypair whose private key is never persisted and wiped immediately after signing
  • Today’s Guild Gate shift tally — a short-lived workload OIDC ID Token attesting repository, workflow, and build identity
  • Su Wan’s Assay Window voucher (“valid for one quarter-hour only”) — a 10-minute Fulcio X.509 certificate binding the ephemeral public key to the OIDC identity
  • Hiding the clay stamp in a boot to stamp arsenic three years later — why raw digital signatures do not prove time, making expired short-lived certs unsafe without trusted timestamping
  • The open, append-only Grand Public Chronicle beneath the drum tower — Rekor, the Merkle-tree-backed public transparency log
  • The stamped Chronicle Time-Receipt on the jar lid — Rekor’s Signed Entry Timestamp (SET) and inclusion proof
  • Checking Assay Crest + identity + Time-Receipt inside the 15-minute window ten years later — cosign verify checking the Fulcio trust chain, OIDC SAN identity/issuer, and Rekor timestamp within [notBefore, notAfter]
  • Spotting “Yin-hour third quarter, ten jars” on the public scroll before dawn — transparency log monitoring (rekor-monitor) detecting unauthorized signatures issued under hijacked CI credentials
Daily Fables每日寓言 2026-11-16