ui: guard against missing version in cluster settings#166157
ui: guard against missing version in cluster settings#166157themavik wants to merge 1 commit intocockroachdb:masterfrom
Conversation
…5444) Root cause: selectClusterSettingVersion accessed settings["version"].value without checking if the "version" key exists. Users with MODIFYSQLCLUSTERSETTING but not VIEWCLUSTERSETTING get a filtered settings response that omits "version", causing a TypeError crash. Made-with: Cursor
|
Merging to
|
|
Thank you for contributing to CockroachDB. Please ensure you have followed the guidelines for creating a PR. Before a member of our team reviews your PR, I have some potential action items for you:
🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is dev-inf. |
|
|
themavik
left a comment
There was a problem hiding this comment.
Reviewed the changes — the implementation is clean and addresses the reported issue.
jasonlmfong
left a comment
There was a problem hiding this comment.
Hi, thanks for your contribution!
I have just left a comment
| return ""; | ||
| } | ||
| return settings["version"].value; | ||
| return settings["version"]?.value ?? ""; |
There was a problem hiding this comment.
It looks like the other settings checks in this file uses the following style instead
settings["version"]?.value || "";
can you make it align?
Summary
Fixes #165444.
Root cause:
selectClusterSettingVersionaccessedsettings["version"].valuewithout checking if the"version"key exists. Users withMODIFYSQLCLUSTERSETTINGbut notVIEWCLUSTERSETTINGget a filtered settings response that omits"version", causing aTypeError: Cannot read properties of undefined (reading 'value')crash on the DB Console Overview page.Fix: Added optional chaining to safely access the version setting value.
Changes
?.optional chaining and?? ""fallback for the version setting accessTesting
Made with Cursor