Skip to content

[finding] mergeObjectDefinitions docblock promises 'other props: later value wins' but the implementation silently drops every non-enumerated prop #12680

Description

@os-zhuang

Found while resolving cloud#1653's named unknown (can a host override a framework object's tenancy declaration through the extension seam?).

packages/objectql/src/registry.tsmergeObjectDefinitions's docblock says:

Fields are merged additively. Other props: later value wins.

The implementation does not do the second half. It merges exactly: fields (additive), validations (additive), indexes (additive), and the three guarded scalars label/pluralLabel/description. Every other top-level prop on an extension is silently droppedmerged = { ...base } and nothing else is copied.

Why it matters: anyone who reads the docblock and ships an objectExtensions entry carrying, say, tenancy: { enabled: false } (the exact thing cloud#1653's investigation considered) gets a silent no-op — the ADR-0078 valid-but-inert shape, on a security-relevant key. The docstring nearly steered a real architecture decision this week.

Two candidate remedies (implementer/triage judges): fix the docblock to state the real (closed) merge set — cheap and honest; or implement the documented semantics — a much bigger decision, since "any extender may override any prop" would make security-relevant keys (tenancy, permissions) extender-writable, which is almost certainly NOT wanted. The docblock fix looks right; the prop-carrying question, if ever wanted, should be per-key and deliberate.

Metadata

Metadata

Assignees

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions