Skip to content

[P1] [security] Boolean edit accepts 'true' string but saves as 0 — silent data loss #421

Closed

Description

@EVWorth

[P1] [security] Boolean edit accepts 'true'/'false' strings but emits them as 'true'/'false' literals — silent 0

Context

parseEditValue (EditableCell.tsx:55-71) handles numeric types by parsing Number(rawValue); for boolean types (BOOLEAN | TINYINT(1) | BOOL) the function returns the raw string.

Problem

Per docs/audits/results.md F24.

If the user manually types true in a TINYINT(1) cell, parseEditValue returns the string true. Save emits UPDATE ... SET is_active = 'true' → MySQL accepts as a string and converts to 0 (since 'true' isn't numeric). Silent data loss.

Files

  • src/components/grid/EditableCell.tsx:55-71

Repro (if applicable)

Static analysis only.

Expected

Type true → cell becomes checked checkbox (1). Type false → unchecked (0). Type yes → inline error "expected 0 or 1".

Proposed fix

Scope S. In parseEditValue, if isBooleanType(dataType), return parseInt(rawValue, 10) === 1 ? 1 : 0; reject other inputs with inline error.

Acceptance

Boolean values coerce correctly; invalid strings rejected with inline error.

Needs human verify

Yes

Labels: audit, area/results, severity/p1, kind/security

Activity

  1. added
    audit
    severity/p1
    kind/security
    area/results
    on Jul 31, 2026
  2. EVWorth commented on Sep 4, 2026

    @EVWorth
    OwnerAuthor

    Fixed by #531 (commit b4297c1). parseBooleanInput in src/lib/sql-types.ts returns 0 | 1 | undefined, and an unrecognised string now yields undefined — rejected — instead of silently coercing to 0. Typing true into a boolean cell no longer writes false.

    Not auto-closed because the PR body wrote Refs #421 rather than a closing keyword.

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

    area/resultsauditkind/securityseverity/p1

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions