Skip to content

lint: security-owd-alias cannot fire through defineStacksharingModel is a closed enum that refuses every alias the rule exists to name #16109

Description

@os-steve

Found while surveying which platform rules fire on objectstack-ai/hotcrm (its #1621, step 3 of epic #1579). Read-only survey, report-first, unassigned.

Measured against the pinned @objectstack/spec@17.3.0 / @objectstack/lint@17.3.0, hotcrm at 1670557.

The rule

validate-security-posture.ts carries, in one if / else if on the same value:

if (owd == null)                              -> SECURITY_OWD_UNSET      (error)
else if (typeof owd === "string" && OWD_ALIAS_FIX[owd]) -> SECURITY_OWD_ALIAS (error)

with OWD_ALIAS_FIX = { read: 'public_read', read_write: 'public_read_write', full: 'public_read_write', public: 'public_read_write' }.

Measurement — the two branches, same file, same anchor

src/objects/contract.object.ts, the single line sharingModel: 'private',:

injection result exit
line removed entirely security-owd-unset at error 1
sharingModel: 'read_write' (an OWD_ALIAS_FIX key) no rule verdictdefineStack refuses first 1

The refusal, verbatim from objectstack lint --json:

{"error":"[{\"code\":\"invalid_value\",\"values\":[\"private\",\"public_read\",\"public_read_write\",\"controlled_by_parent\"],\"path\":[\"sharingModel\"],\"message\":\"Invalid option: expected one of \\\"private\\\"|\\\"public_read\\\"|\\\"public_read_write\\\"|\\\"controlled_by_parent\\\"\"}]"}

The sibling branch firing at error/exit 1 on the byte-adjacent injection is the working control: the rule file is reached, the object is walked, and only the alias branch is unreachable.

What this means

sharingModel is a closed Zod enum containing exactly the four canonical values. Every key in OWD_ALIAS_FIX is refused at config load, so on any defineStack-authored app security-owd-alias is dead code: the value it exists to diagnose can never reach it.

That is not necessarily a defect — it may be correct that the schema is the stricter gate, and the rule may exist for a different intake (a raw JSON/YAML metadata path, an older artifact, a migration reader) that this repo does not exercise. What it is, definitely, is a reachability fact worth recording, because the rule is being counted as live coverage:

  • it is claimed as error-severity coverage on hotcrm's step-3 retirement table (its fix(security): close four P0 launch-readiness findings #1586), where an error rule reads as "already gating, retire the local duplicate today";
  • if the only intake it guards is one no app in this shape uses, that row is a false credit and the local assertion has to stay.

The ask is a statement of which intake security-owd-alias is for, and — if the answer is "none that survives the spec enum" — its retirement or re-scoping.

Dedupe

Targeted search returned 7 on-topic results in this repo (#8308, #8207, #7404, #7889, #7281, #5493, …) — non-zero and on-topic, which is the control that the search was not silently answering empty. None names security-owd-alias's reachability.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions