Skip to content

An unknown WebSocket policy value passes the event through unredacted #716

Description

@rainmanjam

From the poka-yoke audit of 2026-09-04. Lens: fixed-value. Today: rung 0. Device reaches: rung 1 (Control). Silent.

The mistake available

Add a wsPolicy constant and miss one switch.

internal/api/ws_policy.go:120:

default:
    return ev, true      // pass the event through, unredacted

What happens

A read-scoped token receives the admin shape of an event — the redaction
that the policy exists to apply is skipped entirely. Silent: the socket works,
the event arrives, and it carries more than it should.

This is the same shape as requireScope treating an unrecognised scope string
as read-only, which the code gets right and documents:

A value that arrived from a newer schema or a hand-edited row should narrow
what a credential can do, never widen it.

The policy switch does the opposite.

Today

Rung 0. There is no .golangci.yml, so none of the 62 switch-without-default
sites has a linter behind it.

Device → rung 1, Control here

default: drops the event — fail closed. One arm, and it makes the
widening impossible rather than conventional.

Repo-wide, exhaustive in golangci-lint is the Warning that catches the
next one at the moment it is written.

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

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions