Skip to content

frontend: helpers: clusterSettings: loadClusterSettings crashes on corrupted localStorage payload #7265

Description

@Kakumanu-Harshitha

Describe the bug

loadClusterSettings calls JSON.parse() without any error handling. When
localStorage contains a corrupted entry (e.g. due to a browser extension,
storage quota truncation, or a manual edit), a SyntaxError is thrown and
propagates uncaught to all 10+ callers (NamespacesAutocomplete, GlobalSearch,
NodeShellTerminal, PodDebugTerminal, etc.), causing a blank/crashed settings panel.

Additionally, valid but non-object JSON (e.g. 123, [], "string") passes
through silently and is returned as a non-object value, breaking all downstream
property accesses.

This is a follow-up to the closed issue #6023 which was never code-fixed.

To Reproduce

  1. Open DevTools → Application → Local Storage
  2. Set cluster_settings.<your-cluster-name> to {not valid json
  3. Navigate to any cluster settings page
  4. See SyntaxError crash / blank panel

Environment

  • Installation type: Any
  • Headlamp Version: current main

Are you able to fix this issue?

Yes (I will propose a PR)

Metadata

Metadata

Labels

kind/bugCategorizes issue or PR as related to a bug.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions