Skip to content

/govlist returns 500 when one governance object has non-JSON DataString #25

@bigpoppa-sys

Description

@bigpoppa-sys

routes/governance.js blindly does JSON.parse(entry.DataString) for every object returned by gObject_list(). That means one malformed or non-proposal object can take down the entire public governance feed for every caller.

Reproduction on current main:

  • I stubbed gObject_list() to return a single entry with DataString: '{not-json'.
  • POST /govlist returned 500 {"error":"internal"}.
  • The server log showed the parse failure: Expected property name or '}' in JSON at position 1.

Why this matters:

  • sysnode-info consumes this endpoint via src/lib/api.js::fetchGovernanceFeed(), so one bad chain object can blank the governance page instead of degrading gracefully.
  • The failure is all-or-nothing even though the route could safely skip or quarantine the offending entry.

Suggested fix:

  • Parse each object defensively instead of letting one JSON.parse abort the whole list.
  • At minimum, skip invalid entries and log the offending governance hash.
  • Even better, gate parsing on the expected proposal object type and preserve the rest of the feed.

Nightglass Audit

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions