gunk-dev/the-valley
the-valley:bd-5eb6ccbbugopen

Schema key patterns accept keys that break them

State
free to start
Created
2026-10-26 by contributor
Source
2026-10-26, the build of oc-7ff8899

Body

In an open CUE struct, a key pattern such as `[#Name]: #Principal` constrains the values of matching keys but does not refuse keys that fail to match it. `schema/identity.cue` declares `principals: [#Name]: #Principal` this way, so the schema itself accepts a principal whose name breaks `#Name`. Such a registry is refused today only by an unrelated error further on, not by the name rule.

Found while building the read-access schema (oc-7ff8899), where `readers: {"../x": true}` was accepted until `readers` was closed with `close()`.

Fixed when every keyed map in the schemas whose keys must match a pattern (`principals` in `schema/identity.cue`, and any other `[#Pattern]: …` field in `schema/`) refuses a non-matching key with an error naming the rule, with a rejected example for each in the schema checks.

Source: 2026-10-26, the build of oc-7ff8899.

Comments

No comments.