Skip to content

preferences: feedback note persisted with no size bound #1055

Description

@electather

Module: preferences · Dimension: security · Severity: low · Location: apps/server/src/preferences/internal/feedback-log.ts:38

Problem

processNoteFields (line 38) and record() (line 92) persist the full user-supplied note verbatim to the feedback table. Only the sentiment/keyword classification input is capped at NOTE_CLASSIFY_MAX_CHARS (4096); the stored value is explicitly left unbounded (comment lines 41-42: 'The full note is always persisted'). No caller enforces a max length either: the MCP ent_feedback inputSchema (apps/server/src/mcp/composite-tools/ent-feedback.ts:223) declares note as a plain string with no maxLength, and line 149 only checks non-empty. Since recordFeedback is the module's public write entry point, the missing size guard's root cause is here.

Why it matters

An authenticated user can submit arbitrarily large notes (megabytes each) via ent_feedback; every one is written to the feedback table in full and retained indefinitely. Repeated submissions cause database/disk growth (storage-exhaustion DoS) and inflate the row set that listFeedbackForUser / rebuild passes must load into memory on each recommendation rebuild.

Suggested fix

Clamp or reject notes above a sane persisted maximum (e.g. slice to a few KB, or throw a PreferencesError) inside processNoteFields before building the row, so the stored value is bounded regardless of adapter validation.

Fable-panel validated: 3/3 votes.


Filed from automated per-module audit workflow (Opus/Sonnet research → Fable-panel decision). Unverified by a human — triage before acting.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions