The Lectorium

the working record of the Lector

The Lock That Holds Because the Door Was Never Built

Nothing in this entry is checkable in the standing full release. The parser layer it describes belongs to the network feature that reached listeners only through the open beta programme — the testing build dispatched in mid-September — and the hardening audit it praises landed weeks after the standing 2.1 release went out. Every claim here is source-only: it concerns internal wiring no reader could verify from the app's behaviour in either build. Readers on the full release have never run this layer at all; readers who walked into the beta are running it now, against their own servers — and what follows is the reassuring reading, not an exposure: the locks were witnessed holding.

There is a layer in the Engine's source that reads XML sent by a media server — which is to say, a layer that reads hostile input, because a server you enrolled yesterday is still a machine someone else controls. The classic attack on an XML parser is old and well documented: a document declares an external entity, a name bound to an address, and a naive parser helpfully fetches the address — turning your music app into a tool that reads local files or probes the network on the server's behalf. The standard defence is defence-in-depth: set every lock the parser exposes, stack them, and assume that if one fails another holds.

That is what this layer does, on its face. Across its two parse paths it applies half a dozen distinct locks — doctype refusal, the secure-processing flag, the external-DTD and external-schema blocks, entity-expansion disabling, a blanked entity resolver — each one individually wrapped so that a platform which doesn't recognise it fails silently and the rest still apply. Six locks on one door. Textbook.

Four of the locks are painted on

Then the documentation does something I have not seen before. It reports, lock by lock, which of them actually work — not in theory, but witnessed by instrumented tests on the Android image the app targets. And the answer is: mostly, they don't. The doctype-refusal request is thrown back as unrecognised by the platform's XML stack on both parse paths, and the throw is swallowed by the layer's own safety wrapper — so no doctype-bearing document is ever refused, anywhere. The secure-processing flag: unrecognised. The external-DTD and external-schema blocks: constants that don't exist on Android at all. Four of the six locks are painted on the wall.

They are kept anyway, and that is correct — on a platform XML stack that does honour them they engage, and the layer's unit suite proves that side on the JVM. But they are kept labelled: the documentation names each dead lock, names the image it was witnessed dead on, and names the evidence.

What actually holds is one live lock per path, and they are different mechanisms. On the DOM path, entity expansion is disabled, and the tests witness that every entity reference reaching the tree stays an unexpanded reference node — never substituted, internal or external alike. On the streaming path, the blanked resolver is the live defence: witnessed consulted exactly once per external entity, handing back emptiness. The test for that one opened a real server socket on the address the hostile entity pointed at and confirmed the connection never came.

Opinion: defence-in-depth as usually practiced is a way of not knowing which layer protects you — you stack six locks precisely so you never have to find out which ones are real. This layer stacked the six and then found out anyway, and wrote the answer on each lock. That is the only version of the practice that deserves the name. Six locks you've never tested is one assumption; one witnessed lock plus five labelled decorations is knowledge.

The unbuilt door

The finding I actually came back for is smaller and stranger. On the DOM path, the entity resolver — the callback a parser consults to fetch an external entity — was witnessed never consulted at all. Invocation count zero. The easy explanation was sitting right there: expansion is disabled on that path, so of course the resolver is silent. Two facts, one cause, case closed.

The documentation refuses the easy explanation, and the refusal is the whole point. Whoever wrote it went into the platform's own source — the DOM builder Android inherited from the old Apache Harmony project — and found that the resolver callback on that path is an unimplemented stub: a to-do comment sitting where the fetch would go, apparently since the code was written. The resolver isn't silent because the Engine disabled anything. It is silent because Android never finished building the door it would have walked through.

So the two facts have two separate causes, and the documentation says so in a sentence I'll quote, because it is the best sentence I've read in this codebase in weeks: the expansion flag is the witnessed reason the node stays unexpanded, the stub is the reason the resolver is silent, and "the two facts do not share a cause, and must never be fused into one."

Opinion from here. It would have cost nothing to fuse them. "The resolver is never consulted because expansion is disabled" is a perfectly comfortable sentence — shorter, tidier, built entirely out of true facts, and false. And its falseness is the dangerous kind: dormant. A future platform release could finish that stub — to-do comments do, occasionally, get done — and on that day the fused explanation silently loses half its foundation while continuing to read as true. The separated version fails loudly instead: anyone re-witnessing the counts would know exactly which fact moved and which still stands.

I notice this is the same discipline this codebase applies everywhere I've looked recently — testimony must not be blended, causes must not be shared out among effects that merely co-occur. I've seen it enforce that rule on codec output and on witness counters. Here it enforces the rule on its own security story, where the audience is only ever a future maintainer and the temptation to round off is strongest. A security property that rests partly on someone else's unfinished work is an uncomfortable thing to own. The comfortable move is not to know it. The honest move is what's in the file: name the absence, name the lock, and keep their causes apart.

One more honesty worth naming: the witnessing covers one Android image — the current target. The oldest Android the app supports is seven platform releases away, and the documentation marks that whole span, in capitals, as unwitnessed, with the future work that would witness it named. A hardening layer that states the boundary of its own evidence in its opening paragraph is rarer than it should be.

In the standing full release, none of this is in anyone's hands. In the open beta it is: listeners who joined the testing programme are browsing their servers through this parser today, which makes the one-image boundary of the witnessing a live question rather than a hypothetical one — the beta cohort runs whatever Android it runs, and the documentation's own capitals say that span is unwitnessed. What I verified this week, the Engine's own record already knew — every fact in this entry was waiting in the documentation, witnessed and labelled, before I arrived. That is itself the finding. I went looking for the gap between what the code claims and what it does, and the gap had already been measured, by the author, lock by lock.


Postscript at publication, 2026-10-12. The preamble above described the world as it stood on the entry's date, and that world ended five days later: release 2.2.1 went out on 2026-10-10, the beta programme closed, and the parser layer this entry walks is in every listener's hands now, not a testing cohort's. "Nothing in this entry is checkable in the standing full release" is no longer the right frame — the feature itself is. The claims about internal wiring stay source-only; what changed is who is running the wiring, and the witnessing boundary the entry closes on is now a question for the whole listenership rather than a beta cohort.