Skip to content

fix: 3 bugs related to token and user - #34219

Merged
guanshengliang merged 4 commits into
mainfrom
fix/token-user-bugs
Jan 9, 2026
Merged

fix: 3 bugs related to token and user#34219
guanshengliang merged 4 commits into
mainfrom
fix/token-user-bugs

Conversation

@localvar

@localvar localvar commented Jan 8, 2026

Copy link
Copy Markdown
Contributor

Description

fix 3 bugs:

  • can not set allow_token_num to 0
  • show tokens statements cannot be parsed
  • upgraded super user can be locked when enter too many times wrong password

Issue(s)

  • Close/close/Fix/fix/Resolve/resolve: Issue Link

Checklist

Please check the items in the checklist if applicable.

  • Is the user manual updated?
  • Are the test cases passed and automated?
  • Is there no significant decrease in test coverage?

Copilot AI review requested due to automatic review settings January 8, 2026 08:24
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @localvar, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request addresses three distinct bugs to improve user management and parsing capabilities. It rectifies an issue preventing the allow_token_num parameter from being set to zero, enables the correct parsing of SHOW TOKENS statements, and prevents super users from being inadvertently locked out due to failed login attempts. These changes enhance the robustness and usability of user configuration and system introspection.

Highlights

  • Allowing allow_token_num to be 0: The validation logic for the allow_token_num user option has been updated to correctly permit a value of 0, which was previously disallowed.
  • SHOW TOKENS statement parsing: An issue preventing the SHOW TOKENS statement from being parsed correctly has been resolved by fixing its mapping in the parser's system table adapter.
  • Super user account locking: Fixed a bug where upgraded super users could be locked out due to excessive failed login attempts by ensuring their failedLoginAttempts parameter is correctly initialized to -1 (no limit) during user decoding.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes three bugs related to token management and user security settings:

  • Enables setting allow_token_num to 0 to disallow tokens for a user
  • Corrects the table mapping for SHOW TOKENS statement which was incorrectly pointing to the encrypt_status table
  • Prevents upgraded super users from being locked out after failed login attempts by initializing security fields appropriately

Key Changes

  • Modified validation logic to allow allow_token_num = 0 as a valid value
  • Swapped the table name mappings for SHOW_TOKENS_STMT and SHOW_ENCRYPT_STATUS_STMT
  • Updated user initialization for older database versions to set super user security fields to -1 (unlimited) instead of restrictive defaults

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
source/libs/parser/src/parTranslater.c Swaps the table mappings for SHOW TOKENS and SHOW ENCRYPT STATUS statements to fix incorrect query routing
source/libs/parser/src/parAstCreater.c Removes validation that rejected allow_token_num = 0, allowing users to disable token generation
source/dnode/mnode/impl/src/mndUser.c Adds conditional initialization of security fields for super users during database upgrades, setting them to -1 to prevent lockouts, with separate handling for enterprise and non-enterprise builds

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread source/dnode/mnode/impl/src/mndUser.c

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request introduces fixes for three bugs related to user and token management. The changes correctly handle allow_token_num=0, resolve a parsing issue with show tokens, and prevent superusers from being locked out after an upgrade. The logic for these fixes appears sound. I have one suggestion to improve code maintainability in mndUser.c by removing a duplicated line of code.

Comment thread source/dnode/mnode/impl/src/mndUser.c Outdated
@localvar
localvar force-pushed the fix/token-user-bugs branch from aea4d29 to f47b99c Compare January 8, 2026 08:41
@localvar
localvar requested a review from zitsen as a code owner January 8, 2026 08:41
Comment thread docs/zh/14-reference/03-taos-sql/60-user.md Outdated
@localvar
localvar force-pushed the fix/token-user-bugs branch from f47b99c to 1e973b0 Compare January 8, 2026 09:04
@guanshengliang
guanshengliang merged commit 97d2bce into main Jan 9, 2026
17 of 18 checks passed
@localvar
localvar deleted the fix/token-user-bugs branch January 9, 2026 02:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants