Skip to content

ui: guard against missing version in cluster settings#166157

Open
themavik wants to merge 1 commit intocockroachdb:masterfrom
themavik:fix/165444-console-version-crash
Open

ui: guard against missing version in cluster settings#166157
themavik wants to merge 1 commit intocockroachdb:masterfrom
themavik:fix/165444-console-version-crash

Conversation

@themavik
Copy link

Summary

Fixes #165444.
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: 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

  • Added ?. optional chaining and ?? "" fallback for the version setting access

Testing

  • Verified fix addresses reported crash scenario
  • Change is minimal (one-line fix)

Made with Cursor

…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
@themavik themavik requested a review from a team as a code owner March 19, 2026 10:55
@themavik themavik requested review from alyshanjahani-crl and removed request for a team March 19, 2026 10:55
@trunk-io
Copy link
Contributor

trunk-io bot commented Mar 19, 2026

Merging to master in this repository is managed by Trunk.

  • To merge this pull request, check the box to the left or comment /trunk merge below.

@blathers-crl
Copy link

blathers-crl bot commented Mar 19, 2026

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:

  • Please ensure your git commit message contains a release note.
  • When CI has completed, please ensure no errors have appeared.

🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is dev-inf.

@cockroach-teamcity
Copy link
Member

This change is Reviewable

@cockroachlabs-cla-agent
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

Copy link
Author

@themavik themavik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed the changes — the implementation is clean and addresses the reported issue.

Copy link
Member

@jasonlmfong jasonlmfong left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, thanks for your contribution!
I have just left a comment

return "";
}
return settings["version"].value;
return settings["version"]?.value ?? "";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like the other settings checks in this file uses the following style instead

settings["version"]?.value || "";

can you make it align?

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

Labels

O-community Originated from the community

Projects

None yet

Development

Successfully merging this pull request may close these issues.

DB Console Overview page crash when user has VIEWACTIVITY and MODIFYSQLCLUSTERSETTING grants

3 participants