Skip to content

pkg/server: add internal user admin APIs - #68502

Open
bb7133 wants to merge 9 commits into
masterfrom
bb7133/add_user_api_master
Open

bb7133 wants to merge 9 commits into
masterfrom
bb7133/add_user_api_master

Conversation

@bb7133

@bb7133 bb7133 commented May 19, 2026 •

Copy link
Copy Markdown
Member

What problem does this PR solve?

Issue Number: ref #66620

Port of #66622 to master branch.

TiDB Cloud needs a safe way to manage temporary database users through the status API because cloud_admin can no longer rely on direct SQL user-management privileges. This PR adds mTLS-gated user admin endpoints on the status server.

What changed and how does it work?

  • POST /v1/internal/users — creates a new internal database user with username/password; returns 201 or 409 if user already exists
  • POST /internal/v1/users/{username}/reset-password — generates a new secure random password, updates the user password immediately
  • POST /internal/v1/users/{username}/roles — grants system roles to the target user
  • DELETE /internal/v1/users/{username} — deletes the user; returns 409 if it is the last remaining user

All endpoints are restricted to mTLS-authenticated requests. All accesses produce structured audit records.

Cherry-picked commits from #66622 (release-8.5) onto master, with conflict resolution:

  • pkg/server: add user api
  • update reset password API
  • Support audit log

Conflict resolutions:

  • pkg/server/handler/BUILD.bazel: merged new deps (//pkg/extension, //pkg/parser, //pkg/parser/auth) with master's existing //pkg/domain/serverinfo; dropped //pkg/parser/model (not imported by the code)
  • pkg/server/handler/tests/BUILD.bazel: kept master's shard_count = 45; added //pkg/extension dep alongside master's existing //pkg/domain/serverinfo and dxf deps
  • pkg/server/handler/tests/http_handler_test.go: kept both domain/serverinfo and extension imports

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  • No need to test
    • I checked and no code files have been changed.

Manual test: see #66622 for detailed manual verification steps.

Release note

Add mTLS-protected internal user admin APIs on the status server to create users, reset passwords, grant roles, and delete users, with audit logging for all accesses.

Summary by CodeRabbit

  • New Features
    • Added internal mTLS-only user administration APIs: create users, reset passwords, delete users, and assign roles; enforces mTLS and includes audit logging with sensitive-data redaction.
  • Tests
    • Added mTLS integration tests validating forbidden/no-cert and successful create/reset/grant/delete flows and audit records; introduced a status-api audit recorder.
    • Isolated a memory-leak test to run in a subprocess to reduce cross-test interference.
  • Chores
    • Adjusted test sharding for handler tests.

Review Change Stack

@ti-chi-bot ti-chi-bot Bot added do-not-merge/needs-tests-checked release-note Denotes a PR that will be considered when it comes time to generate release notes. labels May 19, 2026
@pantheon-ai

pantheon-ai Bot commented May 19, 2026 •

Copy link
Copy Markdown

@bb7133 I've received your pull request and will start the review. I'll conduct a thorough review covering code quality, potential issues, and implementation details.

⏳ This process typically takes 10-30 minutes depending on the complexity of the changes.

ℹ️ Learn more details on Pantheon AI.

@ti-chi-bot

ti-chi-bot Bot commented May 19, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign amyangfei for approval. For more information see the Code Review Process.
Please ensure that each of them provides their approval before proceeding.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@ti-chi-bot ti-chi-bot Bot added the size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. label May 19, 2026
@coderabbitai

coderabbitai Bot commented May 19, 2026 •

Copy link
Copy Markdown

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Adds mTLS-only internal HTTP endpoints for user reset/create/delete/role binding; implements handlers executing internal SQL with password redaction and stmt-event audit emission; wires routes, updates BUILD/test deps, adds mTLS end-to-end tests, and isolates a memory-leak test in a subprocess.

Changes

User Administration Feature

Layer / File(s) Summary
User Admin Handlers
pkg/server/handler/user_admin_handler.go
Four new exported handlers—UserResetPasswordHandler, UserDeleteHandler, UserCreateHandler, UserRolesHandler—implement ServeHTTP, enforce methods and mTLS, validate JSON/path inputs, and execute corresponding internal SQL operations.
User Admin Supporting Functions
pkg/server/handler/user_admin_handler.go
Helpers to check user existence, count login-capable users, normalize/split/deduplicate roles, and build SQL strings for ALTER/CREATE/DROP/GRANT.
mTLS Validation & SQL Builders
pkg/server/handler/user_admin_handler.go
Request-level requireMTLS based on cluster SSL config and SQL builder helpers used by handlers.
Audit Integration
pkg/server/handler/user_admin_handler.go
Audit utilities to parse and normalize user-admin SQL, clear auth/hash fields to redact passwords, emit statement events via extension listeners, and provide an event info payload implementation.
Endpoint Registration and Build Configuration
pkg/server/http_status.go, pkg/server/handler/BUILD.bazel, pkg/server/handler/tests/BUILD.bazel
Registers /internal/v1/users/... routes in the status HTTP router, adds user_admin_handler.go to the handler library srcs, and expands build/test deps (including //pkg/extension and gorilla/mux) and adjusts test shard_count.
Test Infrastructure Setup & mTLS Integration Tests
pkg/server/handler/tests/main_test.go, pkg/server/handler/tests/http_handler_test.go
Adds statusAPIAuditRecorder, registers it in tests, expands imports for TLS helpers and mockstore, adds startServerWithConfig, and TestInternalUserAdminAPIMTLS with certificate generation, mTLS client/server setup, and assertions on HTTP responses and recorded audit/SQL events.

Test Isolation

Layer / File(s) Summary
Memory Leak Test Subprocess Isolation
pkg/server/tidb_library_test.go
Adds os/exec import and a subprocess gate for TestMemoryLeak using TIDB_MEMORY_LEAK_SUBPROCESS=1 to run the test in a dedicated subprocess and fail the parent if the subprocess fails.

Sequence Diagram(s)

sequenceDiagram
  participant Client
  participant HTTPServer
  participant Handler
  participant InternalSession
  participant AuditExtension
  Client->>HTTPServer: HTTPS request (/internal/v1/users/...)
  HTTPServer->>Handler: route -> ServeHTTP
  Handler->>Handler: requireMTLS, parse JSON, validate
  Handler->>InternalSession: ExecuteInternal(SQL statement)
  InternalSession-->>Handler: result / error
  Handler->>AuditExtension: auditUserAdminStmt (redacted SQL AST/event)
  Handler-->>Client: HTTP Response (2xx/4xx)
Loading

🎯 4 (Complex) | ⏱️ ~45 minutes

Suggested labels

ok-to-test

Suggested reviewers

  • tiancaiamao
  • hawkingrei
  • wjhuang2016

"I hopped through TLS and SQL so spry,
mTLS shields, audits keep secrets dry,
Roles and users neatly tended,
Handlers and tests all happily blended,
A rabbit cheers: safe ops, hop‑hop, hi!" 🐇✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 14.29% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title 'pkg/server: add internal user admin APIs' clearly and concisely describes the main change—adding new internal user administration endpoints.
Description check ✅ Passed The description includes all required template sections: Issue Number (ref #66620), Problem Summary, What Changed, completed Checklist with unit tests and manual testing, and a Release Note.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch bb7133/add_user_api_master

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
pkg/server/handler/tests/http_handler_test.go (1)

437-462: ⚠️ Potential issue | 🔴 Critical | ⚡ Quick win

Missing import: mockstore package is not imported.

Line 439 calls mockstore.NewMockStore() but the mockstore package is not in the imports. This will cause a compilation error. Looking at the imports, only teststore is imported from github.com/pingcap/tidb/pkg/store/mockstore/teststore.

Additionally, lines 714-726 contain duplicate code—an identical if-block checking parentCert == nil || parentKey == nil appears twice, with the second occurrence being unreachable dead code.

🐛 Proposed fixes

For the missing import, add the mockstore package:

 import (
 	...
+	"github.com/pingcap/tidb/pkg/store/mockstore"
 	"github.com/pingcap/tidb/pkg/store/mockstore/teststore"
 	...
 )

Alternatively, use the already-imported teststore package:

 func (ts *basicHTTPHandlerTestSuite) startServerWithConfig(t *testing.T, cfg *config.Config) {
 	var err error
-	ts.store, err = mockstore.NewMockStore()
+	ts.store, err = teststore.NewMockStoreWithoutBootstrap()
 	require.NoError(t, err)

For the duplicate code, remove the second if-block at lines 721-726.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@pkg/server/handler/tests/http_handler_test.go` around lines 437 - 462, The
test fails to compile because mockstore is used but not imported and there is
unreachable duplicate code: add the missing import for the mockstore package (so
mockstore.NewMockStore() resolves) or replace the call with the already-imported
teststore usage if you intend to use teststore; also remove the duplicated
conditional block that checks parentCert == nil || parentKey == nil (the second
identical if-block around the lines checking parentCert/parentKey) to eliminate
dead code; update imports and delete the redundant if-block in the same test
file so startServerWithConfig and related setup compile cleanly.
🧹 Nitpick comments (1)
pkg/server/tidb_library_test.go (1)

31-40: ⚡ Quick win

Subprocess isolation pattern is well-implemented.

The environment variable guard prevents recursive spawning, the regex correctly targets only this test, and error handling properly propagates subprocess failures.

⏱️ Optional: Add subprocess timeout for robustness

Consider adding a timeout to prevent the parent from hanging indefinitely if the subprocess stalls:

 	if os.Getenv("TIDB_MEMORY_LEAK_SUBPROCESS") != "1" {
 		// Run in a subprocess to avoid interference from other tests in this package.
-		cmd := exec.Command(os.Args[0], "-test.run", "^TestMemoryLeak$", "-test.v", "-test.count=1")
+		ctx, cancel := context.WithTimeout(context.Background(), 5*time.Minute)
+		defer cancel()
+		cmd := exec.CommandContext(ctx, os.Args[0], "-test.run", "^TestMemoryLeak$", "-test.v", "-test.count=1")
 		cmd.Env = append(os.Environ(), "TIDB_MEMORY_LEAK_SUBPROCESS=1")
 		output, err := cmd.CombinedOutput()
 		if err != nil {

This would require importing context and time. The current implementation relies on the overall test framework timeout, which is acceptable but less explicit.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@pkg/server/tidb_library_test.go` around lines 31 - 40, Add a timeout to the
subprocess invocation that runs TestMemoryLeak to avoid hanging: replace the
exec.Command + CombinedOutput usage with a context-aware command (create a
context with timeout via context.WithTimeout and use exec.CommandContext) so
TestMemoryLeak’s subprocess is killed after the timeout, ensure you still set
the TIDB_MEMORY_LEAK_SUBPROCESS env and capture CombinedOutput from the command
before checking err (and cancel the context after use); update imports to
include context and time and reference TestMemoryLeak,
TIDB_MEMORY_LEAK_SUBPROCESS, exec.CommandContext, and cmd.CombinedOutput in the
change.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@pkg/server/handler/tests/http_handler_test.go`:
- Around line 714-726: Remove the duplicated conditional block that checks and
sets parentCert/parentKey; the second identical if (parentCert == nil ||
parentKey == nil) { template.IsCA = true; template.KeyUsage |=
x509.KeyUsageCertSign; parentCert = &template; parentKey = privateKey } is dead
code—delete the second occurrence so the logic that initializes template,
parentCert, and parentKey runs only once and avoid redundant assignments.

---

Outside diff comments:
In `@pkg/server/handler/tests/http_handler_test.go`:
- Around line 437-462: The test fails to compile because mockstore is used but
not imported and there is unreachable duplicate code: add the missing import for
the mockstore package (so mockstore.NewMockStore() resolves) or replace the call
with the already-imported teststore usage if you intend to use teststore; also
remove the duplicated conditional block that checks parentCert == nil ||
parentKey == nil (the second identical if-block around the lines checking
parentCert/parentKey) to eliminate dead code; update imports and delete the
redundant if-block in the same test file so startServerWithConfig and related
setup compile cleanly.

---

Nitpick comments:
In `@pkg/server/tidb_library_test.go`:
- Around line 31-40: Add a timeout to the subprocess invocation that runs
TestMemoryLeak to avoid hanging: replace the exec.Command + CombinedOutput usage
with a context-aware command (create a context with timeout via
context.WithTimeout and use exec.CommandContext) so TestMemoryLeak’s subprocess
is killed after the timeout, ensure you still set the
TIDB_MEMORY_LEAK_SUBPROCESS env and capture CombinedOutput from the command
before checking err (and cancel the context after use); update imports to
include context and time and reference TestMemoryLeak,
TIDB_MEMORY_LEAK_SUBPROCESS, exec.CommandContext, and cmd.CombinedOutput in the
change.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: eaf93fba-4143-41b0-8474-7840b39de82f

📥 Commits

Reviewing files that changed from the base of the PR and between 548ad7d and 089a74f.

📒 Files selected for processing (7)
  • pkg/server/handler/BUILD.bazel
  • pkg/server/handler/tests/BUILD.bazel
  • pkg/server/handler/tests/http_handler_test.go
  • pkg/server/handler/tests/main_test.go
  • pkg/server/handler/user_admin_handler.go
  • pkg/server/http_status.go
  • pkg/server/tidb_library_test.go

Comment thread pkg/server/handler/tests/http_handler_test.go Outdated
@pingcap-cla-assistant

pingcap-cla-assistant Bot commented May 20, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@bb7133

bb7133 commented May 20, 2026

Copy link
Copy Markdown
Member Author

/retest-required

@bb7133 bb7133 changed the title pkg/server: add internal user admin APIs (port to master) pkg/server: add internal user admin APIs May 20, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 Nitpick comments (2)
pkg/server/handler/user_admin_handler.go (2)

532-534: 💤 Low value

Remove unused buildAlterUserExpireSQL function.

This function is defined at lines 532–534 but is never called anywhere in the codebase. Remove it to reduce dead code.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@pkg/server/handler/user_admin_handler.go` around lines 532 - 534, The
function buildAlterUserExpireSQL is dead code and should be removed: delete the
entire buildAlterUserExpireSQL function definition from user_admin_handler.go
(the ALTER USER ... PASSWORD EXPIRE helper) and then run a quick build/lint (go
build/go vet or golangci-lint) to ensure no remaining references or
unused-import warnings remain; if any tests or callers exist, update them to
remove usage, otherwise just remove the function.

516-523: ⚖️ Poor tradeoff

requireMTLS relies entirely on configuration checks without validating that TLS was actually negotiated.

The function checks if cfg.Security.ClusterSSLCA and cfg.Security.ClusterVerifyCN are configured, but never verifies that the connection has req.TLS set. If the status server's listener configuration is misconfigured or bypassed, this guard would not catch it.

The comment mentions cmux may hide TLS state, but req.TLS is successfully accessed elsewhere in this same file (clientCertCommonName, auditUserFromRequest). Adding a secondary check for req.TLS != nil would be a reasonable defensive improvement:

if cfg != nil && cfg.Security.ClusterSSLCA != "" && len(cfg.Security.ClusterVerifyCN) > 0 && req.TLS != nil {
    return nil
}

Alternatively, if cmux truly makes req.TLS unreliable in some cases, document that security guarantee depends entirely on listener-level TLS enforcement, so operators understand that misconfiguring the status server's TLS settings will bypass this check.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@pkg/server/handler/user_admin_handler.go` around lines 516 - 523, The
requireMTLS function currently only checks config flags
(cfg.Security.ClusterSSLCA and cfg.Security.ClusterVerifyCN) but never verifies
that TLS was negotiated; update requireMTLS to also ensure the incoming
*http.Request has req.TLS != nil before returning nil (i.e., only succeed when
both the config fields are set and req.TLS is non-nil), referencing the
requireMTLS function and the req.TLS field used elsewhere (e.g.,
clientCertCommonName/auditUserFromRequest) so the guard actually verifies a
negotiated TLS connection; if you believe cmux makes req.TLS unreliable, instead
add an explanatory comment in requireMTLS clarifying that enforcement relies on
listener-level TLS and that misconfigured listeners can bypass this check.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@pkg/server/handler/user_admin_handler.go`:
- Around line 532-534: The function buildAlterUserExpireSQL is dead code and
should be removed: delete the entire buildAlterUserExpireSQL function definition
from user_admin_handler.go (the ALTER USER ... PASSWORD EXPIRE helper) and then
run a quick build/lint (go build/go vet or golangci-lint) to ensure no remaining
references or unused-import warnings remain; if any tests or callers exist,
update them to remove usage, otherwise just remove the function.
- Around line 516-523: The requireMTLS function currently only checks config
flags (cfg.Security.ClusterSSLCA and cfg.Security.ClusterVerifyCN) but never
verifies that TLS was negotiated; update requireMTLS to also ensure the incoming
*http.Request has req.TLS != nil before returning nil (i.e., only succeed when
both the config fields are set and req.TLS is non-nil), referencing the
requireMTLS function and the req.TLS field used elsewhere (e.g.,
clientCertCommonName/auditUserFromRequest) so the guard actually verifies a
negotiated TLS connection; if you believe cmux makes req.TLS unreliable, instead
add an explanatory comment in requireMTLS clarifying that enforcement relies on
listener-level TLS and that misconfigured listeners can bypass this check.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: d18f61b9-6808-4b16-8216-668fee1ee129

📥 Commits

Reviewing files that changed from the base of the PR and between 2f60a87 and b53616a.

📒 Files selected for processing (2)
  • pkg/server/handler/BUILD.bazel
  • pkg/server/handler/user_admin_handler.go

@codecov

codecov Bot commented May 20, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 3.57143% with 513 lines in your changes missing coverage. Please review.
✅ Project coverage is 74.8981%. Comparing base (ca36959) to head (e95e3bb).
⚠️ Report is 478 commits behind head on master.

Additional details and impacted files
@@               Coverage Diff                @@
##             master     #68502        +/-   ##
================================================
- Coverage   76.3246%   74.8981%   -1.4265%     
================================================
  Files          2041       2031        -10     
  Lines        562567     570640      +8073     
================================================
- Hits         429377     427399      -1978     
- Misses       132279     143133     +10854     
+ Partials        911        108       -803     
Flag Coverage Δ
integration 41.2525% <3.5714%> (+1.5327%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
dumpling 60.4610% <ø> (ø)
parser ∅ <ø> (∅)
br 49.4562% <ø> (-13.3337%) ⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@expxiaoli expxiaoli 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.

I find 2 bugs. Please check.

Comment thread pkg/server/handler/user_admin_handler.go Outdated
Comment thread pkg/server/handler/user_admin_handler.go Outdated
@tiancaiamao

Copy link
Copy Markdown
Contributor

Code Review: Internal User Admin APIs

Overall the feature design is reasonable, code structure is clean, and tests cover mTLS happy/unhappy paths. However, I found several issues that should be addressed before merge, including 3 P0 security concerns.


🔴 P0 — Blocking Issues

1. requireMTLS does not actually verify the client certificate — only checks server config

func requireMTLS(_ *http.Request, cfg *config.Config) error {
    if cfg != nil && cfg.Security.ClusterSSLCA != "" && len(cfg.Security.ClusterVerifyCN) > 0 {
        return nil
    }
    return errors.New("client certificate invalid or missing (mTLS failure)")
}

The _ *http.Request parameter is discarded entirely. This function only checks whether the server is configured to require client certificates, not whether the current request actually presented a valid one. If a reverse proxy/LB terminates TLS in front, or cmux has edge cases in TLS handshaking, a request without a client cert could pass this gate. The comment says "cmux wraps TLS connections and may hide the TLS state," but if TLS state is hidden, that is more reason to deny — not to blindly allow.

Suggestion: Add a defensive check (req.TLS != nil && len(req.TLS.PeerCertificates) > 0), and verify the CommonName against ClusterVerifyCN. If cmux genuinely hides TLS state in some deployments, use a failpoint or config flag rather than unconditionally skipping verification.

2. Audit log leaks real passwords on success paths

For UserCreateHandler:

stmtText = buildCreateUserSQL(username, defaultUserHost, password) // real password
// ...
auditUserAdminStmt(req, stmtText, nil) // password goes into audit log via OriginalText()

Same for UserResetPasswordHandler:

stmtText := buildAlterUserPasswordSQL(username, host, payload.NewPassword) // real password
auditUserAdminStmt(req, stmtText, nil)

The success paths pass the real password into audit log text. The comment says "the redact flag alone should control whether OriginalText() or SQLDigest() is used," but for a security API, passwords should never appear in audit logs — even with redact=OFF. The success path should use auditRedactedPassword (******).

3. parseStmtNode hack to bypass password protection is fragile

parseStmtNode actively clears ByAuthString/ByHashString flags to bypass the audit extension's isPasswordStmt() guard. If the audit extension changes its logic in the future, this will silently start leaking passwords. This workaround needs a more robust contract, or better: never put real passwords in originalText at all.


🟡 P1 — Important Issues

4. Multi-host user ambiguity (also noted by @expxiaoli)

POST /internal/v1/users only creates user@'%', but reset-password, roles, and delete operate on ALL host variants via listUserHosts(). If testuser@'127.0.0.1' was created externally via SQL, calling reset-password will also change its password. The design intent should be clarified — either restrict all APIs to @'%' only, or document the multi-host behavior explicitly.

5. countUserEntries "last user" check includes locked roles (also noted by @expxiaoli)

SELECT COUNT(*) FROM mysql.user counts all rows including locked roles. With 1 real user + 1 role, deleting the user returns 409 "last user" when it is not actually the last login-capable user. The query should filter Account_locked = 'Y' or similar.

6. UserDeleteHandler returns 204 for non-existent user instead of 404

if len(hosts) == 0 {
    auditUserAdminStmt(req, buildDropUserSQL(auditUser, defaultUserHost), nil)
    w.WriteHeader(http.StatusNoContent)
    return
}

Deleting a non-existent user returns 204 No Content rather than 404 Not Found. The client cannot distinguish "already deleted" from "never existed."

7. All 4 handlers use value receivers for ServeHTTP

func (h UserResetPasswordHandler) ServeHTTP(w http.ResponseWriter, req *http.Request) {

Value receivers copy the struct on every call. Currently safe since all fields are pointers (kv.Storage, *config.Config), but fragile if non-pointer fields are added later. Consider using pointer receivers consistently.


🟢 P2 — Suggestions

8. buildAlterUserExpireSQL is defined but never called (line 532-533). Remove it, or use it in the reset-password flow to force password change on next login.

9. Duplicate code block in generateTestCert (noted by coderabbit): the if parentCert == nil || parentKey == nil check appears twice (lines 714-719 and 721-726); the second is dead code.

10. io.EOF silently ignored in JSON decode — when body is empty, payload.NewPassword is zero-value, caught indirectly by the next check. Consider returning "missing request body" directly for clarity.

11. Role grants are non-atomic — if a GRANT fails mid-loop, previously granted roles are not rolled back. Consider whether this is acceptable or needs transactional semantics.

12. Route registration without HTTP method constraints — DELETE /internal/v1/users/{username} and POST /internal/v1/users/{username}/reset-password rely on handler-internal method checks. Consider using gorilla mux .Methods() for route-level constraints.


Summary

Severity Count Key Items
P0 3 mTLS check is superficial; password leak in audit log; fragile ByAuthString bypass
P1 4 Multi-host bug; last-user count wrong; delete 204 vs 404; value receivers
P2 5 Dead code; duplicate block; EOF handling; non-atomic grants; route method constraints

The P0 security issues (especially #1 and #2) should be resolved before this PR lands.

Comment thread pkg/server/handler/user_admin_handler.go Outdated
Comment thread pkg/server/handler/user_admin_handler.go Outdated
Comment thread pkg/server/handler/user_admin_handler.go Outdated
Comment thread pkg/server/handler/user_admin_handler.go
Comment thread pkg/server/http_status.go

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (3)
pkg/server/handler/user_admin_handler.go (2)

281-282: ⚠️ Potential issue | 🔴 Critical | ⚡ Quick win

Same password leakage issue: real password in audit log.

The comment explicitly says "rebuild with real password so audit log can show it when redact=OFF" — this is the P0 security concern. Passwords should never appear in audit logs regardless of redact settings; use auditRedactedPassword here as well.

Proposed fix
-	// username and password are valid; rebuild with real password so audit log can show it when redact=OFF
-	stmtText = buildCreateUserSQL(username, defaultUserHost, password)
+	// Keep password redacted in audit log; the real password is only used for the actual CREATE USER call
+	stmtText = buildCreateUserSQL(username, defaultUserHost, auditRedactedPassword)
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@pkg/server/handler/user_admin_handler.go` around lines 281 - 282, The code
currently rebuilds stmtText with the real password via
buildCreateUserSQL(username, defaultUserHost, password), which leaks secrets
into audit logs; instead pass the redacted token so the audit never contains the
real password (use auditRedactedPassword). Update the call that assigns stmtText
to use buildCreateUserSQL(username, defaultUserHost, auditRedactedPassword) and
ensure any nearby comments about "rebuild with real password" are removed or
adjusted accordingly.

529-536: ⚠️ Potential issue | 🔴 Critical | 🏗️ Heavy lift

mTLS check doesn't verify the client certificate per-request.

requireMTLS only checks that the server is configured for mTLS (non-empty ClusterSSLCA and ClusterVerifyCN), but it discards the *http.Request and never inspects req.TLS or req.TLS.PeerCertificates. If cmux or deployment setup allows unverified requests to reach this handler, they pass through.

At minimum, when req.TLS is available, verify that PeerCertificates is non-empty and that the CommonName matches ClusterVerifyCN:

Proposed direction
-func requireMTLS(_ *http.Request, cfg *config.Config) error {
-	// cmux may hide TLS state from net/http, so this check relies on the status
-	// listener being configured to verify client certificate CNs.
+func requireMTLS(req *http.Request, cfg *config.Config) error {
 	if cfg != nil && cfg.Security.ClusterSSLCA != "" && len(cfg.Security.ClusterVerifyCN) > 0 {
+		// When TLS state is visible, verify the client certificate CN
+		if req.TLS != nil {
+			if len(req.TLS.PeerCertificates) == 0 {
+				return errors.New("client certificate required but not presented")
+			}
+			cn := req.TLS.PeerCertificates[0].Subject.CommonName
+			valid := false
+			for _, allowed := range cfg.Security.ClusterVerifyCN {
+				if cn == allowed {
+					valid = true
+					break
+				}
+			}
+			if !valid {
+				return errors.Errorf("client certificate CN %q not in allowed list", cn)
+			}
+		}
+		// If req.TLS is nil (cmux hides it), fall through — server-level config is trusted
 		return nil
 	}
 	return errors.New("client certificate invalid or missing (mTLS failure)")
 }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@pkg/server/handler/user_admin_handler.go` around lines 529 - 536, The
requireMTLS function currently only validates mTLS configuration flags; change
it to also inspect the incoming *http.Request (req) TLS state: if req.TLS is
non-nil, ensure req.TLS.PeerCertificates is non-empty and that at least one
PeerCertificate's Subject.CommonName equals (or is contained in)
cfg.Security.ClusterVerifyCN (handle multiple allowed CNs if ClusterVerifyCN is
a comma/list); keep the existing cfg.Security.ClusterSSLCA and ClusterVerifyCN
configuration checks as a fallback but return an error ("client certificate
invalid or missing (mTLS failure)") when no TLS info or no matching CommonName
is found. Ensure you reference requireMTLS, req.TLS, req.TLS.PeerCertificates,
Subject.CommonName, cfg.Security.ClusterSSLCA and cfg.Security.ClusterVerifyCN
when making the change.
pkg/server/handler/tests/http_handler_test.go (1)

666-669: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Test asserts plaintext passwords appear in audit logs — this validates a P0 security issue.

The test asserts that actual passwords (Passw0rd!, KXMF*ivNaLWd*oNhKC+REY2+) are present in the audit SQL strings. This contradicts the expected secure behavior where passwords should be redacted. Note that the "forbidden without client cert" subtest at line 587 correctly expects ****** masking.

If the handler is supposed to redact passwords (as indicated by P0 feedback in PR comments), these assertions should check for redaction instead:

🔒 Proposed fix to expect redacted passwords
 		require.Contains(t, records[0].sql, "CREATE USER")
-		require.Contains(t, records[0].sql, "Passw0rd!")
+		require.Contains(t, records[0].sql, "******")
 		require.Contains(t, records[1].sql, "ALTER USER")
-		require.Contains(t, records[1].sql, "KXMF*ivNaLWd*oNhKC+REY2+")
+		require.Contains(t, records[1].sql, "******")
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@pkg/server/handler/tests/http_handler_test.go` around lines 666 - 669, The
test is asserting plaintext passwords appear in audit SQL (records[0].sql and
records[1].sql) which contradicts the intended redaction; update the assertions
in the test (http_handler_test.go) to expect the masked value "******" instead
of the literal passwords ("Passw0rd!", "KXMF*ivNaLWd*oNhKC+REY2+"), and remove
any other checks that assert raw passwords in the audit SQL strings so the test
verifies redaction like the existing "forbidden without client cert" subtest
does.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@pkg/server/handler/user_admin_handler.go`:
- Around line 143-149: The current code builds stmtText with the real password
via buildAlterUserPasswordSQL and passes it to auditUserAdminStmt on both error
and success, leaking the password on success; change the success path to send a
redacted statement instead: after stmtText := buildAlterUserPasswordSQL(...,
payload.NewPassword) also create redactedStmtText :=
buildAlterUserPasswordSQL(username, defaultUserHost, "REDACTED") (or otherwise
redact the password using the same helper/parseStmtNode behavior), call
auditUserAdminStmt(req, stmtText, err) only on error, and call
auditUserAdminStmt(req, redactedStmtText, nil) on success so the real password
is never sent to audit logs.
- Around line 207-211: The handler currently returns 204 for a non-existent user
which hides "not found" from clients; in the branch inside user_admin_handler.go
where it checks if !exists (the block that calls auditUserAdminStmt(req,
buildDropUserSQL(auditUser, defaultUserHost), nil)), change the response to
return http.StatusNotFound instead of http.StatusNoContent and update the audit
call to record the not-found outcome (e.g., pass an error or a descriptive
result instead of nil) so logs reflect "user not found" while the HTTP response
is 404.

---

Outside diff comments:
In `@pkg/server/handler/tests/http_handler_test.go`:
- Around line 666-669: The test is asserting plaintext passwords appear in audit
SQL (records[0].sql and records[1].sql) which contradicts the intended
redaction; update the assertions in the test (http_handler_test.go) to expect
the masked value "******" instead of the literal passwords ("Passw0rd!",
"KXMF*ivNaLWd*oNhKC+REY2+"), and remove any other checks that assert raw
passwords in the audit SQL strings so the test verifies redaction like the
existing "forbidden without client cert" subtest does.

In `@pkg/server/handler/user_admin_handler.go`:
- Around line 281-282: The code currently rebuilds stmtText with the real
password via buildCreateUserSQL(username, defaultUserHost, password), which
leaks secrets into audit logs; instead pass the redacted token so the audit
never contains the real password (use auditRedactedPassword). Update the call
that assigns stmtText to use buildCreateUserSQL(username, defaultUserHost,
auditRedactedPassword) and ensure any nearby comments about "rebuild with real
password" are removed or adjusted accordingly.
- Around line 529-536: The requireMTLS function currently only validates mTLS
configuration flags; change it to also inspect the incoming *http.Request (req)
TLS state: if req.TLS is non-nil, ensure req.TLS.PeerCertificates is non-empty
and that at least one PeerCertificate's Subject.CommonName equals (or is
contained in) cfg.Security.ClusterVerifyCN (handle multiple allowed CNs if
ClusterVerifyCN is a comma/list); keep the existing cfg.Security.ClusterSSLCA
and ClusterVerifyCN configuration checks as a fallback but return an error
("client certificate invalid or missing (mTLS failure)") when no TLS info or no
matching CommonName is found. Ensure you reference requireMTLS, req.TLS,
req.TLS.PeerCertificates, Subject.CommonName, cfg.Security.ClusterSSLCA and
cfg.Security.ClusterVerifyCN when making the change.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: dd3ee9d4-df4b-45c6-9e76-f8c0485ce172

📥 Commits

Reviewing files that changed from the base of the PR and between b53616a and 1753c19.

📒 Files selected for processing (3)
  • pkg/server/handler/tests/BUILD.bazel
  • pkg/server/handler/tests/http_handler_test.go
  • pkg/server/handler/user_admin_handler.go

Comment thread pkg/server/handler/user_admin_handler.go Outdated
Comment thread pkg/server/handler/user_admin_handler.go
@bb7133
bb7133 force-pushed the bb7133/add_user_api_master branch from 1753c19 to b4039c8 Compare May 22, 2026 05:59

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
pkg/server/handler/user_admin_handler.go (1)

529-535: ⚠️ Potential issue | 🔴 Critical | ⚡ Quick win

Authorize from the request's client cert, not just server config.

This returns success whenever mTLS is configured, even if the current request has no TLS state or peer certificate. If these handlers are reached behind TLS termination or with req.TLS == nil, this becomes a config flag, not authentication. Fail closed on missing req.TLS/PeerCertificates and verify the presented CN against ClusterVerifyCN.

Proposed fix
-func requireMTLS(_ *http.Request, cfg *config.Config) error {
-	// cmux may hide TLS state from net/http, so this check relies on the status
-	// listener being configured to verify client certificate CNs.
-	if cfg != nil && cfg.Security.ClusterSSLCA != "" && len(cfg.Security.ClusterVerifyCN) > 0 {
-		return nil
-	}
-	return errors.New("client certificate invalid or missing (mTLS failure)")
+func requireMTLS(req *http.Request, cfg *config.Config) error {
+	if cfg == nil || cfg.Security.ClusterSSLCA == "" || len(cfg.Security.ClusterVerifyCN) == 0 {
+		return errors.New("client certificate invalid or missing (mTLS failure)")
+	}
+	if req == nil || req.TLS == nil || len(req.TLS.PeerCertificates) == 0 {
+		return errors.New("client certificate invalid or missing (mTLS failure)")
+	}
+	cn := strings.TrimSpace(req.TLS.PeerCertificates[0].Subject.CommonName)
+	for _, allowed := range cfg.Security.ClusterVerifyCN {
+		if strings.TrimSpace(allowed) == cn {
+			return nil
+		}
+	}
+	return errors.New("client certificate invalid or missing (mTLS failure)")
 }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@pkg/server/handler/user_admin_handler.go` around lines 529 - 535, requireMTLS
currently authorizes based only on config presence; change it to fail closed by
inspecting the incoming *http.Request TLS state and peer certificates: verify
req != nil && req.TLS != nil && len(req.TLS.PeerCertificates) > 0, extract the
client cert CN from req.TLS.PeerCertificates[0].Subject.CommonName and check it
against cfg.Security.ClusterVerifyCN (iterate allowed CNs or use a set); only
return nil when a presented CN matches an allowed CN and
cfg.Security.ClusterSSLCA is non-empty, otherwise return the existing "client
certificate invalid or missing (mTLS failure)" error.
♻️ Duplicate comments (2)
pkg/server/handler/user_admin_handler.go (2)

207-210: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Return 404 when user@'%' doesn't exist.

Now that delete only targets the default-host entry, 204 No Content hides the difference between "deleted" and "never existed". Clients need a real not-found response here, and the audit event should reflect that outcome.

Proposed fix
 	if !exists {
-		auditUserAdminStmt(req, buildDropUserSQL(auditUser, defaultUserHost), nil)
-		w.WriteHeader(http.StatusNoContent)
+		err := errors.New("user not found")
+		auditUserAdminStmt(req, buildDropUserSQL(auditUser, defaultUserHost), err)
+		WriteErrorWithCode(w, http.StatusNotFound, err)
 		return
 	}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@pkg/server/handler/user_admin_handler.go` around lines 207 - 210, The handler
currently returns 204 when the default-host user doesn't exist; change it to
return 404 and audit that the user was not found. In the branch checking exists
(the if !exists block in user_admin_handler.go), call auditUserAdminStmt with an
error or a "not found" result (so the audit reflects the not-found outcome for
buildDropUserSQL(auditUser, defaultUserHost)), then write http.StatusNotFound
instead of http.StatusNoContent and return; ensure the rest of the delete path
still audits successful deletions as before.

143-149: ⚠️ Potential issue | 🔴 Critical | ⚡ Quick win

Never pass the raw password into auditUserAdminStmt.

stmtText is built from payload.NewPassword and reused for both success and error events, so any audit extension that reads OriginalText() still gets the secret. For password-bearing statements, the audited SQL needs to stay masked on every path.

Proposed fix
-	stmtText := buildAlterUserPasswordSQL(username, defaultUserHost, payload.NewPassword)
+	stmtText := buildAlterUserPasswordSQL(username, defaultUserHost, auditRedactedPassword)
 	if _, err := se.ExecuteInternal(ctx, "ALTER USER %?@%? IDENTIFIED BY %?", username, defaultUserHost, payload.NewPassword); err != nil {
 		auditUserAdminStmt(req, stmtText, err)
 		WriteErrorWithCode(w, http.StatusInternalServerError, err)
 		return
 	}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@pkg/server/handler/user_admin_handler.go` around lines 143 - 149, The audit
currently logs stmtText (built by buildAlterUserPasswordSQL using
payload.NewPassword) which leaks the raw password on both success and error
paths; instead, ensure auditUserAdminStmt is always passed a masked statement:
after calling buildAlterUserPasswordSQL or before calling auditUserAdminStmt,
create a maskedStmt that replaces the password portion (payload.NewPassword)
with a constant mask (e.g., '***' or 'REDACTED') and use maskedStmt for both the
error and success audit calls around se.ExecuteInternal; update references
around buildAlterUserPasswordSQL, stmtText, auditUserAdminStmt and the
se.ExecuteInternal call to use the masked value so the real password is never
sent to the auditor.
🧹 Nitpick comments (1)
pkg/server/handler/tests/http_handler_test.go (1)

567-580: ⚡ Quick win

This subtest doesn't actually cover "no client certificate".

It calls the handler directly, never starts the HTTPS server, and never enables ClusterVerifyCN, so this still passes even if requireMTLS ignores req.TLS. Please make this an end-to-end request against a server started with ClusterVerifyCN configured and a client created without a cert, then assert the 403 from the real TLS handshake path.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@pkg/server/handler/tests/http_handler_test.go` around lines 567 - 580, The
subtest "forbidden without client cert" currently invokes
handler.NewUserResetPasswordHandler directly and doesn't exercise TLS; modify
the test to start an HTTPS server using the server certificates from artifacts
(e.g., via httptest.NewUnstartedServer/StartTLS or net/http.Server with TLS)
with cfg.Security.ClusterVerifyCN enabled, and then create an HTTP client whose
TLSClientConfig trusts the CA but does not present a client certificate; perform
a real POST to the server URL (not calling the handler directly) and assert the
response is http.StatusForbidden to ensure the mTLS handshake path is exercised.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In `@pkg/server/handler/user_admin_handler.go`:
- Around line 529-535: requireMTLS currently authorizes based only on config
presence; change it to fail closed by inspecting the incoming *http.Request TLS
state and peer certificates: verify req != nil && req.TLS != nil &&
len(req.TLS.PeerCertificates) > 0, extract the client cert CN from
req.TLS.PeerCertificates[0].Subject.CommonName and check it against
cfg.Security.ClusterVerifyCN (iterate allowed CNs or use a set); only return nil
when a presented CN matches an allowed CN and cfg.Security.ClusterSSLCA is
non-empty, otherwise return the existing "client certificate invalid or missing
(mTLS failure)" error.

---

Duplicate comments:
In `@pkg/server/handler/user_admin_handler.go`:
- Around line 207-210: The handler currently returns 204 when the default-host
user doesn't exist; change it to return 404 and audit that the user was not
found. In the branch checking exists (the if !exists block in
user_admin_handler.go), call auditUserAdminStmt with an error or a "not found"
result (so the audit reflects the not-found outcome for
buildDropUserSQL(auditUser, defaultUserHost)), then write http.StatusNotFound
instead of http.StatusNoContent and return; ensure the rest of the delete path
still audits successful deletions as before.
- Around line 143-149: The audit currently logs stmtText (built by
buildAlterUserPasswordSQL using payload.NewPassword) which leaks the raw
password on both success and error paths; instead, ensure auditUserAdminStmt is
always passed a masked statement: after calling buildAlterUserPasswordSQL or
before calling auditUserAdminStmt, create a maskedStmt that replaces the
password portion (payload.NewPassword) with a constant mask (e.g., '***' or
'REDACTED') and use maskedStmt for both the error and success audit calls around
se.ExecuteInternal; update references around buildAlterUserPasswordSQL,
stmtText, auditUserAdminStmt and the se.ExecuteInternal call to use the masked
value so the real password is never sent to the auditor.

---

Nitpick comments:
In `@pkg/server/handler/tests/http_handler_test.go`:
- Around line 567-580: The subtest "forbidden without client cert" currently
invokes handler.NewUserResetPasswordHandler directly and doesn't exercise TLS;
modify the test to start an HTTPS server using the server certificates from
artifacts (e.g., via httptest.NewUnstartedServer/StartTLS or net/http.Server
with TLS) with cfg.Security.ClusterVerifyCN enabled, and then create an HTTP
client whose TLSClientConfig trusts the CA but does not present a client
certificate; perform a real POST to the server URL (not calling the handler
directly) and assert the response is http.StatusForbidden to ensure the mTLS
handshake path is exercised.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: cb69fda1-1f04-4f2d-89de-ff03d7eee9e3

📥 Commits

Reviewing files that changed from the base of the PR and between 1753c19 and b4039c8.

📒 Files selected for processing (3)
  • pkg/server/handler/tests/BUILD.bazel
  • pkg/server/handler/tests/http_handler_test.go
  • pkg/server/handler/user_admin_handler.go

@bb7133

bb7133 commented May 22, 2026

Copy link
Copy Markdown
Member Author

/test pull-integration-realcluster-test-next-gen

@tiprow

tiprow Bot commented May 22, 2026

Copy link
Copy Markdown

@bb7133: The specified target(s) for /test were not found.
The following commands are available to trigger required jobs:

/test fast_test_tiprow
/test tidb_parser_test

Use /test all to run all jobs.

Details

In response to this:

/test pull-integration-realcluster-test-next-gen

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@bb7133
bb7133 force-pushed the bb7133/add_user_api_master branch from b4039c8 to 39ab371 Compare May 22, 2026 07:04

@expxiaoli expxiaoli 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.

There is a bug. Please check.

Comment thread pkg/server/handler/user_admin_handler.go
@bb7133

bb7133 commented May 22, 2026

Copy link
Copy Markdown
Member Author

/test mysql-test

@tiprow

tiprow Bot commented May 22, 2026

Copy link
Copy Markdown

@bb7133: The specified target(s) for /test were not found.
The following commands are available to trigger required jobs:

/test fast_test_tiprow
/test tidb_parser_test

Use /test all to run all jobs.

Details

In response to this:

/test mysql-test

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

bb7133 added 5 commits June 10, 2026 14:37
The ti-chi-robot bazel update incorrectly removed //pkg/session/types
from the handler package deps. user_admin_handler.go explicitly imports
pkg/session/types (as sessiontypes) and requires this dep.
bb7133 added 3 commits June 10, 2026 14:37
pkg/session/types does not exist on master; the Session interface
was moved to pkg/session/sessionapi in the master branch.

Update user_admin_handler.go to import pkg/session/sessionapi and
update BUILD.bazel to use //pkg/session/sessionapi accordingly.
@bb7133
bb7133 force-pushed the bb7133/add_user_api_master branch from 999507c to 4e90176 Compare June 10, 2026 21:38

This branch has not been deployed

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

Labels

release-note Denotes a PR that will be considered when it comes time to generate release notes. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants