Skip to content

Do not crash the dashboard on an invalid grouping URL parameter - #1110

Open
abefarris wants to merge 1 commit into
turbot:developfrom
abefarris:fix-grouping-url-crash
Open

Do not crash the dashboard on an invalid grouping URL parameter#1110
abefarris wants to merge 1 commit into
turbot:developfrom
abefarris:fix-grouping-url-crash

Conversation

@abefarris

Copy link
Copy Markdown

Do not crash the dashboard on an invalid grouping URL parameter

Branch: fix-grouping-url-crashdevelop · 1 commit · ui/dashboard/src/hooks/useGroupingConfig.ts

Problem

The ?grouping= URL parameter is parsed with a bare JSON.parse and no shape
validation, so a malformed value takes down the whole dashboard with a white
screen. Four distinct fatal inputs:

Input Failure
?grouping=not-json SyntaxError from JSON.parse
?grouping="a string" .filter is not a function
?grouping={"panel":"nonsense"} .filter is not a function
?grouping={"panel":[{"type":null}]} Unknown group type null deep in tree building

Anyone can be handed a crashing link — a truncated paste of a shared URL is
enough. The sibling where= (filter) parameter already tolerates junk; this
brings grouping into line with it.

Fix

Wrap the parse in try/catch, validate the parsed shape (object of arrays), and
filter entries against the known grouping types. Unusable input degrades to the
default grouping instead of crashing.

Testing

Exercised all four inputs above plus valid configs in a live dashboard; junk
now renders the default view, valid params behave as before.

The grouping config is read from the ?grouping= query param and handed to
JSON.parse with no error handling, so a malformed or unexpected value
replaces the entire dashboard with an error boundary. Grouping is a
shareable-link surface, so these are reachable by anyone following a stale
or hand-edited URL, with no recovery except editing the URL:

  ?grouping={not-valid-json     Expected property name or '}' in JSON...
  [{"type":"banana"}]           Unknown group type banana
  {"panel":"nonsense"}          n.filter is not a function
  [{"type":null}]               Unknown group type null

Treat the parameter as untrusted: wrap the parse, require an object of
arrays, and drop entries whose type is not a known grouping type. Anything
unusable is ignored and the panel falls back to its default grouping, which
is how the sibling `where` (filter) parameter already behaves.

Partially valid values keep their usable levels: [{type:null},{type:result}]
now renders flat results instead of failing.
@CLAassistant

CLAassistant commented Aug 18, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants