Skip to content

feat: add support for token-based authentication in TMQ configuration#473

Merged
zitsen merged 2 commits into3.0from
feat/xftan/tmq-token
Feb 7, 2026
Merged

feat: add support for token-based authentication in TMQ configuration#473
zitsen merged 2 commits into3.0from
feat/xftan/tmq-token

Conversation

@huskar-t
Copy link
Collaborator

@huskar-t huskar-t commented Feb 6, 2026

Description

feat: add support for token-based authentication in TMQ configuration

Issue(s)

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 February 6, 2026 02:41
@gemini-code-assist
Copy link

Summary of Changes

Hello @huskar-t, 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 introduces a significant enhancement by adding support for token-based authentication in TMQ configurations. This provides a more flexible and potentially more secure way for clients to connect. The changes include crucial security updates to prevent sensitive token information from being logged and a comprehensive update to the test suite to ensure the new authentication method is thoroughly validated, particularly for enterprise deployments.

Highlights

  • Token-based Authentication Support: Implemented support for token-based authentication within the TMQ (TaosData Message Queue) configuration, allowing for an alternative authentication mechanism.
  • Enhanced Security Logging: Modified logging mechanisms in controller/ws/tmq/tmq.go and db/syncinterface/wrapper.go to prevent sensitive td.connect.token values from being exposed in logs, similar to how passwords are handled.
  • Refactored and Expanded Test Suite: Refactored the existing TestTMQ function into a more generic doTMQTest to facilitate testing with different authentication methods. A new test, TestConnectToken, was added to specifically validate the end-to-end flow of token-based authentication, including user creation, token generation, and permission grants.

🧠 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.

Changelog
  • controller/ws/tmq/tmq.go
    • Updated TMQSubscribeReq.String() method to redact td.connect.token from logs for security.
  • controller/ws/tmq/tmq_test.go
    • Refactored TestTMQ into a new parameterized function doTMQTest to support varying database, topic, and token configurations.
    • Modified TMQ subscription request logic to conditionally use user/password or a connection token for authentication.
    • Added a new test TestConnectToken to verify the complete token-based authentication flow, including user and token management, and permission granting.
  • db/syncinterface/wrapper.go
    • Modified TMQConfSet to prevent logging of the td.connect.token value, enhancing security.
Activity
  • No human activity (comments, reviews) has been recorded on this pull request yet.
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.

@codecov-commenter
Copy link

codecov-commenter commented Feb 6, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 82.99%. Comparing base (3a37d9a) to head (8275bf0).

Additional details and impacted files
@@            Coverage Diff             @@
##              3.0     #473      +/-   ##
==========================================
- Coverage   83.05%   82.99%   -0.06%     
==========================================
  Files         172      172              
  Lines       23204    23204              
==========================================
- Hits        19272    19259      -13     
- Misses       3079     3095      +16     
+ Partials      853      850       -3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link

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

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 adds support for token-based authentication in the TMQ configuration. While the changes correctly handle the new td.connect.token property by preventing it from being logged, a critical security vulnerability was identified: the masking logic uses case-sensitive string comparisons, which could lead to sensitive tokens being leaked if configuration keys are provided in a different case. Furthermore, it was observed that raw request arguments are logged on JSON unmarshaling failures in the subscribe action, potentially exposing credentials. The test suite has been refactored to accommodate both password and token authentication, and a new test case for token authentication has been added, with a focus on improving its robustness and security.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This pull request adds support for token-based authentication in TMQ (TDengine Message Queue) configuration, enabling users to authenticate TMQ connections using tokens instead of username/password combinations. This is particularly useful for enterprise deployments that require more secure authentication mechanisms.

Changes:

  • Extended logging and string representation to exclude token values from logs (similar to password handling)
  • Added comprehensive test coverage for token-based TMQ authentication, including user/permission setup and token-based subscription

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
db/syncinterface/wrapper.go Added "td.connect.token" to the list of sensitive configuration keys that should not have their values logged
controller/ws/tmq/tmq.go Updated String() method to filter "td.connect.token" from debug output, preventing token exposure in logs
controller/ws/tmq/tmq_test.go Refactored TestTMQ into a parameterized doTMQTest function and added TestConnectToken to verify token-based authentication works correctly

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

@zitsen zitsen merged commit d09d2e0 into 3.0 Feb 7, 2026
29 checks passed
@zitsen zitsen deleted the feat/xftan/tmq-token branch February 7, 2026 09:59
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.

4 participants