Skip to content

[finding] The anonymous-deny comment in runtime/domains/meta.ts is a broken sentence — a half-removed conditional left by #3963 #8872

Description

@qq9340100

Restart-when: any PR touches packages/runtime/src/domains/meta.ts (carry the comment repair as a declared rider)

Observation-class, no behavioural effect. Found while implementing #8848 (which is region-confined to the parts.length >= 2 block further down the same file), so it is out of that card's scope.

The site

packages/runtime/src/domains/meta.ts, the comment above the anonymous-deny block that opens handleMetadataRequest (currently :181:185 on origin/main; the block is stable but the line numbers are not, so match on the text):

// Defense-in-depth: the metadata catch-all must honour the same
// anonymous-deny (#2567) as the REST `/meta` routes (which serve `/meta` on
// the cloud runtime). Object/field schemas — SYSTEM-object schemas on a
// tenant-less host — must not be readable by anonymous callers when the
// an anonymous, non-system caller. Unconditional since #3963.

The last sentence does not parse: "must not be readable by anonymous callers when the / an anonymous, non-system caller." A conditional clause was half-deleted — "when the <condition>" lost its condition, and the fragment "an anonymous, non-system caller" is the tail of whatever the sentence used to say about the gate's predicate.

The trailing "Unconditional since #3963" is the clue to what happened: #3963 made the gate unconditional, and the edit that removed the condition from the code removed only part of the sentence describing it. The comment is now the only thing in the file that still gestures at a condition that no longer exists.

Why it is worth a line rather than nothing

The code itself is correct and unambiguous — shouldDenyAnonymous({ userId, isSystem }) with no guard around it — so nothing is broken and nothing is at risk. What is damaged is the one sentence a reader consults to find out why the gate is unconditional, on a security-adjacent block. A half-sentence is worse than no sentence here: it reads as though a condition exists and the reader simply cannot make it out, which invites someone to go looking for a predicate that was deliberately deleted.

Cheap to fix correctly: state that the gate applies to every caller resolved as anonymous and non-system, with no route or tenancy condition, and keep the #2567 / #3963 references.

Not in scope of #8848

#8848 restores the verb guard on the parts.length >= 2 block. Its PR deliberately does not touch this comment — it sits in a different region of the file and is a prose fix, not part of that invariant.


Generated by Claude Code


Generated by Claude Code

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions