Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
feat(mcp): MCP workspace setting, ignore_masking_exemptions, and the masked-write guard (P1b 1b-4) (#21216)
Vincent Huange1d0515d4786
diff --git a/backend/api/auth/auth.go b/backend/api/auth/auth.goindex 75080e4c92..59a961ac79 100644--- a/backend/api/auth/auth.go+++ b/backend/api/auth/auth.go@@ -543,9 +543,9 @@ func MCPClassIsRefused(class v1pb.MCPMethodClass) bool {// value nobody resolved, and a stored number no release ever wrote — the// reserved 2, or anything from a newer build — is a ceiling nobody decided// about. Both fall to the default.-func MCPCeilingServesAnything(capability storepb.WorkspaceProfileSetting_MCPCapability) bool {+func MCPCeilingServesAnything(capability storepb.MCPSetting_Capability) bool {switch capability {- case storepb.WorkspaceProfileSetting_READ_WRITE, storepb.WorkspaceProfileSetting_READ_ONLY:+ case storepb.MCPSetting_READ_WRITE, storepb.MCPSetting_READ_ONLY:return truedefault:return falsediff --git a/backend/api/mcp/gen/openapi.yaml b/backend/api/mcp/gen/openapi.yamlindex 8af4aebba7..2baca287b6 100644--- a/backend/api/mcp/gen/openapi.yaml+++ b/backend/api/mcp/gen/openapi.yaml@@ -15082,6 +15082,51 @@ components:between, EXCLUDED and FORBIDDEN are served by no ceiling, and an unclassifiedmethod is refused rather than served. Annotating a method is therefore achange to what an MCP session can reach, taking effect on the next request.+ bytebase.v1.MCPSetting:+ type: object+ properties:+ capability:+ title: capability+ description: |-+ The maximum capability available to MCP sessions in this workspace, acting+ as an admin-set ceiling. Enforced server-side at three points: the /mcp+ endpoint decides whether a connection is admitted at all, the ceiling gate+ on the internal MCP chain decides, per request, which method classes are+ served, and under READ_ONLY the SQL clamp decides, per statement, whether+ it only reads.+ $ref: '#/components/schemas/bytebase.v1.MCPSetting.Capability'+ ignoreMaskingExemptions:+ type: boolean+ title: ignore_masking_exemptions+ description: |-+ Whether a request that arrived over MCP stops applying the caller's own+ unmasking provisioning. Two mechanisms let a user see a real value and this+ suppresses both: the masking exemptions granted to them, and the unmask+ carried by an access grant. The same user in the console is untouched.++ It cannot force masking where there is none. Masking substitutes values in+ query results, so this does not reach data copied into a column carrying no+ masking policy, and it does nothing on the engines Bytebase does not mask.+ It narrows what an agent reads through the paths Bytebase masks; it is not+ a confidentiality boundary.+ title: MCPSetting+ additionalProperties: false+ description: |-+ MCPSetting is what an MCP (Model Context Protocol) session may do in this+ workspace.+ bytebase.v1.MCPSetting.Capability:+ type: string+ title: Capability+ enum:+ - CAPABILITY_UNSPECIFIED+ - DISABLED+ - READ_ONLY+ - READ_WRITE+ description: |-+ Capability is the ceiling: a session runs at this level or lower. An absent+ MCP setting resolves to READ_WRITE, so a workspace that never configured+ MCP is unaffected. Writing CAPABILITY_UNSPECIFIED explicitly is rejected —+ omit the update mask path to leave the ceiling unset.bytebase.v1.MaskingExemptionPolicy:type: objectproperties:@@ -18744,6 +18789,7 @@ components:- SEMANTIC_TYPES- ENVIRONMENT+ - MCPbytebase.v1.SettingValue:type: objectoneOf:@@ -18787,6 +18833,14 @@ components:title: environmentrequired:- environment+ - type: object+ properties:+ mcp:+ title: mcp+ $ref: '#/components/schemas/bytebase.v1.MCPSetting'+ title: mcp+ required:+ - mcp- type: objectproperties:semanticType:@@ -21550,15 +21604,6 @@ components:The max expiration duration for request role.Deprecated: use just-in-time access request flows instead.$ref: '#/components/schemas/google.protobuf.Duration'- mcpCapability:- title: mcp_capability- description: |-- The maximum capability available to MCP (Model Context Protocol) sessions in- this workspace, acting as an admin-set ceiling. Unset is treated as- READ_WRITE for backward compatibility; DISABLED rejects all MCP- connections. Writing MCP_CAPABILITY_UNSPECIFIED explicitly is rejected —- omit the update mask path to leave the ceiling unset.- $ref: '#/components/schemas/bytebase.v1.WorkspaceProfileSetting.MCPCapability'directorySyncTokenConfigured:type: booleantitle: directory_sync_token_configured@@ -21568,19 +21613,6 @@ components:offering "generate" and "regenerate".title: WorkspaceProfileSettingadditionalProperties: false- bytebase.v1.WorkspaceProfileSetting.MCPCapability:- type: string- title: MCPCapability- enum:- - MCP_CAPABILITY_UNSPECIFIED- - DISABLED- - READ_ONLY- - READ_WRITE- description: |-- MCPCapability is the maximum capability an MCP (Model Context Protocol)- session may have in the workspace. It is a ceiling: a session runs at this- level or lower. Unset (UNSPECIFIED) is treated as READ_WRITE so existing- workspaces are unaffected.bytebase.v1.WorkspaceProfileSetting.PasswordRestriction:type: objectproperties:diff --git a/backend/api/mcp/server.go b/backend/api/mcp/server.goindex 28a15f8ab0..cfbe4737be 100644--- a/backend/api/mcp/server.go+++ b/backend/api/mcp/server.go@@ -51,7 +51,7 @@ type Server struct {type serverStore interface {GetWorkspaceID(context.Context) (string, error)GetWorkspaceProfileSetting(context.Context, string) (*storepb.WorkspaceProfileSetting, error)- GetMCPCapabilityUncached(context.Context, string) (storepb.WorkspaceProfileSetting_MCPCapability, error)+ GetMCPSettingsUncached(context.Context, string) (store.MCPSettings, error)DeleteOAuth2RefreshTokensByUserAndClient(context.Context, string, string) error}@@ -595,9 +595,9 @@ func (s *Server) unauthorized(c *echo.Context, errDescription string) error {// two against each other over the whole enum.//// UNSPECIFIED is refused rather than read as "never configured":-// store.GetMCPCapabilityUncached already resolves an unset ceiling to+// store.GetMCPSettingsUncached already resolves an unset ceiling to// READ_WRITE, so a zero value arriving here was resolved by nobody.-func mcpConnectionAllowed(capability storepb.WorkspaceProfileSetting_MCPCapability) bool {+func mcpConnectionAllowed(capability storepb.MCPSetting_Capability) bool {return auth.MCPCeilingServesAnything(capability)}@@ -619,13 +619,13 @@ func mcpConnectionAllowed(capability storepb.WorkspaceProfileSetting_MCPCapabili// cache is what makes the kill switch a kill switch: the cache has no TTL and// only in-process writes refresh it, so a profile cached as unset would keep// admitting MCP after the ceiling was flipped out of band.-func (s *Server) mcpCapability(ctx context.Context, workspaceID string) (storepb.WorkspaceProfileSetting_MCPCapability, error) {- capability, err := s.store.GetMCPCapabilityUncached(ctx, workspaceID)+func (s *Server) mcpCapability(ctx context.Context, workspaceID string) (storepb.MCPSetting_Capability, error) {+ settings, err := s.store.GetMCPSettingsUncached(ctx, workspaceID)if err != nil {if errors.Is(err, store.ErrMCPCapabilityUnreadable) {slog.Warn("the stored MCP capability ceiling cannot be interpreted; refusing the connection",slog.String("workspace", workspaceID), log.BBError(err))- return storepb.WorkspaceProfileSetting_DISABLED, nil+ return storepb.MCPSetting_DISABLED, nil}// DISABLED rather than UNSPECIFIED, even though the error is what the// caller acts on. UNSPECIFIED is the zero value and means "nobody@@ -633,9 +633,9 @@ func (s *Server) mcpCapability(ctx context.Context, workspaceID string) (storepb// both, so nothing turns on it today — the point is that the value// stays safe to read on its own, in case a later caller logs the error// and carries on.- return storepb.WorkspaceProfileSetting_DISABLED, err+ return storepb.MCPSetting_DISABLED, err}- return capability, nil+ return settings.Capability, nil}// buildResourceMetadataURL returns the absolute URL of the protected resourcediff --git a/backend/api/mcp/server_killswitch_test.go b/backend/api/mcp/server_killswitch_test.goindex d22e2fd4c1..911dc1d9fb 100644--- a/backend/api/mcp/server_killswitch_test.go+++ b/backend/api/mcp/server_killswitch_test.go@@ -38,15 +38,15 @@ import (// arriving here was resolved by nobody.func TestMCPConnectionAllowed(t *testing.T) {tests := []struct {- capability storepb.WorkspaceProfileSetting_MCPCapability+ capability storepb.MCPSetting_Capabilityallowed bool}{- {storepb.WorkspaceProfileSetting_MCP_CAPABILITY_UNSPECIFIED, false},- {storepb.WorkspaceProfileSetting_READ_WRITE, true},- {storepb.WorkspaceProfileSetting_DISABLED, false},- {storepb.WorkspaceProfileSetting_MCPCapability(2), false}, // reserved (was METADATA_ONLY)- {storepb.WorkspaceProfileSetting_MCPCapability(99), false}, // no such value in any build- {storepb.WorkspaceProfileSetting_READ_ONLY, true},+ {storepb.MCPSetting_CAPABILITY_UNSPECIFIED, false},+ {storepb.MCPSetting_READ_WRITE, true},+ {storepb.MCPSetting_DISABLED, false},+ {storepb.MCPSetting_Capability(2), false}, // reserved (was METADATA_ONLY)+ {storepb.MCPSetting_Capability(99), false}, // no such value in any build+ {storepb.MCPSetting_READ_ONLY, true},}for _, tt := range tests {t.Run(tt.capability.String(), func(t *testing.T) {@@ -82,9 +82,9 @@ func TestMCPKillSwitchEndToEnd(t *testing.T) {// ws-disabled: MCP explicitly disabled. ws-open: no MCP setting → unset → allowed._, err = s.UpsertSetting(ctx, &store.SettingMessage{- Name: storepb.SettingName_WORKSPACE_PROFILE,+ Name: storepb.SettingName_MCP,Workspace: "ws-disabled",- Value: &storepb.WorkspaceProfileSetting{McpCapability: storepb.WorkspaceProfileSetting_DISABLED},+ Value: &storepb.MCPSetting{Capability: storepb.MCPSetting_DISABLED},})require.NoError(t, err)@@ -142,11 +142,13 @@ func TestMCPKillSwitchBypassesSettingCache(t *testing.T) {s, err := store.New(ctx, pgURL, true /* enableCache */)require.NoError(t, err)- // A profile row with no MCP ceiling, as any configured workspace has.+ // An MCP setting row naming no ceiling, which is what a workspace that+ // configured only the masking toggle looks like. The row has to exist for+ // the out-of-band flip below to have something to write into._, err = s.UpsertSetting(ctx, &store.SettingMessage{- Name: storepb.SettingName_WORKSPACE_PROFILE,+ Name: storepb.SettingName_MCP,Workspace: "ws-cached",- Value: &storepb.WorkspaceProfileSetting{},+ Value: &storepb.MCPSetting{},})require.NoError(t, err)@@ -176,8 +178,8 @@ func TestMCPKillSwitchBypassesSettingCache(t *testing.T) {// Flip the ceiling behind the store's back, as an emergency SQL toggle would._, err = db.ExecContext(ctx, `- UPDATE setting SET value = jsonb_set(value, '{mcpCapability}', '"DISABLED"')- WHERE workspace = 'ws-cached' AND name = 'WORKSPACE_PROFILE';+ UPDATE setting SET value = jsonb_set(value, '{capability}', '"DISABLED"')+ WHERE workspace = 'ws-cached' AND name = 'MCP';`)require.NoError(t, err)@@ -207,11 +209,18 @@ func tokenForWorkspace(t *testing.T, secret, workspaceID string) string {// Bytebase write produces.//// The typo row is the one that mattered: protojson discards a field whose enum-// NAME it does not recognize, so `{"mcpCapability":"READ_WRTIE"}` used to parse-// as unset and resolve to READ_WRITE — a mistyped kill switch that silently did+// NAME it does not recognize, so `{"capability":"READ_WRTIE"}` would parse as+// unset and resolve to READ_WRITE — a mistyped kill switch that silently did// nothing. An unknown enum NUMBER never had that problem, because protojson// keeps it and no mode serves it.//+// The legacy row is the accepted trade recorded in code. Before this change the+// ceiling lived on the workspace profile; that key is not migrated and not read,+// so a profile row still carrying it — including DISABLED — resolves to+// READ_WRITE. Deliberate: the released API served the field but nothing but a+// hand-built UpdateSetting call could reach it. Pinned here so nobody adds a+// fallback read to be helpful.+//// The read-only row is the cutover pin, now on its other side: READ_ONLY opens// a session, because a read-only session can no longer write — the ceiling gate// refuses the methods the mode does not cover and the SQL clamp refuses a@@ -232,29 +241,50 @@ func TestMCPCeilingStoredValueFailsClosed(t *testing.T) {want intwhy string}{- {"ws-typo", `{"mcpCapability":"READ_WRTIE"}`, http.StatusForbidden,+ {"ws-typo", `{"capability":"READ_WRTIE"}`, http.StatusForbidden,"a ceiling this build cannot read is not a ceiling that permits"},- {"ws-reserved", `{"mcpCapability":2}`, http.StatusForbidden,+ {"ws-reserved", `{"capability":2}`, http.StatusForbidden,"the reserved number was METADATA_ONLY; no mode serves it"},- {"ws-explicit-unset", `{"mcpCapability":"MCP_CAPABILITY_UNSPECIFIED"}`, http.StatusForbidden,+ {"ws-explicit-unset", `{"capability":"CAPABILITY_UNSPECIFIED"}`, http.StatusForbidden,"no Bytebase write produces this key with this value, so a row that has it was hand-edited"},- {"ws-readonly", `{"mcpCapability":"READ_ONLY"}`, http.StatusOK,+ {"ws-readonly", `{"capability":"READ_ONLY"}`, http.StatusOK,"READ_ONLY admits a session now that the SQL clamp holds it to reads"},{"ws-other-unknown-field", `{"someFieldFromANewerRelease":"x"}`, http.StatusOK,"one unknown field must not disable MCP: only the ceiling key is read strictly"},{"ws-open", `{}`, http.StatusOK,- "a workspace that never set a ceiling keeps working"},+ "an MCP setting row that names no ceiling keeps working"},+ {"ws-ignoring", `{"capability":"READ_ONLY","ignoreMaskingExemptions":true}`, http.StatusOK,+ "ignoring masking exemptions is not a reason to refuse the connection; it changes what the session reads"},}for _, row := range rows {_, err := db.ExecContext(ctx, `INSERT INTO workspace (resource_id) VALUES ($1)`, row.workspace)require.NoError(t, err)_, err = db.ExecContext(ctx,- `INSERT INTO setting (name, workspace, value) VALUES ('WORKSPACE_PROFILE', $1, $2)`,+ `INSERT INTO setting (name, workspace, value) VALUES ('MCP', $1, $2)`,row.workspace, row.value)require.NoError(t, err)}+ // Two workspaces with no MCP setting row at all. ws-absent is the ordinary+ // never-configured case; ws-legacy carries the pre-3.22 ceiling on its+ // workspace profile, where nothing reads it. Both must resolve READ_WRITE,+ // and ws-legacy stores DISABLED so the pin is the strongest version of the+ // trade rather than the mildest.+ for _, ws := range []struct{ workspace, profile string }{+ {workspace: "ws-absent"},+ {workspace: "ws-legacy", profile: `{"mcpCapability":"DISABLED"}`},+ } {+ _, err := db.ExecContext(ctx, `INSERT INTO workspace (resource_id) VALUES ($1)`, ws.workspace)+ require.NoError(t, err)+ if ws.profile != "" {+ _, err = db.ExecContext(ctx,+ `INSERT INTO setting (name, workspace, value) VALUES ('WORKSPACE_PROFILE', $1, $2)`,+ ws.workspace, ws.profile)+ require.NoError(t, err)+ }+ }+pgURL := fmt.Sprintf("host=%s port=%s user=postgres password=root-password database=postgres",container.GetHost(), container.GetPort(),@@ -273,32 +303,54 @@ func TestMCPCeilingStoredValueFailsClosed(t *testing.T) {// directly, on every workspace at once.//// That doubles as the composite-primary-key check the setting table needs.- // It is keyed (workspace, name), and GetMCPCapabilityUncached is a new+ // It is keyed (workspace, name), and GetMCPSettingsUncached is a new// reader of it: a future edit that dropped the workspace predicate would// return whichever row the scan reached first and apply one tenant's MCP// ceiling to every other tenant — a kill switch answering for the wrong- // workspace. Six workspaces with six different stored values sit in this- // one database, so each must still resolve to its own; the ws-readonly row+ // workspace. Every workspace below sits in this one database and must still+ // resolve to its own stored value; the ws-readonly row// must resolve as itself rather than as a fail-closed error, which is what// separates "the ceiling says read-only" from "the ceiling could not be// read" now that both no longer answer the same way at the connection.- for workspace, want := range map[string]storepb.WorkspaceProfileSetting_MCPCapability{- "ws-readonly": storepb.WorkspaceProfileSetting_READ_ONLY,- "ws-open": storepb.WorkspaceProfileSetting_READ_WRITE,- "ws-other-unknown-field": storepb.WorkspaceProfileSetting_READ_WRITE,+ for workspace, want := range map[string]storepb.MCPSetting_Capability{+ "ws-readonly": storepb.MCPSetting_READ_ONLY,+ "ws-open": storepb.MCPSetting_READ_WRITE,+ "ws-other-unknown-field": storepb.MCPSetting_READ_WRITE,+ "ws-ignoring": storepb.MCPSetting_READ_ONLY,+ "ws-absent": storepb.MCPSetting_READ_WRITE,+ "ws-legacy": storepb.MCPSetting_READ_WRITE,} {- got, err := s.GetMCPCapabilityUncached(ctx, workspace)+ got, err := s.GetMCPSettingsUncached(ctx, workspace)require.NoError(t, err, "%s stores a ceiling this build understands", workspace)- require.Equal(t, want, got,+ require.Equal(t, want, got.Capability,"%s must resolve its OWN stored ceiling, not a neighbour's", workspace)}+ // The toggle comes off the same row read as the ceiling, which is what lets+ // one resolution per request hold for both. Asserting it here rather than in+ // a test of its own is how that stays provable: these rows are read once+ // each, so a reader that resolved the two fields separately would have to+ // show it.+ for workspace, want := range map[string]bool{+ "ws-ignoring": true,+ "ws-readonly": false,+ "ws-open": false,+ "ws-other-unknown-field": false,+ "ws-absent": false,+ "ws-legacy": false,+ } {+ settings, err := s.GetMCPSettingsUncached(ctx, workspace)+ require.NoError(t, err)+ require.Equal(t, want, settings.IgnoreMaskingExemptions,+ "%s must resolve its OWN toggle, and an unset one is false", workspace)+ }+for _, workspace := range []string{"ws-typo", "ws-reserved", "ws-explicit-unset"} {- got, err := s.GetMCPCapabilityUncached(ctx, workspace)+ got, err := s.GetMCPSettingsUncached(ctx, workspace)if err == nil {// The reserved number parses; it is refused later because no// ceiling serves it. What must never happen is resolving to a// value some other workspace stored.- require.NotEqual(t, storepb.WorkspaceProfileSetting_READ_WRITE, got,+ require.NotEqual(t, storepb.MCPSetting_READ_WRITE, got.Capability,"%s must not resolve to a neighbour's permissive ceiling", workspace)}}diff --git a/backend/api/mcp/store_test.go b/backend/api/mcp/store_test.goindex a35fab98b8..1f548921bf 100644--- a/backend/api/mcp/store_test.go+++ b/backend/api/mcp/store_test.go@@ -4,12 +4,13 @@ import ("context"storepb "github.com/bytebase/bytebase/backend/generated-go/store"+ "github.com/bytebase/bytebase/backend/store")type testServerStore struct {workspaceID stringworkspaceProfile *storepb.WorkspaceProfileSetting- capability storepb.WorkspaceProfileSetting_MCPCapability+ capability storepb.MCPSetting_CapabilitycapabilityErr error}@@ -17,7 +18,7 @@ func newTestServerStore() *testServerStore {return &testServerStore{workspaceID: "ws-test",workspaceProfile: &storepb.WorkspaceProfileSetting{},- capability: storepb.WorkspaceProfileSetting_READ_WRITE,+ capability: storepb.MCPSetting_READ_WRITE,}}@@ -29,8 +30,8 @@ func (s *testServerStore) GetWorkspaceProfileSetting(context.Context, string) (*return s.workspaceProfile, nil}-func (s *testServerStore) GetMCPCapabilityUncached(context.Context, string) (storepb.WorkspaceProfileSetting_MCPCapability, error) {- return s.capability, s.capabilityErr+func (s *testServerStore) GetMCPSettingsUncached(context.Context, string) (store.MCPSettings, error) {+ return store.MCPSettings{Capability: s.capability}, s.capabilityErr}func (*testServerStore) DeleteOAuth2RefreshTokensByUserAndClient(context.Context, string, string) error {diff --git a/backend/api/mcp/tool_change.go b/backend/api/mcp/tool_change.goindex 8c73f79735..220a188122 100644--- a/backend/api/mcp/tool_change.go+++ b/backend/api/mcp/tool_change.go@@ -150,7 +150,8 @@ propose_database_change(database="app", sql="UPDATE orders SET status='shipped'- v1 supports single database targets only. For batch changes across multiple databases, use get_skill("database-change").- Plan checks run automatically; results included in response when available.- Requires bb.sheets.create, bb.plans.create, bb.issues.create permissions.-- If createRollout=true but policy gates aren't satisfied, returns success with rolloutCreated=false and a reason.`+- If createRollout=true but policy gates aren't satisfied, returns success with rolloutCreated=false and a reason.+- Masked data: a masked column reads back as "******". That is a placeholder, not a value anything holds. Any change containing it is refused, because writing it back would overwrite the real value. Ask a human to make the change in the Bytebase console instead.`func (s *Server) registerChangeTool() {mcp.AddTool(s.mcpServer, &mcp.Tool{@@ -204,13 +205,13 @@ func (s *Server) handleChange(ctx context.Context, req *mcp.CallToolRequest, inp// Step 4: Create sheet.sheetName, err := s.createSheet(ctx, project, input.SQL)if err != nil {- return formatChangeStepError(err, "SHEET_CREATE_FAILED", "bb.sheets.create", nil), nil, nil+ return formatChangeStepError(err, "SHEET_CREATE_FAILED", nil), nil, nil}// Step 5: Create plan.planName, err := s.createPlan(ctx, project, input.Title, resolved.resourceName, sheetName)if err != nil {- return formatChangeStepError(err, "PLAN_CREATE_FAILED", "bb.plans.create", map[string]string{"sheet": sheetName}), nil, nil+ return formatChangeStepError(err, "PLAN_CREATE_FAILED", map[string]string{"sheet": sheetName}), nil, nil}// Step 6: Run plan checks (hybrid async, 10s budget).@@ -225,7 +226,7 @@ func (s *Server) handleChange(ctx context.Context, req *mcp.CallToolRequest, inpif planChecks != nil && planChecks.Status == planCheckDone && planChecks.Summary != nil && planChecks.Summary.Error > 0 {suggestion = "plan checks must pass before issue creation; fix SQL and retry"}- return formatChangeStepErrorWithHint(err, "ISSUE_CREATE_FAILED", "bb.issues.create", partialRefs, suggestion), nil, nil+ return formatChangeStepErrorWithHint(err, "ISSUE_CREATE_FAILED", partialRefs, suggestion), nil, nil}// Step 8: Determine nextAction from approvalStatus.@@ -565,9 +566,20 @@ func (s *Server) callAPI(ctx context.Context, path, operation, permission string// Returns nil if the response is OK, or a structured error otherwise.func checkAPIResponse(resp *apiResponse, operation, permission string) error {if resp.Status == http.StatusForbidden || resp.Status == http.StatusUnauthorized {+ // A 403 here is not always a missing permission: the MCP enforcement+ // chain answers the same status for the method class, the ceiling, the+ // request's own shape and the masked-write guard. No grant lifts a+ // workspace setting, so those keep their own remedy and get no advice.+ message := parseError(resp.Body)+ if IsPolicyRefusal(message) {+ return &toolError{Code: "PERMISSION_DENIED", Message: message}+ }+ if message == "" {+ message = fmt.Sprintf("you don't have permission to %s", operation)+ }return &toolError{Code: "PERMISSION_DENIED",- Message: fmt.Sprintf("you don't have permission to %s", operation),+ Message: message,Suggestion: fmt.Sprintf("ask your workspace admin to grant you the %s permission", permission),}}@@ -588,19 +600,21 @@ func formatChangeError(err *changeError) *mcp.CallToolResult {// formatChangeStepError formats a step failure into an MCP error result.// It detects permission errors and wraps them appropriately.-func formatChangeStepError(err error, defaultCode, permission string, partialRefs map[string]string) *mcp.CallToolResult {- return formatChangeStepErrorWithHint(err, defaultCode, permission, partialRefs, "")+func formatChangeStepError(err error, defaultCode string, partialRefs map[string]string) *mcp.CallToolResult {+ return formatChangeStepErrorWithHint(err, defaultCode, partialRefs, "")}// formatChangeStepErrorWithHint is like formatChangeStepError but replaces the// default suggestion with hint when non-empty, keeping the JSON shape intact.-func formatChangeStepErrorWithHint(err error, defaultCode, permission string, partialRefs map[string]string, hint string) *mcp.CallToolResult {+func formatChangeStepErrorWithHint(err error, defaultCode string, partialRefs map[string]string, hint string) *mcp.CallToolResult {var te *toolErrorif errors.As(err, &te) && te.Code == "PERMISSION_DENIED" {+ // Passed through rather than re-derived: re-deriving overwrote a policy+ // denial's own remedy with the permission advice.return formatChangeError(&changeError{Code: "PERMISSION_DENIED",Message: te.Message,- Suggestion: fmt.Sprintf("ask your workspace admin to grant you the %s permission", permission),+ Suggestion: te.Suggestion,PartialRefs: partialRefs,})}diff --git a/backend/api/mcp/tool_change_test.go b/backend/api/mcp/tool_change_test.goindex 99544a3411..3d4e9f91f4 100644--- a/backend/api/mcp/tool_change_test.go+++ b/backend/api/mcp/tool_change_test.go@@ -12,6 +12,7 @@ import (mcpsdk "github.com/modelcontextprotocol/go-sdk/mcp""github.com/stretchr/testify/require"+ "github.com/bytebase/bytebase/backend/component/masker"storepb "github.com/bytebase/bytebase/backend/generated-go/store")@@ -962,6 +963,33 @@ func TestChange_PermissionDenied_Sheet(t *testing.T) {require.Contains(t, text, "bb.sheets.create")}+// TestChange_PolicyDenialKeepsItsOwnRemedy is the other half of+// checkAPIResponse. An MCP policy refusal already says what to do, and no grant+// lifts a workspace setting, so appending the permission advice would send the+// agent at a dead end.+func TestChange_PolicyDenialKeepsItsOwnRemedy(t *testing.T) {+ mock := newChangeMock(employeeDB())+ mock.sheetStatus = http.StatusForbidden+ mock.sheetResponse = map[string]any{"message": "/bytebase.v1.SheetService/CreateSheet " ++ "is not available to MCP sessions for this request because its SQL contains \"******\". " ++ "Perform this action signed in to the Bytebase console instead"}+ s := newChangeTestServer(t, mock)++ result, _, err := s.handleChange(testContext(), nil, ChangeInput{+ Database: "employee_db",+ SQL: "UPDATE users SET name = '******'",+ Title: "Test",+ })+ require.NoError(t, err)+ require.True(t, result.IsError)++ text := result.Content[0].(*mcpsdk.TextContent).Text+ require.Contains(t, text, "******", "the refusal's own wording has to reach the agent")+ require.NotContains(t, text, "bb.sheets.create",+ "the agent already holds it; the refusal is not about a permission")+ require.NotContains(t, text, "suggestion", "no advice is better than advice at a dead end")+}+func TestChange_PermissionDenied_Plan(t *testing.T) {mock := newChangeMock(employeeDB())mock.planStatus = http.StatusForbidden@@ -1060,3 +1088,13 @@ func TestChange_Links_RolloutOmitted(t *testing.T) {require.True(t, ok)require.Empty(t, output.Links.Rollout)}++// TestChangeDescriptionNamesTheMaskPlaceholder pins the one literal the tool+// description shares with the masker. The description teaches the agent which+// string is a placeholder rather than a value; if the masker's substitution+// ever moved, prose spelling the old one out would teach the wrong rule.+func TestChangeDescriptionNamesTheMaskPlaceholder(t *testing.T) {+ require.Contains(t, proposeChangeDescription, masker.DefaultFullMaskSubstitution)+ require.Contains(t, queryDatabaseDescription, masker.DefaultFullMaskSubstitution,+ "the read tool refuses the same literal, so it has to teach the same rule")+}diff --git a/backend/api/mcp/tool_query.go b/backend/api/mcp/tool_query.goindex b4bd64f572..8e16d0bc1b 100644--- a/backend/api/mcp/tool_query.go+++ b/backend/api/mcp/tool_query.go@@ -55,7 +55,10 @@ const queryDatabaseDescription = `Execute a SQL query against a Bytebase databas**Examples:**query_database(database="employee_db", statement="SELECT * FROM users LIMIT 10")-query_database(database="employee", instance="prod-pg", statement="SELECT count(*) FROM orders")`+query_database(database="employee", instance="prod-pg", statement="SELECT count(*) FROM orders")++**Notes:**+- Masked data: a masked column reads back as "******". That is a placeholder, not a value anything holds, so never write it back and never filter on it. Any statement containing it is refused.`func (s *Server) registerQueryTool() {mcp.AddTool(s.mcpServer, &mcp.Tool{@@ -199,15 +202,11 @@ func (s *Server) executeQuery(ctx context.Context, resolved *resolvedDatabase, ssuggestion := "check your SQL syntax and try again"if resp.Status == http.StatusForbidden || resp.Status == http.StatusUnauthorized {// A refusal that already names its own way out gets none added.- // The workspace MCP ceiling is one of these, and telling an agent- // to request a project role for it sends the person it acts for- // after a grant that cannot lift a workspace setting.- //- // The phrase crosses a process boundary as an error body, so the- // producer pins it too: see the assertion on this exact substring- // in TestMCPClampRefusesWhatItCannotShowIsARead (backend/api/v1).+ // Telling an agent to request a project role for one sends the+ // person it acts for after a grant that cannot lift a workspace+ // setting.suggestion = ""- if !strings.Contains(errMsg, "MCP capability ceiling") {+ if !IsPolicyRefusal(errMsg) {suggestion = "you may not have permission to query this database — request the SQL Editor role on the project"}}@@ -342,3 +341,24 @@ func parseLatencyMs(latency string) int64 {}return d.Milliseconds()}++// IsPolicyRefusal reports whether a 403 came from the MCP enforcement chain+// rather than from the caller's own RBAC. It matches wording because the verdict+// crosses a process boundary as an error body and nothing else survives the+// trip; the producers call this, not a copy of it, in+// TestMCPRefusalsNameThemselvesToTheQueryTool (backend/api/v1).+func IsPolicyRefusal(message string) bool {+ for _, phrase := range []string{+ "MCP capability ceiling",+ // Singular, so it also matches the plural the gate uses and the two+ // refusals that live outside it (rejectMCPOriginatedGrantIssue,+ // rejectMCPOriginatedIssuelessRollout).+ "MCP session",+ "MCP classification",+ } {+ if strings.Contains(message, phrase) {+ return true+ }+ }+ return false+}diff --git a/backend/api/mcp/tool_query_test.go b/backend/api/mcp/tool_query_test.goindex 0cf337c9d0..f6335374bb 100644--- a/backend/api/mcp/tool_query_test.go+++ b/backend/api/mcp/tool_query_test.go@@ -625,6 +625,41 @@ func TestQueryDatabase_QueryError(t *testing.T) {require.Contains(t, text, "syntax error")}+// TestQueryDatabase_PolicyDenialGetsNoRoleAdvice is the same contract on the+// read tool. The masked-write guard refuses through SQLService/Query, and a+// project role cannot lift a workspace setting.+func TestQueryDatabase_PolicyDenialGetsNoRoleAdvice(t *testing.T) {+ databases := []map[string]any{+ makeDatabase("instances/prod-pg/databases/employee_db", "instances/prod-pg", "projects/hr-system", "POSTGRES", "ds-admin-1"),+ }+ handler := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {+ if strings.Contains(r.URL.Path, "SQLService/Query") {+ w.Header().Set("Content-Type", "application/json")+ w.WriteHeader(http.StatusForbidden)+ _ = json.NewEncoder(w).Encode(map[string]any{+ "message": "/bytebase.v1.SQLService/Query is not available to MCP sessions " ++ "for this request because its SQL contains \"******\"",+ "code": "PERMISSION_DENIED",+ })+ return+ }+ mockListDatabases(databases).ServeHTTP(w, r)+ })+ s := newTestServerWithMock(t, handler)++ result, _, err := s.handleQueryDatabase(testContext(), nil, QueryInput{+ Database: "employee_db",+ Statement: "UPDATE users SET name = '******'",+ })+ require.NoError(t, err)+ require.True(t, result.IsError)++ text := result.Content[0].(*mcpsdk.TextContent).Text+ require.Contains(t, text, "******")+ require.NotContains(t, text, "SQL Editor role",+ "no project role lifts a workspace setting")+}+func TestQueryDatabase_PermissionDenied(t *testing.T) {databases := []map[string]any{makeDatabase("instances/prod-pg/databases/employee_db", "instances/prod-pg", "projects/hr-system", "POSTGRES", "ds-admin-1"),diff --git a/backend/api/mcp/tool_resolve.go b/backend/api/mcp/tool_resolve.goindex 971e5e27e3..4370924f2b 100644--- a/backend/api/mcp/tool_resolve.go+++ b/backend/api/mcp/tool_resolve.go@@ -102,6 +102,9 @@ func (s *Server) listDatabases(ctx context.Context, filter string) ([]databaseEnreturn nil, errors.Wrap(err, "failed to list databases")}if resp.Status == http.StatusForbidden {+ if message := parseError(resp.Body); IsPolicyRefusal(message) {+ return nil, &toolError{Code: "PERMISSION_DENIED", Message: message}+ }return nil, &toolError{Code: "PERMISSION_DENIED",Message: "you don't have permission to list databases in this workspace",diff --git a/backend/api/mcp/tool_resolve_test.go b/backend/api/mcp/tool_resolve_test.goindex 218eb00486..7d7f475f89 100644--- a/backend/api/mcp/tool_resolve_test.go+++ b/backend/api/mcp/tool_resolve_test.go@@ -1,6 +1,9 @@package mcpimport (+ "encoding/json"+ "net/http"+ "strings""testing""github.com/stretchr/testify/require"@@ -56,3 +59,52 @@ func TestResolve_ProjectInAmbiguous(t *testing.T) {require.Equal(t, "projects/payments", resolved.projects["instances/prod-pg/databases/app"])require.Equal(t, "projects/staging", resolved.projects["instances/staging-pg/databases/app"])}++// TestResolve_PolicyDenialGetsNoRoleAdvice covers the resolve door. It answers+// 403 only when the stored ceiling is unreadable or unserved, which is exactly+// the case where telling the agent to ask for bb.databases.list would send the+// person it acts for after a grant that cannot fix a broken setting.+func TestResolve_PolicyDenialGetsNoRoleAdvice(t *testing.T) {+ handler := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {+ if strings.Contains(r.URL.Path, "DatabaseService/ListDatabases") {+ w.Header().Set("Content-Type", "application/json")+ w.WriteHeader(http.StatusForbidden)+ _ = json.NewEncoder(w).Encode(map[string]any{+ "message": "/bytebase.v1.DatabaseService/ListDatabases is refused: this workspace's " ++ "stored MCP capability ceiling is not one this build understands",+ })+ return+ }+ w.WriteHeader(http.StatusNotFound)+ })+ s := newTestServerWithMock(t, handler)++ _, err := s.resolveDatabase(testContext(), "employee_db", "", "")+ require.Error(t, err)+ var te *toolError+ require.ErrorAs(t, err, &te)+ require.Contains(t, te.Message, "MCP capability ceiling")+ require.Empty(t, te.Suggestion, "no grant fixes a stored ceiling this build cannot read")+}++// TestTranslateMetadataError_PolicyDenialGetsNoRoleAdvice is the same contract+// on the get_schema door.+func TestTranslateMetadataError_PolicyDenialGetsNoRoleAdvice(t *testing.T) {+ body, err := json.Marshal(map[string]any{+ "message": "/bytebase.v1.DatabaseService/GetDatabaseMetadata is not available to MCP sessions",+ })+ require.NoError(t, err)++ got := translateMetadataError(&apiResponse{Status: http.StatusForbidden, Body: body})+ var te *toolError+ require.ErrorAs(t, got, &te)+ require.Contains(t, te.Message, "MCP sessions")+ require.Empty(t, te.Suggestion)++ plain, err := json.Marshal(map[string]any{"message": "permission denied"})+ require.NoError(t, err)+ got = translateMetadataError(&apiResponse{Status: http.StatusForbidden, Body: plain})+ require.ErrorAs(t, got, &te)+ require.Contains(t, te.Suggestion, "bb.databases.getSchema",+ "a plain ACL denial keeps the permission advice")+}diff --git a/backend/api/mcp/tool_schema.go b/backend/api/mcp/tool_schema.goindex d00fd28b49..c2a5208804 100644--- a/backend/api/mcp/tool_schema.go+++ b/backend/api/mcp/tool_schema.go@@ -423,6 +423,9 @@ func translateMetadataError(resp *apiResponse) error {Suggestion: "check the database name or use search_api to list available databases",}case http.StatusForbidden, http.StatusUnauthorized:+ if IsPolicyRefusal(errMsg) {+ return &toolError{Code: "PERMISSION_DENIED", Message: errMsg}+ }return &toolError{Code: "PERMISSION_DENIED",Message: "you don't have permission to read this database's schema",diff --git a/backend/api/v1/mcp_gate.go b/backend/api/v1/mcp_gate.goindex 34f512cf10..4226c15974 100644--- a/backend/api/v1/mcp_gate.go+++ b/backend/api/v1/mcp_gate.go@@ -254,19 +254,33 @@ func denialReason(class v1pb.MCPMethodClass, reason v1pb.MCPDenialReason, fallba// and an empty list mean different things to the gate: an empty list is a mode// that decided to serve nothing, a missing key is a mode nobody decided about,// and only the first may reach a caller as an ordinary denial.-var mcpServingClasses = map[storepb.WorkspaceProfileSetting_MCPCapability][]v1pb.MCPMethodClass{- storepb.WorkspaceProfileSetting_DISABLED: {},- storepb.WorkspaceProfileSetting_READ_ONLY: {v1pb.MCPMethodClass_READ},- storepb.WorkspaceProfileSetting_READ_WRITE: {v1pb.MCPMethodClass_READ, v1pb.MCPMethodClass_WRITE},+var mcpServingClasses = map[storepb.MCPSetting_Capability][]v1pb.MCPMethodClass{+ storepb.MCPSetting_DISABLED: {},+ storepb.MCPSetting_READ_ONLY: {v1pb.MCPMethodClass_READ},+ storepb.MCPSetting_READ_WRITE: {v1pb.MCPMethodClass_READ, v1pb.MCPMethodClass_WRITE},}-// mcpCeilingReader is the whole of what the gate needs from the store: one live-// read of the workspace's ceiling. *store.Store satisfies it; a test supplies-// its own, which is what lets each ceiling be exercised without a database.-// Named for what it does rather than for what satisfies it, per the convention-// for a single-method interface.-type mcpCeilingReader interface {- GetMCPCapabilityUncached(ctx context.Context, workspace string) (storepb.WorkspaceProfileSetting_MCPCapability, error)+// mcpSettingsReader is the whole of what the gate needs from the store: one+// live read of the workspace's MCP settings. *store.Store satisfies it; a test+// supplies its own, which is what lets each ceiling be exercised without a+// database. Named for what it does rather than for what satisfies it, per the+// convention for a single-method interface.+type mcpSettingsReader interface {+ GetMCPSettingsUncached(ctx context.Context, workspace string) (store.MCPSettings, error)+}++// mcpSettingsContextKey carries the MCP settings the gate already resolved, so+// every later enforcement point holds the request against that same read rather+// than a second one the gate could disagree with.+type mcpSettingsContextKey struct{}++func withMCPSettings(ctx context.Context, settings store.MCPSettings) context.Context {+ return context.WithValue(ctx, mcpSettingsContextKey{}, settings)+}++func mcpSettingsFromContext(ctx context.Context) (store.MCPSettings, bool) {+ settings, ok := ctx.Value(mcpSettingsContextKey{}).(store.MCPSettings)+ return settings, ok}// internalMCPGateInterceptor refuses, before dispatch, every request an MCP@@ -287,8 +301,9 @@ type mcpCeilingReader interface {// refuses regardless of what RBAC would have said, and the refusal is recorded.//// The ceiling is read live, per request, with no caching anywhere in the path-// (store.GetMCPCapabilityUncached). An admin tightening the ceiling binds the-// next request of a session already open; work already admitted finishes.+// (store.GetMCPSettingsUncached, which resolves the masking toggle off the same+// row). An admin tightening the ceiling binds the next request of a session+// already open; work already admitted finishes.//// A policy denial is recorded whatever the method's audit annotation says: the// gate marks the outcome and the audit interceptor records it (see@@ -337,12 +352,12 @@ type mcpCeilingReader interface {// can decide — CreateIssue, where the request shape IS the whole story —// so the denial still lands before dispatch wherever that is possible.type internalMCPGateInterceptor struct {- store mcpCeilingReader+ store mcpSettingsReader}// NewInternalMCPGateInterceptor returns the MCP ceiling gate for the internal// chain. See internalMCPGateInterceptor for what it enforces.-func NewInternalMCPGateInterceptor(stores mcpCeilingReader) connect.Interceptor {+func NewInternalMCPGateInterceptor(stores mcpSettingsReader) connect.Interceptor {return &internalMCPGateInterceptor{store: stores}}@@ -390,9 +405,9 @@ func (*internalMCPGateInterceptor) WrapStreamingHandler(connect.StreamingHandler// through to ACL. The bool reports whether the refusal is a verdict about the// caller, which is an audited outcome; an infrastructure failure is not.//-// The context it returns carries the ceiling this request was held against,-// for the one handler that enforces on the request's argument rather than on-// its method (see mcpCeilingFromContext).+// The context it returns carries the MCP settings this request was held+// against, for the enforcement points that read the request's argument rather+// than its method (see mcpSettingsFromContext).func (in *internalMCPGateInterceptor) refuse(ctx context.Context, req connect.AnyRequest) (context.Context, bool, error) {procedure := req.Spec().ProcedureauthCtx, ok := common.GetAuthContextFromContext(ctx)@@ -419,33 +434,36 @@ func (in *internalMCPGateInterceptor) refuse(ctx context.Context, req connect.An"%s carries no MCP classification, so no MCP session may call it", procedure))}- ceiling, policyDenial, err := in.refuseByCeiling(ctx, procedure, authCtx.MCPMethodClass)+ settings, policyDenial, err := in.refuseByCeiling(ctx, procedure, authCtx.MCPMethodClass)if err != nil {return ctx, policyDenial, err}- if err := refuseByRequestShape(procedure, req.Any()); err != nil {+ // Stamped before the request-shape table runs, so an entry that keys on the+ // workspace policy reads the resolution this request was admitted under.+ ctx = withMCPSettings(ctx, settings)+ if err := refuseByRequestShape(ctx, procedure, req.Any()); err != nil {return ctx, true, err}- return withMCPCeiling(ctx, ceiling), false, nil+ return ctx, false, nil}// refuseByCeiling holds the method's class against the workspace's live-// ceiling, and returns the ceiling it resolved so the request can be held-// against the same one further in.-func (in *internalMCPGateInterceptor) refuseByCeiling(ctx context.Context, procedure string, class v1pb.MCPMethodClass) (storepb.WorkspaceProfileSetting_MCPCapability, bool, error) {+// ceiling, and returns the settings it resolved so the request can be held+// against the same read further in.+func (in *internalMCPGateInterceptor) refuseByCeiling(ctx context.Context, procedure string, class v1pb.MCPMethodClass) (store.MCPSettings, bool, error) {// The internal auth interceptor puts the delegated credential's workspace// on every request it admits, so an empty one means the chain was// reordered — a bug in this process, not an outage, and not a verdict// about the caller.workspaceID := common.GetWorkspaceIDFromContext(ctx)if workspaceID == "" {- return storepb.WorkspaceProfileSetting_MCP_CAPABILITY_UNSPECIFIED, false, connect.NewError(connect.CodeInternal, errors.Errorf(+ return store.MCPSettings{}, false, connect.NewError(connect.CodeInternal, errors.Errorf("%s cannot be checked against the MCP capability ceiling: no workspace on the request", procedure))}// The store applies the backward-compatible default for a workspace that// never set a ceiling and reports everything it cannot make sense of as an// error.- ceiling, err := in.store.GetMCPCapabilityUncached(ctx, workspaceID)+ settings, err := in.store.GetMCPSettingsUncached(ctx, workspaceID)if err != nil {// The agent gets no detail either way: the error text can carry the// workspace's storage state. What it does get is the right KIND of@@ -458,31 +476,31 @@ func (in *internalMCPGateInterceptor) refuseByCeiling(ctx context.Context, proceslog.Warn("failed to resolve the MCP capability ceiling; refusing the request",slog.String("method", procedure), slog.String("workspace", workspaceID), log.BBError(err))if errors.Is(err, store.ErrMCPCapabilityUnreadable) {- return ceiling, true, connect.NewError(connect.CodePermissionDenied, errors.Errorf(+ return settings, true, connect.NewError(connect.CodePermissionDenied, errors.Errorf("%s is refused: this workspace's stored MCP capability ceiling is not one this build understands, "+"so the request fails closed. Ask a workspace admin to set the MCP ceiling again in the workspace settings",procedure))}- return ceiling, false, connect.NewError(connect.CodeUnavailable, errors.Errorf(+ return settings, false, connect.NewError(connect.CodeUnavailable, errors.Errorf("%s is refused: this workspace's MCP capability ceiling could not be read, so the request fails closed. "+"Retry shortly; if it persists, a workspace admin must check the workspace MCP settings",procedure))}- served, known := mcpServingClasses[ceiling]+ served, known := mcpServingClasses[settings.Capability]if !known {- return ceiling, true, connect.NewError(connect.CodePermissionDenied, errors.Errorf(+ return settings, true, connect.NewError(connect.CodePermissionDenied, errors.Errorf("%s is refused: this workspace's stored MCP capability ceiling %v is not one this build serves. "+"Ask a workspace admin to set the MCP ceiling to a supported value in the workspace settings",- procedure, ceiling))+ procedure, settings.Capability))}if slices.Contains(served, class) {- return ceiling, false, nil+ return settings, false, nil}- return ceiling, true, connect.NewError(connect.CodePermissionDenied, errors.Errorf(+ return settings, true, connect.NewError(connect.CodePermissionDenied, errors.Errorf("%s is a %v method and this workspace's MCP capability ceiling is %v, which serves %s. "+"Ask a workspace admin to raise the MCP ceiling in the workspace settings, "+"or perform this action signed in to the Bytebase console instead",- procedure, class, ceiling, describeServedClasses(served)))+ procedure, class, settings.Capability, describeServedClasses(served)))}// describeServedClasses renders a mode's serving list for a denial message.@@ -513,17 +531,26 @@ func describeServedClasses(served []v1pb.MCPMethodClass) string {// The table is deliberately small and expected to stay that way. A method that// needs one is a method whose class annotation is not the whole truth, and the// better fix is usually to split the RPC.-var mcpRequestShapeRefusals = map[string]func(msg any) string{- v1connect.IssueServiceCreateIssueProcedure: refuseGrantIssueCreation,+var mcpRequestShapeRefusals = map[string]func(ctx context.Context, msg any) string{+ v1connect.IssueServiceCreateIssueProcedure: refuseGrantIssueCreation,+ v1connect.SheetServiceCreateSheetProcedure: refuseMaskedWriteSheet,+ v1connect.SheetServiceBatchCreateSheetsProcedure: refuseMaskedWriteSheetBatch,+ v1connect.ReleaseServiceCreateReleaseProcedure: refuseMaskedWriteRelease,+ v1connect.SQLServiceQueryProcedure: refuseMaskedWriteQuery,+ v1connect.SQLServiceExportProcedure: refuseMaskedWriteExport,++ v1connect.SavedQueryServiceCreateSavedQueryProcedure: refuseMaskedWriteSavedQuery,+ v1connect.SavedQueryServiceUpdateSavedQueryProcedure: refuseMaskedWriteSavedQueryUpdate,}-// refuseByRequestShape applies the table above.-func refuseByRequestShape(procedure string, msg any) error {+// refuseByRequestShape applies the table above. The context carries what the+// gate resolved, so an entry can key on more than the request; none does today.+func refuseByRequestShape(ctx context.Context, procedure string, msg any) error {refuse, ok := mcpRequestShapeRefusals[procedure]if !ok {return nil}- reason := refuse(msg)+ reason := refuse(ctx, msg)if reason == "" {return nil}@@ -562,7 +589,7 @@ func refuseByRequestShape(procedure string, msg any) error {// ignores, and refusing on that would refuse an ordinary edit for a mechanism// that is not running. The creation it really does reach is guarded where the// creation happens instead: rejectMCPOriginatedGrantIssue in issue_service.go.-func refuseGrantIssueCreation(msg any) string {+func refuseGrantIssueCreation(_ context.Context, msg any) string {request, ok := msg.(*v1pb.CreateIssueRequest)if !ok {// The table is keyed by procedure, so the request type is fixed. Adiff --git a/backend/api/v1/mcp_gate_test.go b/backend/api/v1/mcp_gate_test.goindex 3a4601bb46..9086641350 100644--- a/backend/api/v1/mcp_gate_test.go+++ b/backend/api/v1/mcp_gate_test.go@@ -268,13 +268,13 @@ var mcpDeniedClasses = []v1pb.MCPMethodClass{v1pb.MCPMethodClass_FORBIDDEN, v1pb// reports every method annotated READ, which is the shape of the damage.func checkEveryClassHasAServingDecision(rows []mcpClassification,- serving map[storepb.WorkspaceProfileSetting_MCPCapability][]v1pb.MCPMethodClass,+ serving map[storepb.MCPSetting_Capability][]v1pb.MCPMethodClass,denied []v1pb.MCPMethodClass,classes protoreflect.EnumDescriptor,modes protoreflect.EnumDescriptor,) []string {var violations []string- servedBy := map[v1pb.MCPMethodClass][]storepb.WorkspaceProfileSetting_MCPCapability{}+ servedBy := map[v1pb.MCPMethodClass][]storepb.MCPSetting_Capability{}for mode, served := range serving {for _, class := range served {servedBy[class] = append(servedBy[class], mode)@@ -317,8 +317,8 @@ func checkEveryClassHasAServingDecision(modeValues := modes.Values()for i := range modeValues.Len() {value := modeValues.Get(i)- mode := storepb.WorkspaceProfileSetting_MCPCapability(value.Number())- if mode == storepb.WorkspaceProfileSetting_MCP_CAPABILITY_UNSPECIFIED {+ mode := storepb.MCPSetting_Capability(value.Number())+ if mode == storepb.MCPSetting_CAPABILITY_UNSPECIFIED {continue}if _, ok := serving[mode]; !ok {@@ -349,7 +349,7 @@ func TestLintReasonsMatchTheClass(t *testing.T) {// setting row holds and the gate reads back.func mcpEnums(t *testing.T) (classes, modes protoreflect.EnumDescriptor) {t.Helper()- return v1pb.MCPMethodClass(0).Descriptor(), storepb.WorkspaceProfileSetting_MCPCapability(0).Descriptor()+ return v1pb.MCPMethodClass(0).Descriptor(), storepb.MCPSetting_Capability(0).Descriptor()}func TestLintEveryClassHasAServingDecision(t *testing.T) {@@ -387,15 +387,15 @@ func TestLintRefusedClassesMatchTheServingTable(t *testing.T) {// that serves no class cannot start admitting sessions — or the reverse, which// would refuse a connection whose methods the gate is ready to serve.func TestLintCeilingAdmissionMatchesTheServingTable(t *testing.T) {- values := storepb.WorkspaceProfileSetting_MCPCapability(0).Descriptor().Values()+ values := storepb.MCPSetting_Capability(0).Descriptor().Values()for i := range values.Len() {- capability := storepb.WorkspaceProfileSetting_MCPCapability(values.Get(i).Number())+ capability := storepb.MCPSetting_Capability(values.Get(i).Number())require.Equal(t, len(mcpServingClasses[capability]) > 0, auth.MCPCeilingServesAnything(capability),"%v: the serving table and auth.MCPCeilingServesAnything disagree about whether this ceiling serves anything", capability)}// A stored number no release ever wrote is refused too, and it cannot come// from the descriptor because it is in no build's enum.- for _, unknown := range []storepb.WorkspaceProfileSetting_MCPCapability{2, 99} {+ for _, unknown := range []storepb.MCPSetting_Capability{2, 99} {require.False(t, auth.MCPCeilingServesAnything(unknown),"%v: a ceiling this build cannot interpret must not open a session", unknown)}@@ -409,8 +409,8 @@ func TestLintCeilingAdmissionMatchesTheServingTable(t *testing.T) {// something else entirely, and every serving decision above would be about the// wrong vocabulary.func TestMCPCapabilityEnumsAgree(t *testing.T) {- v1Values := v1pb.WorkspaceProfileSetting_MCPCapability(0).Descriptor().Values()- storeValues := storepb.WorkspaceProfileSetting_MCPCapability(0).Descriptor().Values()+ v1Values := v1pb.MCPSetting_Capability(0).Descriptor().Values()+ storeValues := storepb.MCPSetting_Capability(0).Descriptor().Values()byNumber := func(values protoreflect.EnumValueDescriptors) map[int32]string {out := map[int32]string{}@@ -494,10 +494,10 @@ func TestLintClausesFireWhenBroken(t *testing.T) {classes, modes := mcpEnums(t)t.Run("a class both served and denied fails once, not once per method", func(t *testing.T) {- widened := map[storepb.WorkspaceProfileSetting_MCPCapability][]v1pb.MCPMethodClass{- storepb.WorkspaceProfileSetting_DISABLED: {},- storepb.WorkspaceProfileSetting_READ_ONLY: {v1pb.MCPMethodClass_READ, v1pb.MCPMethodClass_EXCLUDED},- storepb.WorkspaceProfileSetting_READ_WRITE: {+ widened := map[storepb.MCPSetting_Capability][]v1pb.MCPMethodClass{+ storepb.MCPSetting_DISABLED: {},+ storepb.MCPSetting_READ_ONLY: {v1pb.MCPMethodClass_READ, v1pb.MCPMethodClass_EXCLUDED},+ storepb.MCPSetting_READ_WRITE: {v1pb.MCPMethodClass_READ, v1pb.MCPMethodClass_WRITE, v1pb.MCPMethodClass_EXCLUDED,},}@@ -519,18 +519,18 @@ func TestLintClausesFireWhenBroken(t *testing.T) {require.Equal(t, []string{"/p: carries WRITE, which has no serving decision","WRITE is neither served by a mode nor denied",- }, checkEveryClassHasAServingDecision(rows, map[storepb.WorkspaceProfileSetting_MCPCapability][]v1pb.MCPMethodClass{- storepb.WorkspaceProfileSetting_DISABLED: {},- storepb.WorkspaceProfileSetting_READ_ONLY: {v1pb.MCPMethodClass_READ},- storepb.WorkspaceProfileSetting_READ_WRITE: {v1pb.MCPMethodClass_READ},+ }, checkEveryClassHasAServingDecision(rows, map[storepb.MCPSetting_Capability][]v1pb.MCPMethodClass{+ storepb.MCPSetting_DISABLED: {},+ storepb.MCPSetting_READ_ONLY: {v1pb.MCPMethodClass_READ},+ storepb.MCPSetting_READ_WRITE: {v1pb.MCPMethodClass_READ},}, mcpDeniedClasses, classes, modes))})t.Run("a ceiling mode with no serving row fails", func(t *testing.T) {require.Equal(t, []string{"ceiling mode DISABLED does not say which classes it serves"},- checkEveryClassHasAServingDecision(nil, map[storepb.WorkspaceProfileSetting_MCPCapability][]v1pb.MCPMethodClass{- storepb.WorkspaceProfileSetting_READ_ONLY: {v1pb.MCPMethodClass_READ},- storepb.WorkspaceProfileSetting_READ_WRITE: {v1pb.MCPMethodClass_READ, v1pb.MCPMethodClass_WRITE},+ checkEveryClassHasAServingDecision(nil, map[storepb.MCPSetting_Capability][]v1pb.MCPMethodClass{+ storepb.MCPSetting_READ_ONLY: {v1pb.MCPMethodClass_READ},+ storepb.MCPSetting_READ_WRITE: {v1pb.MCPMethodClass_READ, v1pb.MCPMethodClass_WRITE},}, mcpDeniedClasses, classes, modes))})@@ -778,20 +778,21 @@ func TestMCPClassificationInventory(t *testing.T) {// exercised without a database. The end-to-end path exists too, in// backend/tests, now that a READ_ONLY ceiling admits a connection.type mcpGateStore struct {- ceiling storepb.WorkspaceProfileSetting_MCPCapability- err error+ ceiling storepb.MCPSetting_Capability+ ignoreMaskingExemptions bool+ err error}-func (s mcpGateStore) GetMCPCapabilityUncached(context.Context, string) (storepb.WorkspaceProfileSetting_MCPCapability, error) {- return s.ceiling, s.err+func (s mcpGateStore) GetMCPSettingsUncached(context.Context, string) (store.MCPSettings, error) {+ return store.MCPSettings{Capability: s.ceiling, IgnoreMaskingExemptions: s.ignoreMaskingExemptions}, s.err}func readWriteCeiling() mcpGateStore {- return mcpGateStore{ceiling: storepb.WorkspaceProfileSetting_READ_WRITE}+ return mcpGateStore{ceiling: storepb.MCPSetting_READ_WRITE}}func readOnlyCeiling() mcpGateStore {- return mcpGateStore{ceiling: storepb.WorkspaceProfileSetting_READ_ONLY}+ return mcpGateStore{ceiling: storepb.MCPSetting_READ_ONLY}}type mcpGateResult struct {@@ -808,7 +809,7 @@ type mcpGateResult struct {// it here keeps the class rules provable without a database, and// TestMCPGateDenialIsAuditedWithoutAnAuditAnnotation proves the real// interceptor honors the mark.-func invokeMCPGate(t *testing.T, stores mcpCeilingReader, authCtx *common.AuthContext, procedure string, req connect.AnyRequest) mcpGateResult {+func invokeMCPGate(t *testing.T, stores mcpSettingsReader, authCtx *common.AuthContext, procedure string, req connect.AnyRequest) mcpGateResult {t.Helper()out := mcpGateResult{}next := func(ctx context.Context, _ connect.AnyRequest) (connect.AnyResponse, error) {@@ -941,7 +942,7 @@ func TestMCPGateFailsClosedOnTheCeiling(t *testing.T) {// precisely so that a ceiling which decided to serve nothing reads as a// denial rather than as the unknown-ceiling error, and that distinction// is only real if something exercises it.- got := invokeMCPGate(t, mcpGateStore{ceiling: storepb.WorkspaceProfileSetting_DISABLED},+ got := invokeMCPGate(t, mcpGateStore{ceiling: storepb.MCPSetting_DISABLED},classContext(v1pb.MCPMethodClass_READ),v1connect.DatabaseServiceGetDatabaseProcedure, connect.NewRequest(&v1pb.GetDatabaseRequest{}))require.Error(t, got.err)@@ -957,7 +958,7 @@ func TestMCPGateFailsClosedOnTheCeiling(t *testing.T) {// The reserved number 2, which was METADATA_ONLY before the tier was// dropped. It survives protojson as an unknown enum number, so unlike// an unknown NAME it reaches the gate intact — and no mode serves it.- got := invokeMCPGate(t, mcpGateStore{ceiling: storepb.WorkspaceProfileSetting_MCPCapability(2)},+ got := invokeMCPGate(t, mcpGateStore{ceiling: storepb.MCPSetting_Capability(2)},classContext(v1pb.MCPMethodClass_READ),v1connect.DatabaseServiceGetDatabaseProcedure, connect.NewRequest(&v1pb.GetDatabaseRequest{}))require.Error(t, got.err)diff --git a/backend/api/v1/mcp_masking.go b/backend/api/v1/mcp_masking.gonew file mode 100644index 0000000000..20735f61be--- /dev/null+++ b/backend/api/v1/mcp_masking.go@@ -0,0 +1,188 @@+package v1++import (+ "bytes"+ "context"+ "fmt"++ "github.com/bytebase/bytebase/backend/common"+ "github.com/bytebase/bytebase/backend/component/masker"+ v1pb "github.com/bytebase/bytebase/backend/generated-go/v1"+)++// mcpSession reports whether this request arrived over MCP.+//+// Keyed on the grant's presence, never a field value: a legacy or+// scope-omitting session leaves every field empty, so no value marks MCP+// origin. A console session carries no delegated grant.+func mcpSession(ctx context.Context) bool {+ authCtx, ok := common.GetAuthContextFromContext(ctx)+ return ok && authCtx.DelegatedGrant != nil+}++// mcpIgnoresMaskingExemptions reports whether this request stops applying the+// caller's own unmasking provisioning.+//+// No stamped settings means the gate never ran. Ignoring the exemptions is the+// safe default there, which is why this answers true where+// mcpReadOnlyClampApplies errors: guessing a ceiling has no safe default.+func mcpIgnoresMaskingExemptions(ctx context.Context) bool {+ if !mcpSession(ctx) {+ return false+ }+ settings, ok := mcpSettingsFromContext(ctx)+ if !ok {+ return true+ }+ return settings.IgnoreMaskingExemptions+}++// maskedWriteRefusal is the reason to refuse SQL carrying a mask sentinel, or+// "" to allow: the agent writes back the placeholder it read, and the real data+// is gone with nothing in the change looking wrong.+//+// It applies to every MCP session, not only where the workspace ignores masking+// exemptions. Masking runs under ordinary policy for any user who holds no+// exemption, so the corruption is reachable in a workspace that never touched+// the toggle — which is most of them.+//+// Only masker.DefaultFullMaskSubstitution is fixed in code: a full mask emits+// it for any value when no substitution is configured, and the range,+// default-range and MD5 maskers emit it on their NULL and bool arms. Everything+// else is undetectable — an MD5 mask is 32 hex characters, indistinguishable+// from a real hash; a range or inner/outer mask embeds real characters from the+// value; and a mask configured with its own substitution emits that admin's+// text — though an all-asterisk substitution reaches the sentinel by arithmetic.+//+// The scan is a substring test over raw statement text, so six asterisks+// written for another reason — an asterisk banner in a comment, a rule of+// stars — are refused too. That is the deliberate direction: a false refusal is+// a message the agent can act on, a missed write-back is data gone silently.+// Narrowing it to string literals means parsing per engine and failing open on+// a parse error; narrowing it to a bounded run of exactly six lets+// "******/2024" and two adjacent placeholders through.+func maskedWriteRefusal(ctx context.Context, statement []byte) string {+ if !mcpSession(ctx) {+ return ""+ }+ if !bytes.Contains(statement, []byte(masker.DefaultFullMaskSubstitution)) {+ return ""+ }+ return fmt.Sprintf(+ "its SQL contains %q, the placeholder Bytebase substitutes for a masked value rather than "++ "a value anything holds. Writing it back would replace the real data with it, and "++ "matching on it would match nothing. Remove the literal, whatever the statement does "++ "with it", masker.DefaultFullMaskSubstitution)+}++// refuseMaskedWriteSheet guards the sheet door. PlanService/CreatePlan carries+// a sheet name and no statement of its own, there is no UpdateSheet, and a+// rollout runs whatever the plan's sheet holds — so propose_database_change and+// a hand-rolled call_api sequence both land here.+func refuseMaskedWriteSheet(ctx context.Context, msg any) string {+ request, ok := msg.(*v1pb.CreateSheetRequest)+ if !ok {+ // The table is keyed by procedure, so the request type is fixed; a+ // mismatch is a wiring bug, and a refusal path meeting one refuses.+ return fmt.Sprintf("its request could not be read as a sheet (%T)", msg)+ }+ return maskedWriteRefusal(ctx, request.GetSheet().GetContent())+}++// refuseMaskedWriteSheetBatch refuses the whole batch on one offending sheet,+// matching the clamp.+func refuseMaskedWriteSheetBatch(ctx context.Context, msg any) string {+ request, ok := msg.(*v1pb.BatchCreateSheetsRequest)+ if !ok {+ return fmt.Sprintf("its request could not be read as a sheet batch (%T)", msg)+ }+ for _, r := range request.GetRequests() {+ if reason := maskedWriteRefusal(ctx, r.GetSheet().GetContent()); reason != "" {+ return reason+ }+ }+ return ""+}++// refuseMaskedWriteQuery guards the execution door. SQLService/Query is READ+// class, but on the EngineSupportQueryNewACL engines it authorizes DML per+// statement, and the read-only clamp only runs under a READ_ONLY ceiling — so+// under READ_WRITE the placeholder goes straight at the table, no sheet needed.+//+// A statement that only reads is refused too: separating the two would mean+// classifying it, which fails open on an engine with no validator.+func refuseMaskedWriteQuery(ctx context.Context, msg any) string {+ request, ok := msg.(*v1pb.QueryRequest)+ if !ok {+ return fmt.Sprintf("its request could not be read as a query (%T)", msg)+ }+ return maskedWriteRefusal(ctx, []byte(request.GetStatement()))+}++// refuseMaskedWriteExport guards the same door under another name. Export takes+// a raw statement, and on MySQL it skips validateQueryRequest (sql_service.go)+// and reaches a driver that ExecContexts anything not all-query — so an export+// request writes.+func refuseMaskedWriteExport(ctx context.Context, msg any) string {+ request, ok := msg.(*v1pb.ExportRequest)+ if !ok {+ return fmt.Sprintf("its request could not be read as an export (%T)", msg)+ }+ return maskedWriteRefusal(ctx, []byte(request.GetStatement()))+}++// refuseMaskedWriteRelease guards the release door. Release.File carries an+// inline statement, CreateRelease turns it into a sheet through+// store.CreateSheets rather than the RPC above, and a plan's+// ChangeDatabaseConfig takes a release in place of a sheet.+//+// UpdateRelease is not guarded because its handler answers Unimplemented, and+// CheckRelease because it runs the advisors and persists nothing.+//+// A file may name a sheet instead of carrying a statement, and that content is+// not read here — CreateRelease checks the reference by hash and never loads it+// either. Sound today only because an MCP session cannot author such a sheet:+// CreateSheet and BatchCreateSheets are guarded, there is no UpdateSheet RPC,+// so sheet content is immutable and every agent-written sheet passed this same+// scan. A referenced sheet holding the placeholder was written by a human, who+// meant it. Closing it properly means checking at the point a statement+// executes rather than at each of the doors that compose one (BOT-98).+func refuseMaskedWriteRelease(ctx context.Context, msg any) string {+ request, ok := msg.(*v1pb.CreateReleaseRequest)+ if !ok {+ return fmt.Sprintf("its request could not be read as a release (%T)", msg)+ }+ for _, file := range request.GetRelease().GetFiles() {+ if reason := maskedWriteRefusal(ctx, file.GetStatement()); reason != "" {+ return reason+ }+ }+ return ""+}++// refuseMaskedWriteSavedQuery guards the saved-query door. A saved query is its+// own table, not a sheet, so none of the doors above sees this statement: the+// content becomes the SQL a SQL Editor tab loads, and a person runs it later.+func refuseMaskedWriteSavedQuery(ctx context.Context, msg any) string {+ request, ok := msg.(*v1pb.CreateSavedQueryRequest)+ if !ok {+ return fmt.Sprintf("its request could not be read as a saved query (%T)", msg)+ }+ return maskedWriteRefusal(ctx, request.GetSavedQuery().GetContent())+}++// refuseMaskedWriteSavedQueryUpdate guards the same door on the update arm:+// content is an update-mask path, so a session holding bb.savedQueries.update+// rewrites a query somebody else authored and already runs.+//+// The mask is not consulted. Scanning only when it names "content" would tie+// this guard to the handler continuing to ignore an unnamed content field. The+// cost is refusing a title-only update that echoes back a stored statement+// holding six asterisks.+func refuseMaskedWriteSavedQueryUpdate(ctx context.Context, msg any) string {+ request, ok := msg.(*v1pb.UpdateSavedQueryRequest)+ if !ok {+ return fmt.Sprintf("its request could not be read as a saved query update (%T)", msg)+ }+ return maskedWriteRefusal(ctx, request.GetSavedQuery().GetContent())+}diff --git a/backend/api/v1/mcp_masking_test.go b/backend/api/v1/mcp_masking_test.gonew file mode 100644index 0000000000..d84f20cdb6--- /dev/null+++ b/backend/api/v1/mcp_masking_test.go@@ -0,0 +1,391 @@+package v1++import (+ "context"+ "testing"++ "connectrpc.com/connect"+ "github.com/stretchr/testify/require"++ "github.com/bytebase/bytebase/backend/api/mcp"+ "github.com/bytebase/bytebase/backend/common"+ "github.com/bytebase/bytebase/backend/component/masker"+ storepb "github.com/bytebase/bytebase/backend/generated-go/store"+ v1pb "github.com/bytebase/bytebase/backend/generated-go/v1"+ "github.com/bytebase/bytebase/backend/store"+)++func maskingSettings(ignore bool) store.MCPSettings {+ return store.MCPSettings{+ Capability: storepb.MCPSetting_READ_WRITE,+ IgnoreMaskingExemptions: ignore,+ }+}++// TestMCPIgnoresExemptionsKeysOnTheGrantAndTheToggle walks every request state+// the forcing can meet. The console is the one that has to stay untouched: the+// toggle is about what an agent may read, and the same user reading the same+// column signed in to Bytebase is not an agent.+func TestMCPIgnoresExemptionsKeysOnTheGrantAndTheToggle(t *testing.T) {+ withGrant := &common.AuthContext{DelegatedGrant: &common.DelegatedGrant{}}++ for _, row := range []struct {+ name string+ ctx context.Context+ ignores bool+ }{+ {+ name: "a human request carries no auth context here",+ ctx: context.Background(),+ },+ {+ name: "a console request carries no delegated grant, whatever the toggle says",+ ctx: withMCPSettings(contextWithAuth(&common.AuthContext{}), maskingSettings(true)),+ },+ {+ name: "an MCP session with the toggle off follows the caller's provisioning",+ ctx: withMCPSettings(contextWithAuth(withGrant), maskingSettings(false)),+ },+ {+ name: "an MCP session with the toggle on ignores them",+ ctx: withMCPSettings(contextWithAuth(withGrant), maskingSettings(true)),+ ignores: true,+ },+ {+ name: "an MCP session the gate never held is forced, because masking " ++ "has a safe default where the ceiling has none",+ ctx: contextWithAuth(withGrant),+ ignores: true,+ },+ } {+ t.Run(row.name, func(t *testing.T) {+ require.Equal(t, row.ignores, mcpIgnoresMaskingExemptions(row.ctx))+ })+ }+}++// TestMCPMaskingReadsTheSettingsTheGateResolved is the freshness invariant. The+// gate reads the MCP setting straight from the database on every request+// — the setting cache has no TTL — and stamps what it read. So an admin+// flipping the toggle binds the next request of a session already open, with no+// restart and no reconnect, and the masking path is held against the same+// resolution the gate admitted the call under.+func TestMCPMaskingReadsTheSettingsTheGateResolved(t *testing.T) {+ for _, row := range []struct {+ name string+ stores mcpGateStore+ }{+ {name: "toggle off", stores: mcpGateStore{ceiling: storepb.MCPSetting_READ_WRITE}},+ {name: "toggle on", stores: mcpGateStore{ceiling: storepb.MCPSetting_READ_WRITE, ignoreMaskingExemptions: true}},+ } {+ t.Run(row.name, func(t *testing.T) {+ got := invokeMCPGate(t, row.stores, &common.AuthContext{+ MCPMethodClass: v1pb.MCPMethodClass_READ,+ DelegatedGrant: &common.DelegatedGrant{},+ }, "/bytebase.v1.SQLService/Query", connect.NewRequest(&v1pb.QueryRequest{}))++ require.NoError(t, got.err)+ require.True(t, got.dispatched)++ settings, ok := mcpSettingsFromContext(got.dispatchedCtx)+ require.True(t, ok, "the gate must hand the handler the settings it resolved")+ require.Equal(t, row.stores.ignoreMaskingExemptions, settings.IgnoreMaskingExemptions)+ require.Equal(t, row.stores.ignoreMaskingExemptions, mcpIgnoresMaskingExemptions(got.dispatchedCtx))+ })+ }+}++// TestMaskedWriteGuardRefusesTheSentinel covers every door an MCP session can+// put raw SQL through — the three that reach the change pipeline, the two that+// execute directly, and the two that park a statement for a person to run — and+// pins that each refuses on MCP origin alone. The+// toggle-off arm is the one that matters: masking runs under ordinary policy+// for a user holding no exemption, so a workspace that never touched the toggle+// is exactly where this corruption is reachable.+func TestMaskedWriteGuardRefusesTheSentinel(t *testing.T) {+ const clean = "UPDATE employee SET name = 'Bytebase' WHERE id = 1"+ masked := "UPDATE employee SET name = '" + masker.DefaultFullMaskSubstitution + "' WHERE id = 1"++ sheetRequest := func(sql string) any {+ return &v1pb.CreateSheetRequest{Sheet: &v1pb.Sheet{Content: []byte(sql)}}+ }+ batchRequest := func(sql string) any {+ return &v1pb.BatchCreateSheetsRequest{Requests: []*v1pb.CreateSheetRequest{+ {Sheet: &v1pb.Sheet{Content: []byte(clean)}},+ {Sheet: &v1pb.Sheet{Content: []byte(sql)}},+ }}+ }+ releaseRequest := func(sql string) any {+ return &v1pb.CreateReleaseRequest{Release: &v1pb.Release{Files: []*v1pb.Release_File{+ {Statement: []byte(sql)},+ }}}+ }+ queryRequest := func(sql string) any {+ return &v1pb.QueryRequest{Statement: sql}+ }+ exportRequest := func(sql string) any {+ return &v1pb.ExportRequest{Statement: sql}+ }+ savedQueryRequest := func(sql string) any {+ return &v1pb.CreateSavedQueryRequest{SavedQuery: &v1pb.SavedQuery{Content: []byte(sql)}}+ }+ savedQueryUpdateRequest := func(sql string) any {+ // No update mask: the guard reads content wherever it finds it.+ return &v1pb.UpdateSavedQueryRequest{SavedQuery: &v1pb.SavedQuery{Content: []byte(sql)}}+ }++ for _, door := range []struct {+ name string+ refuse func(context.Context, any) string+ request func(string) any+ }{+ {name: "CreateSheet", refuse: refuseMaskedWriteSheet, request: sheetRequest},+ {name: "BatchCreateSheets", refuse: refuseMaskedWriteSheetBatch, request: batchRequest},+ {name: "CreateRelease", refuse: refuseMaskedWriteRelease, request: releaseRequest},+ {name: "Query", refuse: refuseMaskedWriteQuery, request: queryRequest},+ {name: "Export", refuse: refuseMaskedWriteExport, request: exportRequest},+ {name: "CreateSavedQuery", refuse: refuseMaskedWriteSavedQuery, request: savedQueryRequest},+ {name: "UpdateSavedQuery", refuse: refuseMaskedWriteSavedQueryUpdate, request: savedQueryUpdateRequest},+ } {+ t.Run(door.name, func(t *testing.T) {+ ignoring := withMCPSettings(+ contextWithAuth(&common.AuthContext{DelegatedGrant: &common.DelegatedGrant{}}),+ maskingSettings(true))++ reason := door.refuse(ignoring, door.request(masked))+ require.NotEmpty(t, reason, "writing the mask back replaces the real value with it")+ require.Contains(t, reason, masker.DefaultFullMaskSubstitution,+ "the message has to name the literal, or the agent cannot tell what to remove")++ require.Empty(t, door.refuse(ignoring, door.request(clean)),+ "an ordinary change is served")++ off := withMCPSettings(+ contextWithAuth(&common.AuthContext{DelegatedGrant: &common.DelegatedGrant{}}),+ maskingSettings(false))+ require.NotEmpty(t, door.refuse(off, door.request(masked)),+ "the guard is not the toggle's: masked reads happen without it")++ unstamped := contextWithAuth(&common.AuthContext{DelegatedGrant: &common.DelegatedGrant{}})+ require.NotEmpty(t, door.refuse(unstamped, door.request(masked)),+ "and it does not depend on the gate having stamped anything")++ human := contextWithAuth(&common.AuthContext{})+ require.Empty(t, door.refuse(human, door.request(masked)),+ "a console session may write whatever it likes")+ })+ }+}++// TestMaskedWriteGuardFailsClosedOnAWiringBug pins the arm that runs when the+// table's procedure key and its request type stop agreeing. The table is keyed+// by procedure so the type is fixed, which is exactly why a mismatch is a bug+// in this file rather than anything about the caller — and a refusal path that+// meets a bug refuses.+func TestMaskedWriteGuardFailsClosedOnAWiringBug(t *testing.T) {+ forced := withMCPSettings(+ contextWithAuth(&common.AuthContext{DelegatedGrant: &common.DelegatedGrant{}}),+ maskingSettings(true))++ for _, refuse := range []func(context.Context, any) string{+ refuseMaskedWriteSheet, refuseMaskedWriteSheetBatch, refuseMaskedWriteRelease,+ refuseMaskedWriteQuery, refuseMaskedWriteExport,+ refuseMaskedWriteSavedQuery, refuseMaskedWriteSavedQueryUpdate,+ } {+ require.NotEmpty(t, refuse(forced, &v1pb.GetUserRequest{}))+ }+}++// TestMaskedWriteGuardIsWiredIntoTheGate proves the guard denies before+// dispatch and is recorded, rather than only being a function that returns a+// string. The sheet never reaches the handler, so no partial change is left+// behind for the agent to build on.+func TestMaskedWriteGuardIsWiredIntoTheGate(t *testing.T) {+ masked := "INSERT INTO employee VALUES (2, '" + masker.DefaultFullMaskSubstitution + "')"++ doors := []struct {+ procedure string+ request connect.AnyRequest+ }{+ {"/bytebase.v1.SheetService/CreateSheet",+ connect.NewRequest(&v1pb.CreateSheetRequest{Sheet: &v1pb.Sheet{Content: []byte(masked)}})},+ {"/bytebase.v1.SheetService/BatchCreateSheets",+ connect.NewRequest(&v1pb.BatchCreateSheetsRequest{Requests: []*v1pb.CreateSheetRequest{+ {Sheet: &v1pb.Sheet{Content: []byte(masked)}}}})},+ {"/bytebase.v1.ReleaseService/CreateRelease",+ connect.NewRequest(&v1pb.CreateReleaseRequest{Release: &v1pb.Release{Files: []*v1pb.Release_File{+ {Statement: []byte(masked)}}}})},+ {"/bytebase.v1.SQLService/Query",+ connect.NewRequest(&v1pb.QueryRequest{Statement: masked})},+ {"/bytebase.v1.SQLService/Export",+ connect.NewRequest(&v1pb.ExportRequest{Statement: masked})},+ {"/bytebase.v1.SavedQueryService/CreateSavedQuery",+ connect.NewRequest(&v1pb.CreateSavedQueryRequest{SavedQuery: &v1pb.SavedQuery{Content: []byte(masked)}})},+ {"/bytebase.v1.SavedQueryService/UpdateSavedQuery",+ connect.NewRequest(&v1pb.UpdateSavedQueryRequest{SavedQuery: &v1pb.SavedQuery{Content: []byte(masked)}})},+ }++ // A door added to the table but not exercised here ships wired to nothing,+ // and the unit test above would still pass. CreateIssue is the one entry in+ // mcpRequestShapeRefusals that is not a masked-write door.+ require.Len(t, doors, len(mcpRequestShapeRefusals)-1,+ "every masked-write door in the refusal table needs a row here")++ for _, door := range doors {+ t.Run(door.procedure, func(t *testing.T) {+ got := invokeMCPGate(t,+ mcpGateStore{ceiling: storepb.MCPSetting_READ_WRITE, ignoreMaskingExemptions: true},+ &common.AuthContext{+ MCPMethodClass: v1pb.MCPMethodClass_WRITE,+ DelegatedGrant: &common.DelegatedGrant{},+ },+ door.procedure,+ door.request)++ require.Error(t, got.err)+ require.False(t, got.dispatched, "the refusal must land before anything is written")+ require.Equal(t, connect.CodePermissionDenied, connect.CodeOf(got.err))+ require.Contains(t, got.err.Error(), masker.DefaultFullMaskSubstitution)+ require.True(t, got.auditMarked, "every policy denial is an audited outcome")+ })+ }+}++// TestMaskedWriteGuardCoversTheExecutionDoor is the door that needs no sheet.+// Export is the same door under another name — it takes a raw statement, it is+// WRITE class, and on MySQL the handler skips validateQueryRequest, so a DML+// statement reaches a driver that executes it.+// SQLService/Query is READ class, so every ceiling that opens a session serves+// it, and it authorizes DML per statement — under READ_WRITE an agent can+// overwrite the column it just read masked without proposing anything.+func TestMaskedWriteGuardCoversTheExecutionDoor(t *testing.T) {+ masked := "UPDATE employee SET secret = '" + masker.DefaultFullMaskSubstitution + "' WHERE id = 1"++ got := invokeMCPGate(t,+ mcpGateStore{ceiling: storepb.MCPSetting_READ_WRITE, ignoreMaskingExemptions: true},+ &common.AuthContext{+ MCPMethodClass: v1pb.MCPMethodClass_READ,+ DelegatedGrant: &common.DelegatedGrant{},+ },+ "/bytebase.v1.SQLService/Query",+ connect.NewRequest(&v1pb.QueryRequest{Statement: masked}))++ require.Error(t, got.err)+ require.False(t, got.dispatched, "the refusal must land before the statement executes")+ require.Equal(t, connect.CodePermissionDenied, connect.CodeOf(got.err))+ require.Contains(t, got.err.Error(), masker.DefaultFullMaskSubstitution)+ require.True(t, got.auditMarked)++ exported := invokeMCPGate(t,+ mcpGateStore{ceiling: storepb.MCPSetting_READ_WRITE, ignoreMaskingExemptions: true},+ &common.AuthContext{+ MCPMethodClass: v1pb.MCPMethodClass_WRITE,+ DelegatedGrant: &common.DelegatedGrant{},+ },+ "/bytebase.v1.SQLService/Export",+ connect.NewRequest(&v1pb.ExportRequest{Statement: masked}))++ require.Error(t, exported.err)+ require.False(t, exported.dispatched)+ require.Contains(t, exported.err.Error(), masker.DefaultFullMaskSubstitution)+}++// TestMCPRefusalsNameThemselvesToTheQueryTool is a contract between two+// processes that meet only over an error body.+//+// query_database drops its own "request the SQL Editor role" advice when it+// recognizes an MCP policy refusal, because no project role lifts a workspace+// setting. It recognizes one by wording, so every producer's wording has to stay+// inside the list the consumer keys on — including the masked-write guard, which+// is the newest producer and the one whose refusal names a literal rather than a+// policy.+func TestMCPRefusalsNameThemselvesToTheQueryTool(t *testing.T) {+ forced := mcpGateStore{ceiling: storepb.MCPSetting_READ_WRITE, ignoreMaskingExemptions: true}+ maskedWrite := "UPDATE employee SET secret = '" + masker.DefaultFullMaskSubstitution + "'"++ for _, row := range []struct {+ name string+ stores mcpGateStore+ class v1pb.MCPMethodClass+ request connect.AnyRequest+ }{+ {+ name: "the masked-write guard",+ stores: forced,+ class: v1pb.MCPMethodClass_READ,+ request: connect.NewRequest(&v1pb.QueryRequest{Statement: maskedWrite}),+ },+ {+ name: "the ceiling gate",+ stores: mcpGateStore{ceiling: storepb.MCPSetting_READ_ONLY},+ class: v1pb.MCPMethodClass_WRITE,+ request: connect.NewRequest(&v1pb.QueryRequest{}),+ },+ {+ name: "an unclassified method",+ stores: forced,+ class: v1pb.MCPMethodClass_MCP_METHOD_CLASS_UNSPECIFIED,+ request: connect.NewRequest(&v1pb.QueryRequest{}),+ },+ } {+ t.Run(row.name, func(t *testing.T) {+ got := invokeMCPGate(t, row.stores, &common.AuthContext{+ MCPMethodClass: row.class,+ DelegatedGrant: &common.DelegatedGrant{},+ }, "/bytebase.v1.SQLService/Query", row.request)++ require.Error(t, got.err)+ require.True(t, mcp.IsPolicyRefusal(got.err.Error()),+ "query_database would append project-role advice to %q", got.err.Error())+ })+ }++ // Each producer that refuses outside the gate turns on a fact the request+ // shape cannot carry, so each is checked on its own message.+ clamped := refuseNonReadOnlyStatement(storepb.Engine_POSTGRES, "UPDATE employee SET id = 1")+ require.Error(t, clamped)+ require.True(t, mcp.IsPolicyRefusal(clamped.Error()))++ mcpCtx := contextWithAuth(&common.AuthContext{DelegatedGrant: &common.DelegatedGrant{}})+ grantIssue := rejectMCPOriginatedGrantIssue(mcpCtx, v1pb.Issue_ROLE_GRANT)+ require.Error(t, grantIssue)+ require.True(t, mcp.IsPolicyRefusal(grantIssue.Error()))++ tokenMint := (&AuthService{}).rejectMCPOriginatedTokenMint(mcpCtx, nil, "switch workspaces")+ require.Error(t, tokenMint)+ require.True(t, mcp.IsPolicyRefusal(tokenMint.Error()))++ approvalProject := &store.ProjectMessage{+ ResourceID: "p",+ Setting: &storepb.Project{RequireIssueApproval: true},+ }+ issueless := rejectMCPOriginatedIssuelessRollout(mcpCtx, approvalProject, nil, "create a rollout")+ require.Error(t, issueless)+ require.True(t, mcp.IsPolicyRefusal(issueless.Error()))+}++// TestMaskPlaceholderMatchIsDeliberatelyBroad records which side of the trade+// the guard sits on. It is a substring scan, so an asterisk banner is refused+// and a placeholder abutting other characters is caught. The first is a message+// the agent can act on; the second is data that would otherwise be gone+// silently.+func TestMaskPlaceholderMatchIsDeliberatelyBroad(t *testing.T) {+ mcpCtx := contextWithAuth(&common.AuthContext{DelegatedGrant: &common.DelegatedGrant{}})+ for _, row := range []struct {+ statement string+ refused bool+ }{+ {statement: "UPDATE t SET c = '******'", refused: true},+ {statement: "SELECT * FROM t WHERE c = '******'", refused: true},+ {statement: "UPDATE t SET c = '******/2024'", refused: true},+ {statement: "UPDATE t SET c = '************'", refused: true},+ {statement: "/****** Script for SelectTopNRows command ******/ SELECT 1", refused: true},+ {statement: "SELECT '*****'"},+ {statement: "SELECT 1"},+ } {+ t.Run(row.statement, func(t *testing.T) {+ reason := maskedWriteRefusal(mcpCtx, []byte(row.statement))+ require.Equal(t, row.refused, reason != "", reason)+ })+ }+}diff --git a/backend/api/v1/mcp_sql_clamp.go b/backend/api/v1/mcp_sql_clamp.goindex 9d92977ea9..01d7dafa87 100644--- a/backend/api/v1/mcp_sql_clamp.go+++ b/backend/api/v1/mcp_sql_clamp.go@@ -22,20 +22,6 @@ import (// can still have an effect, and a classifier can be wrong about a grammar it// does not fully model; closing that is the conformance lane's work.-// mcpCeilingContextKey carries the ceiling the gate already resolved, so the-// clamp holds the request against that same read rather than a second one the-// gate could disagree with.-type mcpCeilingContextKey struct{}--func withMCPCeiling(ctx context.Context, ceiling storepb.WorkspaceProfileSetting_MCPCapability) context.Context {- return context.WithValue(ctx, mcpCeilingContextKey{}, ceiling)-}--func mcpCeilingFromContext(ctx context.Context) (storepb.WorkspaceProfileSetting_MCPCapability, bool) {- ceiling, ok := ctx.Value(mcpCeilingContextKey{}).(storepb.WorkspaceProfileSetting_MCPCapability)- return ceiling, ok-}-// mcpReadOnlyClampApplies reports whether this request must be held to// read-only statements.//@@ -48,12 +34,12 @@ func mcpReadOnlyClampApplies(ctx context.Context) (bool, error) {if !ok || authCtx.DelegatedGrant == nil {return false, nil}- ceiling, ok := mcpCeilingFromContext(ctx)+ settings, ok := mcpSettingsFromContext(ctx)if !ok {return false, connect.NewError(connect.CodeInternal, errors.New("this MCP request cannot be checked against the workspace MCP capability ceiling, so it fails closed"))}- return ceiling == storepb.WorkspaceProfileSetting_READ_ONLY, nil+ return settings.Capability == storepb.MCPSetting_READ_ONLY, nil}// refuseNonReadOnlyStatement classifies a request fail-closed. Nothing herediff --git a/backend/api/v1/mcp_sql_clamp_test.go b/backend/api/v1/mcp_sql_clamp_test.goindex 45e0dacae2..f0e05e70b9 100644--- a/backend/api/v1/mcp_sql_clamp_test.go+++ b/backend/api/v1/mcp_sql_clamp_test.go@@ -11,6 +11,7 @@ import (storepb "github.com/bytebase/bytebase/backend/generated-go/store"v1pb "github.com/bytebase/bytebase/backend/generated-go/v1"parserbase "github.com/bytebase/bytebase/backend/plugin/parser/base"+ "github.com/bytebase/bytebase/backend/store"// The clamp asks the parser registry what it can classify and how it// splits, so this test binary has to register what the server registers.@@ -375,14 +376,6 @@ func TestMCPClampRefusesWhatItCannotShowIsARead(t *testing.T) {require.Contains(t, err.Error(), row.reason)require.Contains(t, err.Error(), "READ_ONLY","the denial must name the ceiling that refused")- // query_database suppresses its own "request the SQL Editor role"- // suggestion when it sees this phrase in the body, because no- // project role lifts a workspace ceiling. The two live in- // different processes and meet only over HTTP, so the producer- // pins the phrase here and executeQuery (backend/api/mcp) keys on- // the same one.- require.Contains(t, err.Error(), "MCP capability ceiling",- "query_database keys its suggestion suppression on this phrase")require.Contains(t, err.Error(), "raise the MCP ceiling","the denial must name the way out")require.Contains(t, err.Error(), "Bytebase console",@@ -492,13 +485,13 @@ func TestMCPClampAppliesOnlyToReadOnlyMCPSessions(t *testing.T) {},{name: "an MCP session under a read-write ceiling is not clamped",- ctx: withMCPCeiling(contextWithAuth(withGrant),- storepb.WorkspaceProfileSetting_READ_WRITE),+ ctx: withMCPSettings(contextWithAuth(withGrant),+ store.MCPSettings{Capability: storepb.MCPSetting_READ_WRITE}),},{name: "an MCP session under a read-only ceiling is clamped",- ctx: withMCPCeiling(contextWithAuth(withGrant),- storepb.WorkspaceProfileSetting_READ_ONLY),+ ctx: withMCPSettings(contextWithAuth(withGrant),+ store.MCPSettings{Capability: storepb.MCPSetting_READ_ONLY}),applies: true,},{@@ -547,9 +540,9 @@ func TestMCPClampReadsTheCeilingTheGateResolved(t *testing.T) {require.NoError(t, got.err)require.True(t, got.dispatched)- ceiling, ok := mcpCeilingFromContext(got.dispatchedCtx)- require.True(t, ok, "the gate must hand the handler the ceiling it resolved")- require.Equal(t, row.stores.ceiling, ceiling)+ settings, ok := mcpSettingsFromContext(got.dispatchedCtx)+ require.True(t, ok, "the gate must hand the handler the settings it resolved")+ require.Equal(t, row.stores.ceiling, settings.Capability)clamped, err := mcpReadOnlyClampApplies(got.dispatchedCtx)require.NoError(t, err)diff --git a/backend/api/v1/predicate_columns_check.go b/backend/api/v1/predicate_columns_check.goindex 03fcd275d8..44a765104b 100644--- a/backend/api/v1/predicate_columns_check.go+++ b/backend/api/v1/predicate_columns_check.go@@ -9,7 +9,6 @@ import (storepb "github.com/bytebase/bytebase/backend/generated-go/store""github.com/bytebase/bytebase/backend/plugin/parser/base""github.com/bytebase/bytebase/backend/store"- "github.com/bytebase/bytebase/backend/utils")func (s *QueryResultMasker) ExtractSensitivePredicateColumns(ctx context.Context, spans []*base.QuerySpan, instance *store.InstanceMessage, user *store.UserMessage) ([][]base.ColumnResource, error) {@@ -96,17 +95,7 @@ func (s *QueryResultMasker) getSensitiveColumnsForPredicate(continue}- var exemptions []*storepb.MaskingExemptionPolicy_Exemption- if policy := data.getMaskingExemptionPolicy(database.ProjectID); policy != nil {- for _, e := range policy.Exemptions {- for _, member := range e.Members {- if utils.MemberContainsUser(ctx, s.store, common.GetWorkspaceIDFromContext(ctx), member, currentPrincipal) {- exemptions = append(exemptions, e)- break- }- }- }- }+ exemptions := s.exemptionsForPrincipal(ctx, data, database.ProjectID, currentPrincipal)isSensitive, err := m.isSensitiveColumn(database, column, project.Setting.DataClassificationConfigId, config, exemptions)if err != nil {diff --git a/backend/api/v1/query_result_masker.go b/backend/api/v1/query_result_masker.goindex 255f2b2fb0..f59f2b91a5 100644--- a/backend/api/v1/query_result_masker.go+++ b/backend/api/v1/query_result_masker.go@@ -421,6 +421,33 @@ func (s *QueryResultMasker) getMaskersForQuerySpan(ctx context.Context, m *maskireturn maskers, masked, nil}+// exemptionsForPrincipal is the one seam the caller's own masking provisioning+// enters through: getMaskerForColumnResource and the MSSQL+// getSensitiveColumnsForPredicate both reach evaluateSemanticTypeOfColumn with+// exactly this slice. An MCP session that ignores exemptions gets an empty one,+// which is what a user granted nothing already looks like. Filtering only the+// output path would mask the value and still answer whether a WHERE on it+// matched.+func (s *QueryResultMasker) exemptionsForPrincipal(ctx context.Context, data *maskingDataProvider, projectID string, currentPrincipal *store.UserMessage) []*storepb.MaskingExemptionPolicy_Exemption {+ if mcpIgnoresMaskingExemptions(ctx) {+ return nil+ }+ policy := data.getMaskingExemptionPolicy(projectID)+ if policy == nil {+ return nil+ }+ var exemptions []*storepb.MaskingExemptionPolicy_Exemption+ for _, e := range policy.Exemptions {+ for _, member := range e.Members {+ if utils.MemberContainsUser(ctx, s.store, common.GetWorkspaceIDFromContext(ctx), member, currentPrincipal) {+ exemptions = append(exemptions, e)+ break+ }+ }+ }+ return exemptions+}+func (s *QueryResultMasker) getMaskerForColumnResource(ctx context.Context,m *maskingLevelEvaluator,@@ -449,18 +476,7 @@ func (s *QueryResultMasker) getMaskerForColumnResource(return masker.NewNoneMasker(), nil, nil}- // Build the filtered maskingExemptionPolicy for current principal.- var exemptions []*storepb.MaskingExemptionPolicy_Exemption- if policy := data.getMaskingExemptionPolicy(database.ProjectID); policy != nil {- for _, e := range policy.Exemptions {- for _, member := range e.Members {- if utils.MemberContainsUser(ctx, s.store, common.GetWorkspaceIDFromContext(ctx), member, currentPrincipal) {- exemptions = append(exemptions, e)- break- }- }- }- }+ exemptions := s.exemptionsForPrincipal(ctx, data, database.ProjectID, currentPrincipal)evaluation, err := m.evaluateSemanticTypeOfColumn(database, sourceColumn.Schema, sourceColumn.Table, sourceColumn.Column, project.Setting.DataClassificationConfigId, config, exemptions)if err != nil {diff --git a/backend/api/v1/setting_service.go b/backend/api/v1/setting_service.goindex ae414e6fd5..6038a9143b 100644--- a/backend/api/v1/setting_service.go+++ b/backend/api/v1/setting_service.go@@ -4,6 +4,7 @@ import ("context""log/slog""regexp"+ "slices""strings""time"@@ -65,19 +66,57 @@ func (s *SettingService) ListSettings(ctx context.Context, _ *connect.Request[v1}response := &v1pb.ListSettingsResponse{}+ stored := map[storepb.SettingName]bool{}for _, setting := range settings {if s.isSettingDisallowed(setting.Name) {continue}+ stored[setting.Name] = truesettingMessage, err := convertToSettingMessage(setting)if err != nil {return nil, connect.NewError(connect.CodeInternal, errors.Errorf("failed to convert setting message: %v", err))}response.Settings = append(response.Settings, settingMessage)}+ workspaceID := common.GetWorkspaceIDFromContext(ctx)+ for _, name := range alwaysPresentSettings {+ if stored[name] || s.isSettingDisallowed(name) {+ continue+ }+ settingMessage, err := convertToSettingMessage(emptySetting(name, workspaceID))+ if err != nil {+ return nil, connect.NewError(connect.CodeInternal, errors.Errorf("failed to convert setting message: %v", err))+ }+ response.Settings = append(response.Settings, settingMessage)+ }return connect.NewResponse(response), nil}+// alwaysPresentSettings are the settings whose absent row is a defined state+// rather than a missing resource, so Get, List and Update all answer that they+// exist. The MCP setting is one: no row means MCP was never configured, which+// the resolver reads as the backward-compatible ceiling. Three different+// answers is how a client reads the resource and then cannot patch it.+var alwaysPresentSettings = []storepb.SettingName{storepb.SettingName_MCP}++func settingIsAlwaysPresent(name storepb.SettingName) bool {+ return emptySetting(name, "") != nil+}++// emptySetting is the zero value served for an always-present setting with no+// row yet, or nil for one whose absence really is a 404. It must match what the+// store writes for an empty row, or the resource would change shape the first+// time anyone saves it. TestAlwaysPresentSettingsHaveAZeroValue pins that this+// and alwaysPresentSettings agree.+func emptySetting(name storepb.SettingName, workspaceID string) *store.SettingMessage {+ switch name {+ case storepb.SettingName_MCP:+ return &store.SettingMessage{Name: name, Workspace: workspaceID, Value: &storepb.MCPSetting{}}+ default:+ return nil+ }+}+// GetSetting gets the setting by name.func (s *SettingService) GetSetting(ctx context.Context, request *connect.Request[v1pb.GetSettingRequest]) (*connect.Response[v1pb.Setting], error) {settingName, err := common.GetSettingName(request.Msg.Name)@@ -114,7 +153,10 @@ func (s *SettingService) GetSetting(ctx context.Context, request *connect.Requesreturn nil, connect.NewError(connect.CodeInternal, errors.Errorf("failed to get setting: %v", err))}if setting == nil {- return nil, connect.NewError(connect.CodeNotFound, errors.Errorf("setting %s not found", settingName))+ if !settingIsAlwaysPresent(storeSettingName) {+ return nil, connect.NewError(connect.CodeNotFound, errors.Errorf("setting %s not found", settingName))+ }+ setting = emptySetting(storeSettingName, common.GetWorkspaceIDFromContext(ctx))}// Only return whitelisted setting.settingMessage, err := convertToSettingMessage(setting)@@ -167,7 +209,7 @@ func (s *SettingService) UpdateSetting(ctx context.Context, request *connect.Reqif err != nil {return nil, connect.NewError(connect.CodeInternal, errors.Errorf("failed to find setting %s with error: %v", settingName, err))}- if existedSetting == nil && !request.Msg.AllowMissing {+ if existedSetting == nil && !request.Msg.AllowMissing && !settingIsAlwaysPresent(storeSettingName) {return nil, connect.NewError(connect.CodeNotFound, errors.Errorf("setting %s not found", settingName))}// audit log.@@ -444,6 +486,8 @@ func (s *SettingService) UpdateSetting(ctx context.Context, request *connect.Req}storeSettingValue = environmentSetting+ case storepb.SettingName_MCP:+ return s.updateMCPSetting(ctx, request, workspaceID)case storepb.SettingName_EMAIL:if s.profile.SaaS {return nil, connect.NewError(connect.CodeInvalidArgument, errors.Errorf("email setting cannot be changed in SaaS mode"))@@ -571,7 +615,7 @@ func (s *SettingService) updateWorkspaceProfileSetting(ctx context.Context, requreturn nil, err}var lockedBefore *storepb.WorkspaceProfileSetting- apply := func(current proto.Message) (proto.Message, error) {+ apply := func(current proto.Message, _ []byte) (proto.Message, error) {oldSetting, ok := current.(*storepb.WorkspaceProfileSetting)if !ok {return nil, connect.NewError(connect.CodeInternal, errors.Errorf("invalid setting value type for %s", storepb.SettingName_WORKSPACE_PROFILE))@@ -604,7 +648,7 @@ func (s *SettingService) updateWorkspaceProfileSetting(ctx context.Context, requ// longer populate the cache), but validate against a clone anyway so// a validate-only request can never mutate shared state should the// read path change.- if _, err := apply(proto.CloneOf(profileValue)); err != nil {+ if _, err := apply(proto.CloneOf(profileValue), nil); err != nil {return nil, err}return connect.NewResponse(&v1pb.Setting{@@ -873,11 +917,6 @@ func mergeWorkspaceProfilePaths(request *connect.Request[v1pb.UpdateSettingRequeoldSetting.EnforceIdentityDomain = payload.EnforceIdentityDomaincase "value.workspace_profile.database_change_mode":oldSetting.DatabaseChangeMode = payload.DatabaseChangeMode- case "value.workspace_profile.mcp_capability":- if err := validateMCPCapability(payload.McpCapability); err != nil {- return err- }- oldSetting.McpCapability = payload.McpCapabilitycase "value.workspace_profile.allow_email_code_signin":oldSetting.AllowEmailCodeSignin = payload.AllowEmailCodeSignincase "value.workspace_profile.disallow_password_signin":@@ -1088,16 +1127,176 @@ func validateAnnouncementTheme(t *storepb.WorkspaceProfileSetting_Announcement_Areturn nil}+// updateMCPSetting merges the named update-mask paths into the stored MCP+// setting under a row lock. Each path sets one field, so an admin changing the+// masking toggle does not have to resend a ceiling they are not changing.+//+// Locked rather than read-merge-write, unlike the sibling settings: this row is+// the MCP kill switch, and two concurrent saves that each merged onto their own+// unlocked read would leave one of them silently reverted — for a ceiling, the+// difference between off and on.+//+// The audit before-image is re-captured from the locked row, overwriting the+// pre-lock snapshot UpdateSetting took from the setting cache. A ceiling flipped+// out of band would otherwise be recorded as a transition from whatever the+// cache still held, which never happened.+func (s *SettingService) updateMCPSetting(ctx context.Context, request *connect.Request[v1pb.UpdateSettingRequest], workspaceID string) (*connect.Response[v1pb.Setting], error) {+ if request.Msg.UpdateMask == nil {+ return nil, connect.NewError(connect.CodeInvalidArgument, errors.Errorf("update mask is required"))+ }+ payload := request.Msg.Setting.Value.GetMcp()+ if payload == nil {+ return nil, connect.NewError(connect.CodeInvalidArgument, errors.Errorf("mcp setting is required"))+ }++ repairsCapability := slices.Contains(request.Msg.UpdateMask.Paths, "value.mcp.capability")++ var lockedBefore *storepb.MCPSetting+ apply := func(current proto.Message, raw []byte) (proto.Message, error) {+ existing, ok := current.(*storepb.MCPSetting)+ if !ok {+ return nil, connect.NewError(connect.CodeInternal, errors.Errorf("invalid setting value type for %s", storepb.SettingName_MCP))+ }+ // A key this build does not define would be deleted by the merge below:+ // the unmarshaler discarded it, so re-marshalling writes the row back+ // without it. During a rolling upgrade that is an older replica erasing+ // what a newer one configured. Reads stay lenient on purpose — one+ // field from a newer release must not disable MCP — but a partial write+ // refuses rather than corrupt.+ if len(raw) > 0 {+ unknown, err := store.UnknownSettingKeys(string(raw), existing)+ if err != nil {+ return nil, connect.NewError(connect.CodeInternal, errors.Errorf("failed to read the stored mcp setting: %v", err))+ }+ if len(unknown) > 0 {+ return nil, connect.NewError(connect.CodeFailedPrecondition, errors.Errorf(+ "this workspace's MCP setting carries %v, which this build does not understand, and saving another field would delete it. "++ "A newer Bytebase replica most likely wrote it; retry once the rollout has finished", unknown))+ }+ }++ // A stored capability this build cannot read is enforced closed, and+ // this merge would quietly erase it: the unmarshaler drops an enum name+ // it does not know, and marshalling omits the zero enum, so the row+ // would come back with no capability key at all and the next read would+ // resolve it to the permissive default. Saving the masking toggle would+ // reopen MCP. Refuse unless this same request sets a capability.+ //+ // Read from the locked row, not before the lock: a newer replica during+ // a rolling upgrade can write a name this build has never heard of, and+ // a pre-flight would have checked a value that is no longer there.+ if !repairsCapability && len(raw) > 0 && existing.GetCapability() == storepb.MCPSetting_CAPABILITY_UNSPECIFIED {+ stored, err := store.RawMCPCapability(string(raw))+ if err != nil {+ return nil, connect.NewError(connect.CodeInternal, errors.Errorf("failed to read the stored mcp capability: %v", err))+ }+ if stored != "" {+ return nil, connect.NewError(connect.CodeFailedPrecondition, errors.Errorf(+ "this workspace's stored MCP capability is not one this build understands, and saving another field would erase it. "++ "Set value.mcp.capability in the same request to repair it"))+ }+ }+ lockedBefore = proto.CloneOf(existing)+ merged := proto.CloneOf(existing)+ for _, path := range request.Msg.UpdateMask.Paths {+ switch path {+ case "value.mcp.capability":+ capability := convertToStoreMCPCapability(payload.Capability)+ if err := validateMCPCapability(capability); err != nil {+ return nil, err+ }+ merged.Capability = capability+ case "value.mcp.ignore_masking_exemptions":+ merged.IgnoreMaskingExemptions = payload.IgnoreMaskingExemptions+ default:+ return nil, connect.NewError(connect.CodeInvalidArgument, errors.Errorf("invalid update mask path %q", path))+ }+ }+ return merged, nil+ }++ // A dry run must not reach the row or the served cache: flipping the ceiling+ // on a request that asked for nothing would be the kill switch turning+ // itself off.+ if request.Msg.ValidateOnly {+ // The same merge against the same raw view the locked path would see,+ // so a dry run cannot report success on a request the real write+ // refuses.+ raw, _, err := s.store.RawSettingValue(ctx, workspaceID, storepb.SettingName_MCP)+ if err != nil {+ return nil, connect.NewError(connect.CodeInternal, errors.Errorf("failed to read mcp setting: %v", err))+ }+ current := &storepb.MCPSetting{}+ if raw != "" {+ if err := common.ProtojsonUnmarshaler.Unmarshal([]byte(raw), current); err != nil {+ return nil, connect.NewError(connect.CodeInternal, errors.Errorf("the mcp setting does not parse: %v", err))+ }+ }+ validated, err := apply(current, []byte(raw))+ if err != nil {+ var connectErr *connect.Error+ if errors.As(err, &connectErr) {+ return nil, err+ }+ return nil, connect.NewError(connect.CodeInvalidArgument, err)+ }+ settingMessage, err := convertToSettingMessage(&store.SettingMessage{+ Name: storepb.SettingName_MCP,+ Workspace: workspaceID,+ Value: validated,+ })+ if err != nil {+ return nil, connect.NewError(connect.CodeInternal, errors.Errorf("failed to convert setting message: %v", err))+ }+ return connect.NewResponse(settingMessage), nil+ }++ // UpdateSettingAtomic updates existing state only, and a workspace that+ // never configured MCP has no row to lock.+ if err := s.store.EnsureSettingRow(ctx, workspaceID, storepb.SettingName_MCP); err != nil {+ return nil, connect.NewError(connect.CodeInternal, errors.Errorf("failed to create mcp setting: %v", err))+ }+ setting, err := s.store.UpdateSettingAtomic(ctx, workspaceID, storepb.SettingName_MCP, apply, nil)+ if err != nil {+ var connectErr *connect.Error+ if errors.As(err, &connectErr) {+ return nil, err+ }+ return nil, connect.NewError(connect.CodeInternal, errors.Errorf("failed to set setting: %v", err))+ }++ if setServiceData, ok := common.GetSetServiceDataFromContext(ctx); ok && lockedBefore != nil {+ v1pbSetting, err := convertToSettingMessage(&store.SettingMessage{+ Name: storepb.SettingName_MCP,+ Workspace: workspaceID,+ Value: lockedBefore,+ })+ if err != nil {+ slog.Warn("audit: failed to convert to v1.Setting", log.BBError(err))+ } else if p, err := anypb.New(v1pbSetting); err != nil {+ slog.Warn("audit: failed to convert to anypb.Any", log.BBError(err))+ } else {+ setServiceData(p)+ }+ }++ settingMessage, err := convertToSettingMessage(setting)+ if err != nil {+ return nil, connect.NewError(connect.CodeInternal, errors.Errorf("failed to convert setting message: %v", err))+ }+ return connect.NewResponse(settingMessage), nil+}+// validateMCPCapability rejects an explicit write of UNSPECIFIED — absent has// defined resolver semantics (it resolves to READ_WRITE), so writing// "unspecified" is a caller bug — and unknown enum numbers, which proto3 open// enums would otherwise let through.-func validateMCPCapability(capability storepb.WorkspaceProfileSetting_MCPCapability) error {- if capability == storepb.WorkspaceProfileSetting_MCP_CAPABILITY_UNSPECIFIED {- return connect.NewError(connect.CodeInvalidArgument, errors.Errorf("mcp_capability cannot be set to MCP_CAPABILITY_UNSPECIFIED; choose an explicit capability or omit the update mask path to leave it unset"))+func validateMCPCapability(capability storepb.MCPSetting_Capability) error {+ if capability == storepb.MCPSetting_CAPABILITY_UNSPECIFIED {+ return connect.NewError(connect.CodeInvalidArgument, errors.Errorf("capability cannot be set to CAPABILITY_UNSPECIFIED; choose an explicit capability or omit the update mask path to leave it unset"))}- if _, ok := storepb.WorkspaceProfileSetting_MCPCapability_name[int32(capability)]; !ok {- return connect.NewError(connect.CodeInvalidArgument, errors.Errorf("unknown mcp_capability value %d", capability))+ if _, ok := storepb.MCPSetting_Capability_name[int32(capability)]; !ok {+ return connect.NewError(connect.CodeInvalidArgument, errors.Errorf("unknown capability value %d", capability))}return nil}diff --git a/backend/api/v1/setting_service_converter.go b/backend/api/v1/setting_service_converter.goindex bc22ce90a9..c2b5434ca6 100644--- a/backend/api/v1/setting_service_converter.go+++ b/backend/api/v1/setting_service_converter.go@@ -43,6 +43,19 @@ func convertToSettingMessage(setting *store.SettingMessage) (*v1pb.Setting, erro},},}, nil+ case storepb.SettingName_MCP:+ storeValue, ok := setting.Value.(*storepb.MCPSetting)+ if !ok {+ return nil, connect.NewError(connect.CodeInternal, errors.Errorf("invalid setting value type for %s", setting.Name))+ }+ return &v1pb.Setting{+ Name: settingName,+ Value: &v1pb.SettingValue{+ Value: &v1pb.SettingValue_Mcp{+ Mcp: convertToMCPSetting(storeValue),+ },+ },+ }, nilcase storepb.SettingName_WORKSPACE_APPROVAL:storeValue, ok := setting.Value.(*storepb.WorkspaceApprovalSetting)if !ok {@@ -175,6 +188,8 @@ func convertStoreSettingNameToV1(storeName storepb.SettingName) v1pb.Setting_Setreturn v1pb.Setting_ENVIRONMENTcase storepb.SettingName_EMAIL:return v1pb.Setting_EMAIL+ case storepb.SettingName_MCP:+ return v1pb.Setting_MCPcase storepb.SettingName_SYSTEM:// Backend-only setting, not exposed in v1 APIdefault:@@ -204,6 +219,8 @@ func convertV1SettingNameToStore(v1Name v1pb.Setting_SettingName) storepb.Settinreturn storepb.SettingName_ENVIRONMENTcase v1pb.Setting_EMAIL:return storepb.SettingName_EMAIL+ case v1pb.Setting_MCP:+ return storepb.SettingName_MCPdefault:return storepb.SettingName_SETTING_NAME_UNSPECIFIED}@@ -280,7 +297,6 @@ func convertWorkspaceProfileSetting(v1Setting *v1pb.WorkspaceProfileSetting) *stQueryTimeout: v1Setting.QueryTimeout,SqlEditorThemeId: v1Setting.SqlEditorThemeId,SqlEditorCustomTheme: convertToStoreSQLEditorThemeSetting(v1Setting.SqlEditorCustomTheme),- McpCapability: storepb.WorkspaceProfileSetting_MCPCapability(v1Setting.McpCapability),}// Convert announcement if present. The store only holds the theme colors.@@ -359,7 +375,22 @@ func convertToWorkspaceProfileSetting(storeSetting *storepb.WorkspaceProfileSettQueryTimeout: storeSetting.QueryTimeout,SqlEditorThemeId: storeSetting.SqlEditorThemeId,SqlEditorCustomTheme: convertToV1SQLEditorThemeSetting(storeSetting.SqlEditorCustomTheme),- McpCapability: v1pb.WorkspaceProfileSetting_MCPCapability(storeSetting.McpCapability),+ }+}++// convertToStoreMCPCapability crosses the two Capability enums by number.+// TestMCPCapabilityEnumsAgree pins that they stay aligned.+func convertToStoreMCPCapability(c v1pb.MCPSetting_Capability) storepb.MCPSetting_Capability {+ return storepb.MCPSetting_Capability(c)+}++func convertToMCPSetting(s *storepb.MCPSetting) *v1pb.MCPSetting {+ if s == nil {+ return nil+ }+ return &v1pb.MCPSetting{+ Capability: v1pb.MCPSetting_Capability(s.Capability),+ IgnoreMaskingExemptions: s.IgnoreMaskingExemptions,}}diff --git a/backend/api/v1/setting_service_test.go b/backend/api/v1/setting_service_test.goindex 872a6c4489..0c509e93ec 100644--- a/backend/api/v1/setting_service_test.go+++ b/backend/api/v1/setting_service_test.go@@ -202,15 +202,15 @@ func TestValidateAnnouncementTheme(t *testing.T) {func TestValidateMCPCapability(t *testing.T) {cases := []struct {name string- capability storepb.WorkspaceProfileSetting_MCPCapability+ capability storepb.MCPSetting_CapabilitywantErr bool}{- {"unspecified rejected", storepb.WorkspaceProfileSetting_MCP_CAPABILITY_UNSPECIFIED, true},- {"disabled", storepb.WorkspaceProfileSetting_DISABLED, false},- {"read only", storepb.WorkspaceProfileSetting_READ_ONLY, false},- {"read write", storepb.WorkspaceProfileSetting_READ_WRITE, false},- {"reserved value rejected", storepb.WorkspaceProfileSetting_MCPCapability(2), true},- {"unknown value rejected", storepb.WorkspaceProfileSetting_MCPCapability(99), true},+ {"unspecified rejected", storepb.MCPSetting_CAPABILITY_UNSPECIFIED, true},+ {"disabled", storepb.MCPSetting_DISABLED, false},+ {"read only", storepb.MCPSetting_READ_ONLY, false},+ {"read write", storepb.MCPSetting_READ_WRITE, false},+ {"reserved value rejected", storepb.MCPSetting_Capability(2), true},+ {"unknown value rejected", storepb.MCPSetting_Capability(99), true},}for _, tc := range cases {t.Run(tc.name, func(t *testing.T) {@@ -282,3 +282,17 @@ func TestPreflightWorkspaceProfileSaaSRestrictedPaths(t *testing.T) {require.NoError(t, err, path)}}++// TestAlwaysPresentSettingsHaveAZeroValue pins the two halves of the+// always-present rule against each other. ListSettings walks the slice to+// synthesize absent rows; Get and Update key on emptySetting returning+// non-nil. A name in one and not the other is a setting that lists but cannot+// be read, or reads but cannot be patched.+func TestAlwaysPresentSettingsHaveAZeroValue(t *testing.T) {+ for _, name := range alwaysPresentSettings {+ require.NotNil(t, emptySetting(name, "ws"), "%v is listed as always present", name)+ require.True(t, settingIsAlwaysPresent(name))+ }+ require.False(t, settingIsAlwaysPresent(storepb.SettingName_WORKSPACE_PROFILE),+ "a setting whose row always exists must keep 404 for a genuinely missing one")+}diff --git a/backend/api/v1/sql_service.go b/backend/api/v1/sql_service.goindex 50a3a9c5ca..bbd3676bcf 100644--- a/backend/api/v1/sql_service.go+++ b/backend/api/v1/sql_service.go@@ -168,11 +168,11 @@ func (s *SQLService) AdminExecute(ctx context.Context, stream *connect.BidiStrea}// buildExportQueryContext assembles the db.QueryContext for an export request.-// SkipMasking has to be set here (not only checked around the post-execution-// MaskResults pass) because some drivers mask at query time via SQL rewrites-// — by the time the second pass runs the rows would already be masked, and-// a JIT grant with unmask=true would silently export masked data. See PR-// #20487 review (RainbowDashy).+// SkipMasking has to be set here, not only checked around the post-execution+// MaskResults pass: queryRetry reads it off the QueryContext to decide+// maskingEnabled and whether to extract sensitive predicate columns, and both+// of those run before the export's own check. See PR #20487 review+// (RainbowDashy). No driver reads the field.func buildExportQueryContext(restriction *store.EffectiveQueryDataPolicy, userEmail string, schema *string, container string, skipMasking bool) db.QueryContext {qc := db.QueryContext{Limit: int(restriction.MaximumResultRows),@@ -417,7 +417,10 @@ func (s *SQLService) Query(ctx context.Context, req *connect.Request[v1pb.QueryROption: request.QueryOption,Container: request.GetContainer(),MaximumSQLResultSize: queryRestriction.MaximumResultSize,- SkipMasking: accessGrant != nil && accessGrant.Payload.Unmask,+ // SkipMasking turns the whole masking pass off (queryRetry's+ // maskingEnabled), so exemptionsForPrincipal never runs when it is set.+ // The toggle has to suppress it here as well as there.+ SkipMasking: accessGrant != nil && accessGrant.Payload.Unmask && !mcpIgnoresMaskingExemptions(ctx),}if request.Schema != nil {queryContext.Schema = *request.Schema@@ -1041,9 +1044,11 @@ func (s *SQLService) Export(ctx context.Context, req *connect.Request[v1pb.Expor// its target databases, so span-level ACL still runs and only the// granted targets are exempted from IAM. See PR #20487 review.optionalAccessCheck := s.accessCheckWithGrant(accessGrant)+ // Export is a WRITE method, so a read-write MCP session reaches it with the+ // same access-grant unmask Query carries.skipMasking := falseif accessGrant != nil {- skipMasking = accessGrant.Payload.Unmask+ skipMasking = accessGrant.Payload.Unmask && !mcpIgnoresMaskingExemptions(ctx)}bytes, duration, exportErr := doExport(ctx, s.store, s.dbFactory, s.licenseService, request, user, instance, database, optionalAccessCheck, s.schemaSyncer, dataSource, skipMasking)diff --git a/backend/api/v1/workspace_service.go b/backend/api/v1/workspace_service.goindex df331148db..c22c9bc82e 100644--- a/backend/api/v1/workspace_service.go+++ b/backend/api/v1/workspace_service.go@@ -227,7 +227,7 @@ func (s *WorkspaceService) RotateDirectorySyncToken(ctx context.Context, req *co// would keep accepting the token they think they just replaced. apply stays// free of database reads; it runs holding the row lock and the connection.if _, err := s.store.UpdateSettingAtomic(ctx, workspaceID, storepb.SettingName_WORKSPACE_PROFILE,- func(current proto.Message) (proto.Message, error) {+ func(current proto.Message, _ []byte) (proto.Message, error) {profile, ok := current.(*storepb.WorkspaceProfileSetting)if !ok {return nil, errors.Errorf("unexpected setting value type %T", current)diff --git a/backend/component/masker/masker.go b/backend/component/masker/masker.goindex 162939c4db..fd553a934e 100644--- a/backend/component/masker/masker.go+++ b/backend/component/masker/masker.go@@ -70,10 +70,16 @@ func NewFullMasker(substitution string) *FullMasker {}}+// DefaultFullMaskSubstitution is what a full mask puts in place of a value when+// no substitution is configured. It is the one mask output fixed in code rather+// than chosen by an admin or derived from the value, which is what lets+// maskedWriteRefusal recognize it.+const DefaultFullMaskSubstitution = "******"+// NewDefaultFullMasker returns a new FullMasker with default substitution(`******`).func NewDefaultFullMasker() *FullMasker {return &FullMasker{- substitution: "******",+ substitution: DefaultFullMaskSubstitution,}}@@ -256,14 +262,14 @@ func (m *RangeMasker) Mask(data *MaskData) *v1pb.RowValue {if kind.NullValue == structpb.NullValue_NULL_VALUE {return &v1pb.RowValue{Kind: &v1pb.RowValue_StringValue{- StringValue: "******",+ StringValue: DefaultFullMaskSubstitution,},}}case *v1pb.RowValue_BoolValue:return &v1pb.RowValue{Kind: &v1pb.RowValue_StringValue{- StringValue: "******",+ StringValue: DefaultFullMaskSubstitution,},}case *v1pb.RowValue_BytesValue:@@ -378,14 +384,14 @@ func (*DefaultRangeMasker) Mask(data *MaskData) *v1pb.RowValue {if kind.NullValue == structpb.NullValue_NULL_VALUE {return &v1pb.RowValue{Kind: &v1pb.RowValue_StringValue{- StringValue: "******",+ StringValue: DefaultFullMaskSubstitution,},}}case *v1pb.RowValue_BoolValue:return &v1pb.RowValue{Kind: &v1pb.RowValue_StringValue{- StringValue: "******",+ StringValue: DefaultFullMaskSubstitution,},}case *v1pb.RowValue_BytesValue:@@ -495,14 +501,14 @@ func (m *MD5Masker) Mask(data *MaskData) *v1pb.RowValue {if kind.NullValue == structpb.NullValue_NULL_VALUE {return &v1pb.RowValue{Kind: &v1pb.RowValue_StringValue{- StringValue: "******",+ StringValue: DefaultFullMaskSubstitution,},}}case *v1pb.RowValue_BoolValue:return &v1pb.RowValue{Kind: &v1pb.RowValue_StringValue{- StringValue: "******",+ StringValue: DefaultFullMaskSubstitution,},}case *v1pb.RowValue_BytesValue:diff --git a/backend/component/recovery/service.go b/backend/component/recovery/service.goindex 8b47277094..cd7f107274 100644--- a/backend/component/recovery/service.go+++ b/backend/component/recovery/service.go@@ -135,7 +135,7 @@ func (s *Service) EnablePasswordSignin(ctx context.Context, workspaceID string)ctx,workspaceID,storepb.SettingName_WORKSPACE_PROFILE,- func(current proto.Message) (proto.Message, error) {+ func(current proto.Message, _ []byte) (proto.Message, error) {profile, ok := current.(*storepb.WorkspaceProfileSetting)if !ok {return nil, errors.New("workspace profile setting has an unexpected type")diff --git a/backend/generated-go/store/setting.pb.go b/backend/generated-go/store/setting.pb.goindex b385baf74f..cabb6b370d 100644--- a/backend/generated-go/store/setting.pb.go+++ b/backend/generated-go/store/setting.pb.go@@ -38,21 +38,23 @@ const (SettingName_SEMANTIC_TYPES SettingName = 7SettingName_ENVIRONMENT SettingName = 8SettingName_EMAIL SettingName = 9+ SettingName_MCP SettingName = 10)// Enum value maps for SettingName.var (SettingName_name = map[int32]string{- 0: "SETTING_NAME_UNSPECIFIED",- 1: "SYSTEM",- 2: "WORKSPACE_PROFILE",- 3: "WORKSPACE_APPROVAL",- 4: "APP_IM",- 5: "AI",- 6: "DATA_CLASSIFICATION",- 7: "SEMANTIC_TYPES",- 8: "ENVIRONMENT",- 9: "EMAIL",+ 0: "SETTING_NAME_UNSPECIFIED",+ 1: "SYSTEM",+ 2: "WORKSPACE_PROFILE",+ 3: "WORKSPACE_APPROVAL",+ 4: "APP_IM",+ 5: "AI",+ 6: "DATA_CLASSIFICATION",+ 7: "SEMANTIC_TYPES",+ 8: "ENVIRONMENT",+ 9: "EMAIL",+ 10: "MCP",}SettingName_value = map[string]int32{"SETTING_NAME_UNSPECIFIED": 0,@@ -65,6 +67,7 @@ var ("SEMANTIC_TYPES": 7,"ENVIRONMENT": 8,"EMAIL": 9,+ "MCP": 10,})@@ -147,63 +150,62 @@ func (WorkspaceProfileSetting_DatabaseChangeMode) EnumDescriptor() ([]byte, []inreturn file_store_setting_proto_rawDescGZIP(), []int{1, 0}}-// MCPCapability is the maximum capability an MCP (Model Context Protocol)-// session may have in the workspace. It is a ceiling: a session runs at this-// level or lower. Unset (UNSPECIFIED) is treated as READ_WRITE so existing-// workspaces are unaffected.-type WorkspaceProfileSetting_MCPCapability int32+// Capability is the ceiling: a session runs at this level or lower. An absent+// MCP setting resolves to READ_WRITE, so a workspace that never configured+// MCP is unaffected.+type MCPSetting_Capability int32const (- WorkspaceProfileSetting_MCP_CAPABILITY_UNSPECIFIED WorkspaceProfileSetting_MCPCapability = 0+ MCPSetting_CAPABILITY_UNSPECIFIED MCPSetting_Capability = 0// MCP connections are rejected.- WorkspaceProfileSetting_DISABLED WorkspaceProfileSetting_MCPCapability = 1+ MCPSetting_DISABLED MCPSetting_Capability = 1// MCP may inspect metadata and run read-only queries. (Enforced from P1b.)- WorkspaceProfileSetting_READ_ONLY WorkspaceProfileSetting_MCPCapability = 3+ MCPSetting_READ_ONLY MCPSetting_Capability = 3// MCP may perform mutations, still bounded by the user's RBAC.- WorkspaceProfileSetting_READ_WRITE WorkspaceProfileSetting_MCPCapability = 4+ MCPSetting_READ_WRITE MCPSetting_Capability = 4)-// Enum value maps for WorkspaceProfileSetting_MCPCapability.+// Enum value maps for MCPSetting_Capability.var (- WorkspaceProfileSetting_MCPCapability_name = map[int32]string{- 0: "MCP_CAPABILITY_UNSPECIFIED",+ MCPSetting_Capability_name = map[int32]string{+ 0: "CAPABILITY_UNSPECIFIED",1: "DISABLED",3: "READ_ONLY",4: "READ_WRITE",}- WorkspaceProfileSetting_MCPCapability_value = map[string]int32{- "MCP_CAPABILITY_UNSPECIFIED": 0,- "DISABLED": 1,- "READ_ONLY": 3,- "READ_WRITE": 4,+ MCPSetting_Capability_value = map[string]int32{+ "CAPABILITY_UNSPECIFIED": 0,+ "DISABLED": 1,+ "READ_ONLY": 3,+ "READ_WRITE": 4,})-func (x WorkspaceProfileSetting_MCPCapability) Enum() *WorkspaceProfileSetting_MCPCapability {- p := new(WorkspaceProfileSetting_MCPCapability)+func (x MCPSetting_Capability) Enum() *MCPSetting_Capability {+ p := new(MCPSetting_Capability)*p = xreturn p}-func (x WorkspaceProfileSetting_MCPCapability) String() string {+func (x MCPSetting_Capability) String() string {return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))}-func (WorkspaceProfileSetting_MCPCapability) Descriptor() protoreflect.EnumDescriptor {+func (MCPSetting_Capability) Descriptor() protoreflect.EnumDescriptor {return file_store_setting_proto_enumTypes[2].Descriptor()}-func (WorkspaceProfileSetting_MCPCapability) Type() protoreflect.EnumType {+func (MCPSetting_Capability) Type() protoreflect.EnumType {return &file_store_setting_proto_enumTypes[2]}-func (x WorkspaceProfileSetting_MCPCapability) Number() protoreflect.EnumNumber {+func (x MCPSetting_Capability) Number() protoreflect.EnumNumber {return protoreflect.EnumNumber(x)}-// Deprecated: Use WorkspaceProfileSetting_MCPCapability.Descriptor instead.-func (WorkspaceProfileSetting_MCPCapability) EnumDescriptor() ([]byte, []int) {- return file_store_setting_proto_rawDescGZIP(), []int{1, 1}+// Deprecated: Use MCPSetting_Capability.Descriptor instead.+func (MCPSetting_Capability) EnumDescriptor() ([]byte, []int) {+ return file_store_setting_proto_rawDescGZIP(), []int{2, 0}}type WorkspaceApprovalSetting_Rule_Source int32@@ -262,7 +264,7 @@ func (x WorkspaceApprovalSetting_Rule_Source) Number() protoreflect.EnumNumber {// Deprecated: Use WorkspaceApprovalSetting_Rule_Source.Descriptor instead.func (WorkspaceApprovalSetting_Rule_Source) EnumDescriptor() ([]byte, []int) {- return file_store_setting_proto_rawDescGZIP(), []int{3, 0, 0}+ return file_store_setting_proto_rawDescGZIP(), []int{4, 0, 0}}type Algorithm_InnerOuterMask_MaskType int32@@ -311,7 +313,7 @@ func (x Algorithm_InnerOuterMask_MaskType) Number() protoreflect.EnumNumber {// Deprecated: Use Algorithm_InnerOuterMask_MaskType.Descriptor instead.func (Algorithm_InnerOuterMask_MaskType) EnumDescriptor() ([]byte, []int) {- return file_store_setting_proto_rawDescGZIP(), []int{5, 3, 0}+ return file_store_setting_proto_rawDescGZIP(), []int{6, 3, 0}}type AISetting_Provider int32@@ -366,7 +368,7 @@ func (x AISetting_Provider) Number() protoreflect.EnumNumber {// Deprecated: Use AISetting_Provider.Descriptor instead.func (AISetting_Provider) EnumDescriptor() ([]byte, []int) {- return file_store_setting_proto_rawDescGZIP(), []int{8, 0}+ return file_store_setting_proto_rawDescGZIP(), []int{9, 0}}type EmailSetting_Type int32@@ -412,7 +414,7 @@ func (x EmailSetting_Type) Number() protoreflect.EnumNumber {// Deprecated: Use EmailSetting_Type.Descriptor instead.func (EmailSetting_Type) EnumDescriptor() ([]byte, []int) {- return file_store_setting_proto_rawDescGZIP(), []int{10, 0}+ return file_store_setting_proto_rawDescGZIP(), []int{11, 0}}type EmailSetting_SMTPConfig_Encryption int32@@ -464,7 +466,7 @@ func (x EmailSetting_SMTPConfig_Encryption) Number() protoreflect.EnumNumber {// Deprecated: Use EmailSetting_SMTPConfig_Encryption.Descriptor instead.func (EmailSetting_SMTPConfig_Encryption) EnumDescriptor() ([]byte, []int) {- return file_store_setting_proto_rawDescGZIP(), []int{10, 0, 0}+ return file_store_setting_proto_rawDescGZIP(), []int{11, 0, 0}}type EmailSetting_SMTPConfig_Authentication int32@@ -519,7 +521,7 @@ func (x EmailSetting_SMTPConfig_Authentication) Number() protoreflect.EnumNumber// Deprecated: Use EmailSetting_SMTPConfig_Authentication.Descriptor instead.func (EmailSetting_SMTPConfig_Authentication) EnumDescriptor() ([]byte, []int) {- return file_store_setting_proto_rawDescGZIP(), []int{10, 0, 1}+ return file_store_setting_proto_rawDescGZIP(), []int{11, 0, 1}}type SystemSetting struct {@@ -622,13 +624,6 @@ type WorkspaceProfileSetting struct {// The max expiration duration for request role.// Deprecated: use just-in-time access request flows instead.MaximumRoleExpiration *durationpb.Duration `protobuf:"bytes,25,opt,name=maximum_role_expiration,json=maximumRoleExpiration,proto3" json:"maximum_role_expiration,omitempty"`- // The maximum capability available to MCP (Model Context Protocol) sessions in- // this workspace, acting as an admin-set ceiling. Unset is treated as- // READ_WRITE for backward compatibility; DISABLED rejects all MCP- // connections. Enforced server-side at two points: the /mcp endpoint decides- // whether a connection is admitted at all, and the ceiling gate on the- // internal MCP chain decides, per request, which method classes are served.- McpCapability WorkspaceProfileSetting_MCPCapability `protobuf:"varint,26,opt,name=mcp_capability,json=mcpCapability,proto3,enum=bytebase.store.WorkspaceProfileSetting_MCPCapability" json:"mcp_capability,omitempty"`// Hex-encoded SHA-256 of the SCIM directory sync token. The plaintext is shown// once at rotation and never stored. SHA-256 rather than a slow KDF because the// token is 122 bits of crypto/rand, not a human-chosen secret.@@ -828,18 +823,84 @@ func (x *WorkspaceProfileSetting) GetMaximumRoleExpiration() *durationpb.Duratioreturn nil}-func (x *WorkspaceProfileSetting) GetMcpCapability() WorkspaceProfileSetting_MCPCapability {+func (x *WorkspaceProfileSetting) GetDirectorySyncTokenHash() string {if x != nil {- return x.McpCapability+ return x.DirectorySyncTokenHash}- return WorkspaceProfileSetting_MCP_CAPABILITY_UNSPECIFIED+ return ""}-func (x *WorkspaceProfileSetting) GetDirectorySyncTokenHash() string {+// MCPSetting is what an MCP (Model Context Protocol) session may do in this+// workspace. It is its own setting rather than a field of the workspace profile+// because the set grows, and because the /mcp kill switch reads it on every+// request and should not share a row — or a parse failure — with branding and+// sign-in configuration.+type MCPSetting struct {+ state protoimpl.MessageState `protogen:"open.v1"`+ // The maximum capability available to MCP sessions in this workspace, acting+ // as an admin-set ceiling. Enforced server-side at three points: the /mcp+ // endpoint decides whether a connection is admitted at all, the ceiling gate+ // on the internal MCP chain decides, per request, which method classes are+ // served, and under READ_ONLY the SQL clamp decides, per statement, whether+ // it only reads.+ Capability MCPSetting_Capability `protobuf:"varint,1,opt,name=capability,proto3,enum=bytebase.store.MCPSetting_Capability" json:"capability,omitempty"`+ // Whether a request that arrived over MCP stops applying the caller's own+ // unmasking provisioning. Two mechanisms let a user see a real value and this+ // suppresses both: the masking exemptions granted to them, and the unmask+ // carried by an access grant. The same user in the console is untouched.+ //+ // It cannot force masking where there is none. Masking substitutes values in+ // query results, so this does not reach data copied into a column carrying no+ // masking policy, and it does nothing on the engines Bytebase does not mask.+ // It narrows what an agent reads through the paths Bytebase masks; it is not+ // a confidentiality boundary.+ IgnoreMaskingExemptions bool `protobuf:"varint,2,opt,name=ignore_masking_exemptions,json=ignoreMaskingExemptions,proto3" json:"ignore_masking_exemptions,omitempty"`+ unknownFields protoimpl.UnknownFields+ sizeCache protoimpl.SizeCache+}++func (x *MCPSetting) Reset() {+ *x = MCPSetting{}+ mi := &file_store_setting_proto_msgTypes[2]+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ ms.StoreMessageInfo(mi)+}++func (x *MCPSetting) String() string {+ return protoimpl.X.MessageStringOf(x)+}++func (*MCPSetting) ProtoMessage() {}++func (x *MCPSetting) ProtoReflect() protoreflect.Message {+ mi := &file_store_setting_proto_msgTypes[2]if x != nil {- return x.DirectorySyncTokenHash+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ if ms.LoadMessageInfo() == nil {+ ms.StoreMessageInfo(mi)+ }+ return ms}- return ""+ return mi.MessageOf(x)+}++// Deprecated: Use MCPSetting.ProtoReflect.Descriptor instead.+func (*MCPSetting) Descriptor() ([]byte, []int) {+ return file_store_setting_proto_rawDescGZIP(), []int{2}+}++func (x *MCPSetting) GetCapability() MCPSetting_Capability {+ if x != nil {+ return x.Capability+ }+ return MCPSetting_CAPABILITY_UNSPECIFIED+}++func (x *MCPSetting) GetIgnoreMaskingExemptions() bool {+ if x != nil {+ return x.IgnoreMaskingExemptions+ }+ return false}type SQLEditorThemeSetting struct {@@ -855,7 +916,7 @@ type SQLEditorThemeSetting struct {func (x *SQLEditorThemeSetting) Reset() {*x = SQLEditorThemeSetting{}- mi := &file_store_setting_proto_msgTypes[2]+ mi := &file_store_setting_proto_msgTypes[3]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -867,7 +928,7 @@ func (x *SQLEditorThemeSetting) String() string {func (*SQLEditorThemeSetting) ProtoMessage() {}func (x *SQLEditorThemeSetting) ProtoReflect() protoreflect.Message {- mi := &file_store_setting_proto_msgTypes[2]+ mi := &file_store_setting_proto_msgTypes[3]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -880,7 +941,7 @@ func (x *SQLEditorThemeSetting) ProtoReflect() protoreflect.Message {// Deprecated: Use SQLEditorThemeSetting.ProtoReflect.Descriptor instead.func (*SQLEditorThemeSetting) Descriptor() ([]byte, []int) {- return file_store_setting_proto_rawDescGZIP(), []int{2}+ return file_store_setting_proto_rawDescGZIP(), []int{3}}func (x *SQLEditorThemeSetting) GetId() string {@@ -920,7 +981,7 @@ type WorkspaceApprovalSetting struct {func (x *WorkspaceApprovalSetting) Reset() {*x = WorkspaceApprovalSetting{}- mi := &file_store_setting_proto_msgTypes[3]+ mi := &file_store_setting_proto_msgTypes[4]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -932,7 +993,7 @@ func (x *WorkspaceApprovalSetting) String() string {func (*WorkspaceApprovalSetting) ProtoMessage() {}func (x *WorkspaceApprovalSetting) ProtoReflect() protoreflect.Message {- mi := &file_store_setting_proto_msgTypes[3]+ mi := &file_store_setting_proto_msgTypes[4]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -945,7 +1006,7 @@ func (x *WorkspaceApprovalSetting) ProtoReflect() protoreflect.Message {// Deprecated: Use WorkspaceApprovalSetting.ProtoReflect.Descriptor instead.func (*WorkspaceApprovalSetting) Descriptor() ([]byte, []int) {- return file_store_setting_proto_rawDescGZIP(), []int{3}+ return file_store_setting_proto_rawDescGZIP(), []int{4}}func (x *WorkspaceApprovalSetting) GetRules() []*WorkspaceApprovalSetting_Rule {@@ -964,7 +1025,7 @@ type DataClassificationSetting struct {func (x *DataClassificationSetting) Reset() {*x = DataClassificationSetting{}- mi := &file_store_setting_proto_msgTypes[4]+ mi := &file_store_setting_proto_msgTypes[5]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -976,7 +1037,7 @@ func (x *DataClassificationSetting) String() string {func (*DataClassificationSetting) ProtoMessage() {}func (x *DataClassificationSetting) ProtoReflect() protoreflect.Message {- mi := &file_store_setting_proto_msgTypes[4]+ mi := &file_store_setting_proto_msgTypes[5]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -989,7 +1050,7 @@ func (x *DataClassificationSetting) ProtoReflect() protoreflect.Message {// Deprecated: Use DataClassificationSetting.ProtoReflect.Descriptor instead.func (*DataClassificationSetting) Descriptor() ([]byte, []int) {- return file_store_setting_proto_rawDescGZIP(), []int{4}+ return file_store_setting_proto_rawDescGZIP(), []int{5}}func (x *DataClassificationSetting) GetConfigs() []*DataClassificationSetting_DataClassificationConfig {@@ -1014,7 +1075,7 @@ type Algorithm struct {func (x *Algorithm) Reset() {*x = Algorithm{}- mi := &file_store_setting_proto_msgTypes[5]+ mi := &file_store_setting_proto_msgTypes[6]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -1026,7 +1087,7 @@ func (x *Algorithm) String() string {func (*Algorithm) ProtoMessage() {}func (x *Algorithm) ProtoReflect() protoreflect.Message {- mi := &file_store_setting_proto_msgTypes[5]+ mi := &file_store_setting_proto_msgTypes[6]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -1039,7 +1100,7 @@ func (x *Algorithm) ProtoReflect() protoreflect.Message {// Deprecated: Use Algorithm.ProtoReflect.Descriptor instead.func (*Algorithm) Descriptor() ([]byte, []int) {- return file_store_setting_proto_rawDescGZIP(), []int{5}+ return file_store_setting_proto_rawDescGZIP(), []int{6}}func (x *Algorithm) GetMask() isAlgorithm_Mask {@@ -1122,7 +1183,7 @@ type SemanticTypeSetting struct {func (x *SemanticTypeSetting) Reset() {*x = SemanticTypeSetting{}- mi := &file_store_setting_proto_msgTypes[6]+ mi := &file_store_setting_proto_msgTypes[7]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -1134,7 +1195,7 @@ func (x *SemanticTypeSetting) String() string {func (*SemanticTypeSetting) ProtoMessage() {}func (x *SemanticTypeSetting) ProtoReflect() protoreflect.Message {- mi := &file_store_setting_proto_msgTypes[6]+ mi := &file_store_setting_proto_msgTypes[7]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -1147,7 +1208,7 @@ func (x *SemanticTypeSetting) ProtoReflect() protoreflect.Message {// Deprecated: Use SemanticTypeSetting.ProtoReflect.Descriptor instead.func (*SemanticTypeSetting) Descriptor() ([]byte, []int) {- return file_store_setting_proto_rawDescGZIP(), []int{6}+ return file_store_setting_proto_rawDescGZIP(), []int{7}}func (x *SemanticTypeSetting) GetTypes() []*SemanticTypeSetting_SemanticType {@@ -1166,7 +1227,7 @@ type AppIMSetting struct {func (x *AppIMSetting) Reset() {*x = AppIMSetting{}- mi := &file_store_setting_proto_msgTypes[7]+ mi := &file_store_setting_proto_msgTypes[8]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -1178,7 +1239,7 @@ func (x *AppIMSetting) String() string {func (*AppIMSetting) ProtoMessage() {}func (x *AppIMSetting) ProtoReflect() protoreflect.Message {- mi := &file_store_setting_proto_msgTypes[7]+ mi := &file_store_setting_proto_msgTypes[8]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -1191,7 +1252,7 @@ func (x *AppIMSetting) ProtoReflect() protoreflect.Message {// Deprecated: Use AppIMSetting.ProtoReflect.Descriptor instead.func (*AppIMSetting) Descriptor() ([]byte, []int) {- return file_store_setting_proto_rawDescGZIP(), []int{7}+ return file_store_setting_proto_rawDescGZIP(), []int{8}}func (x *AppIMSetting) GetSettings() []*AppIMSetting_IMSetting {@@ -1215,7 +1276,7 @@ type AISetting struct {func (x *AISetting) Reset() {*x = AISetting{}- mi := &file_store_setting_proto_msgTypes[8]+ mi := &file_store_setting_proto_msgTypes[9]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -1227,7 +1288,7 @@ func (x *AISetting) String() string {func (*AISetting) ProtoMessage() {}func (x *AISetting) ProtoReflect() protoreflect.Message {- mi := &file_store_setting_proto_msgTypes[8]+ mi := &file_store_setting_proto_msgTypes[9]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -1240,7 +1301,7 @@ func (x *AISetting) ProtoReflect() protoreflect.Message {// Deprecated: Use AISetting.ProtoReflect.Descriptor instead.func (*AISetting) Descriptor() ([]byte, []int) {- return file_store_setting_proto_rawDescGZIP(), []int{8}+ return file_store_setting_proto_rawDescGZIP(), []int{9}}func (x *AISetting) GetEnabled() bool {@@ -1294,7 +1355,7 @@ type EnvironmentSetting struct {func (x *EnvironmentSetting) Reset() {*x = EnvironmentSetting{}- mi := &file_store_setting_proto_msgTypes[9]+ mi := &file_store_setting_proto_msgTypes[10]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -1306,7 +1367,7 @@ func (x *EnvironmentSetting) String() string {func (*EnvironmentSetting) ProtoMessage() {}func (x *EnvironmentSetting) ProtoReflect() protoreflect.Message {- mi := &file_store_setting_proto_msgTypes[9]+ mi := &file_store_setting_proto_msgTypes[10]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -1319,7 +1380,7 @@ func (x *EnvironmentSetting) ProtoReflect() protoreflect.Message {// Deprecated: Use EnvironmentSetting.ProtoReflect.Descriptor instead.func (*EnvironmentSetting) Descriptor() ([]byte, []int) {- return file_store_setting_proto_rawDescGZIP(), []int{9}+ return file_store_setting_proto_rawDescGZIP(), []int{10}}func (x *EnvironmentSetting) GetEnvironments() []*EnvironmentSetting_Environment {@@ -1344,7 +1405,7 @@ type EmailSetting struct {func (x *EmailSetting) Reset() {*x = EmailSetting{}- mi := &file_store_setting_proto_msgTypes[10]+ mi := &file_store_setting_proto_msgTypes[11]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -1356,7 +1417,7 @@ func (x *EmailSetting) String() string {func (*EmailSetting) ProtoMessage() {}func (x *EmailSetting) ProtoReflect() protoreflect.Message {- mi := &file_store_setting_proto_msgTypes[10]+ mi := &file_store_setting_proto_msgTypes[11]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -1369,7 +1430,7 @@ func (x *EmailSetting) ProtoReflect() protoreflect.Message {// Deprecated: Use EmailSetting.ProtoReflect.Descriptor instead.func (*EmailSetting) Descriptor() ([]byte, []int) {- return file_store_setting_proto_rawDescGZIP(), []int{10}+ return file_store_setting_proto_rawDescGZIP(), []int{11}}func (x *EmailSetting) GetFrom() string {@@ -1434,7 +1495,7 @@ type WorkspaceProfileSetting_Announcement struct {func (x *WorkspaceProfileSetting_Announcement) Reset() {*x = WorkspaceProfileSetting_Announcement{}- mi := &file_store_setting_proto_msgTypes[11]+ mi := &file_store_setting_proto_msgTypes[12]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -1446,7 +1507,7 @@ func (x *WorkspaceProfileSetting_Announcement) String() string {func (*WorkspaceProfileSetting_Announcement) ProtoMessage() {}func (x *WorkspaceProfileSetting_Announcement) ProtoReflect() protoreflect.Message {- mi := &file_store_setting_proto_msgTypes[11]+ mi := &file_store_setting_proto_msgTypes[12]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -1505,7 +1566,7 @@ type WorkspaceProfileSetting_PasswordRestriction struct {func (x *WorkspaceProfileSetting_PasswordRestriction) Reset() {*x = WorkspaceProfileSetting_PasswordRestriction{}- mi := &file_store_setting_proto_msgTypes[12]+ mi := &file_store_setting_proto_msgTypes[13]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -1517,7 +1578,7 @@ func (x *WorkspaceProfileSetting_PasswordRestriction) String() string {func (*WorkspaceProfileSetting_PasswordRestriction) ProtoMessage() {}func (x *WorkspaceProfileSetting_PasswordRestriction) ProtoReflect() protoreflect.Message {- mi := &file_store_setting_proto_msgTypes[12]+ mi := &file_store_setting_proto_msgTypes[13]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -1592,7 +1653,7 @@ type WorkspaceProfileSetting_Announcement_AnnouncementTheme struct {func (x *WorkspaceProfileSetting_Announcement_AnnouncementTheme) Reset() {*x = WorkspaceProfileSetting_Announcement_AnnouncementTheme{}- mi := &file_store_setting_proto_msgTypes[13]+ mi := &file_store_setting_proto_msgTypes[14]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -1604,7 +1665,7 @@ func (x *WorkspaceProfileSetting_Announcement_AnnouncementTheme) String() stringfunc (*WorkspaceProfileSetting_Announcement_AnnouncementTheme) ProtoMessage() {}func (x *WorkspaceProfileSetting_Announcement_AnnouncementTheme) ProtoReflect() protoreflect.Message {- mi := &file_store_setting_proto_msgTypes[13]+ mi := &file_store_setting_proto_msgTypes[14]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -1645,7 +1706,7 @@ type WorkspaceApprovalSetting_Rule struct {func (x *WorkspaceApprovalSetting_Rule) Reset() {*x = WorkspaceApprovalSetting_Rule{}- mi := &file_store_setting_proto_msgTypes[15]+ mi := &file_store_setting_proto_msgTypes[16]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -1657,7 +1718,7 @@ func (x *WorkspaceApprovalSetting_Rule) String() string {func (*WorkspaceApprovalSetting_Rule) ProtoMessage() {}func (x *WorkspaceApprovalSetting_Rule) ProtoReflect() protoreflect.Message {- mi := &file_store_setting_proto_msgTypes[15]+ mi := &file_store_setting_proto_msgTypes[16]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -1670,7 +1731,7 @@ func (x *WorkspaceApprovalSetting_Rule) ProtoReflect() protoreflect.Message {// Deprecated: Use WorkspaceApprovalSetting_Rule.ProtoReflect.Descriptor instead.func (*WorkspaceApprovalSetting_Rule) Descriptor() ([]byte, []int) {- return file_store_setting_proto_rawDescGZIP(), []int{3, 0}+ return file_store_setting_proto_rawDescGZIP(), []int{4, 0}}func (x *WorkspaceApprovalSetting_Rule) GetTemplate() *ApprovalTemplate {@@ -1711,7 +1772,7 @@ type DataClassificationSetting_DataClassificationConfig struct {func (x *DataClassificationSetting_DataClassificationConfig) Reset() {*x = DataClassificationSetting_DataClassificationConfig{}- mi := &file_store_setting_proto_msgTypes[16]+ mi := &file_store_setting_proto_msgTypes[17]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -1723,7 +1784,7 @@ func (x *DataClassificationSetting_DataClassificationConfig) String() string {func (*DataClassificationSetting_DataClassificationConfig) ProtoMessage() {}func (x *DataClassificationSetting_DataClassificationConfig) ProtoReflect() protoreflect.Message {- mi := &file_store_setting_proto_msgTypes[16]+ mi := &file_store_setting_proto_msgTypes[17]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -1736,7 +1797,7 @@ func (x *DataClassificationSetting_DataClassificationConfig) ProtoReflect() prot// Deprecated: Use DataClassificationSetting_DataClassificationConfig.ProtoReflect.Descriptor instead.func (*DataClassificationSetting_DataClassificationConfig) Descriptor() ([]byte, []int) {- return file_store_setting_proto_rawDescGZIP(), []int{4, 0}+ return file_store_setting_proto_rawDescGZIP(), []int{5, 0}}func (x *DataClassificationSetting_DataClassificationConfig) GetId() string {@@ -1778,7 +1839,7 @@ type DataClassificationSetting_DataClassificationConfig_Level struct {func (x *DataClassificationSetting_DataClassificationConfig_Level) Reset() {*x = DataClassificationSetting_DataClassificationConfig_Level{}- mi := &file_store_setting_proto_msgTypes[17]+ mi := &file_store_setting_proto_msgTypes[18]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -1790,7 +1851,7 @@ func (x *DataClassificationSetting_DataClassificationConfig_Level) String() strifunc (*DataClassificationSetting_DataClassificationConfig_Level) ProtoMessage() {}func (x *DataClassificationSetting_DataClassificationConfig_Level) ProtoReflect() protoreflect.Message {- mi := &file_store_setting_proto_msgTypes[17]+ mi := &file_store_setting_proto_msgTypes[18]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -1803,7 +1864,7 @@ func (x *DataClassificationSetting_DataClassificationConfig_Level) ProtoReflect(// Deprecated: Use DataClassificationSetting_DataClassificationConfig_Level.ProtoReflect.Descriptor instead.func (*DataClassificationSetting_DataClassificationConfig_Level) Descriptor() ([]byte, []int) {- return file_store_setting_proto_rawDescGZIP(), []int{4, 0, 0}+ return file_store_setting_proto_rawDescGZIP(), []int{5, 0, 0}}func (x *DataClassificationSetting_DataClassificationConfig_Level) GetTitle() string {@@ -1833,7 +1894,7 @@ type DataClassificationSetting_DataClassificationConfig_DataClassification strucfunc (x *DataClassificationSetting_DataClassificationConfig_DataClassification) Reset() {*x = DataClassificationSetting_DataClassificationConfig_DataClassification{}- mi := &file_store_setting_proto_msgTypes[18]+ mi := &file_store_setting_proto_msgTypes[19]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -1845,7 +1906,7 @@ func (x *DataClassificationSetting_DataClassificationConfig_DataClassification)func (*DataClassificationSetting_DataClassificationConfig_DataClassification) ProtoMessage() {}func (x *DataClassificationSetting_DataClassificationConfig_DataClassification) ProtoReflect() protoreflect.Message {- mi := &file_store_setting_proto_msgTypes[18]+ mi := &file_store_setting_proto_msgTypes[19]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -1858,7 +1919,7 @@ func (x *DataClassificationSetting_DataClassificationConfig_DataClassification)// Deprecated: Use DataClassificationSetting_DataClassificationConfig_DataClassification.ProtoReflect.Descriptor instead.func (*DataClassificationSetting_DataClassificationConfig_DataClassification) Descriptor() ([]byte, []int) {- return file_store_setting_proto_rawDescGZIP(), []int{4, 0, 1}+ return file_store_setting_proto_rawDescGZIP(), []int{5, 0, 1}}func (x *DataClassificationSetting_DataClassificationConfig_DataClassification) GetId() string {@@ -1893,7 +1954,7 @@ type Algorithm_FullMask struct {func (x *Algorithm_FullMask) Reset() {*x = Algorithm_FullMask{}- mi := &file_store_setting_proto_msgTypes[20]+ mi := &file_store_setting_proto_msgTypes[21]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -1905,7 +1966,7 @@ func (x *Algorithm_FullMask) String() string {func (*Algorithm_FullMask) ProtoMessage() {}func (x *Algorithm_FullMask) ProtoReflect() protoreflect.Message {- mi := &file_store_setting_proto_msgTypes[20]+ mi := &file_store_setting_proto_msgTypes[21]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -1918,7 +1979,7 @@ func (x *Algorithm_FullMask) ProtoReflect() protoreflect.Message {// Deprecated: Use Algorithm_FullMask.ProtoReflect.Descriptor instead.func (*Algorithm_FullMask) Descriptor() ([]byte, []int) {- return file_store_setting_proto_rawDescGZIP(), []int{5, 0}+ return file_store_setting_proto_rawDescGZIP(), []int{6, 0}}func (x *Algorithm_FullMask) GetSubstitution() string {@@ -1939,7 +2000,7 @@ type Algorithm_RangeMask struct {func (x *Algorithm_RangeMask) Reset() {*x = Algorithm_RangeMask{}- mi := &file_store_setting_proto_msgTypes[21]+ mi := &file_store_setting_proto_msgTypes[22]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -1951,7 +2012,7 @@ func (x *Algorithm_RangeMask) String() string {func (*Algorithm_RangeMask) ProtoMessage() {}func (x *Algorithm_RangeMask) ProtoReflect() protoreflect.Message {- mi := &file_store_setting_proto_msgTypes[21]+ mi := &file_store_setting_proto_msgTypes[22]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -1964,7 +2025,7 @@ func (x *Algorithm_RangeMask) ProtoReflect() protoreflect.Message {// Deprecated: Use Algorithm_RangeMask.ProtoReflect.Descriptor instead.func (*Algorithm_RangeMask) Descriptor() ([]byte, []int) {- return file_store_setting_proto_rawDescGZIP(), []int{5, 1}+ return file_store_setting_proto_rawDescGZIP(), []int{6, 1}}func (x *Algorithm_RangeMask) GetSlices() []*Algorithm_RangeMask_Slice {@@ -1984,7 +2045,7 @@ type Algorithm_MD5Mask struct {func (x *Algorithm_MD5Mask) Reset() {*x = Algorithm_MD5Mask{}- mi := &file_store_setting_proto_msgTypes[22]+ mi := &file_store_setting_proto_msgTypes[23]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -1996,7 +2057,7 @@ func (x *Algorithm_MD5Mask) String() string {func (*Algorithm_MD5Mask) ProtoMessage() {}func (x *Algorithm_MD5Mask) ProtoReflect() protoreflect.Message {- mi := &file_store_setting_proto_msgTypes[22]+ mi := &file_store_setting_proto_msgTypes[23]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -2009,7 +2070,7 @@ func (x *Algorithm_MD5Mask) ProtoReflect() protoreflect.Message {// Deprecated: Use Algorithm_MD5Mask.ProtoReflect.Descriptor instead.func (*Algorithm_MD5Mask) Descriptor() ([]byte, []int) {- return file_store_setting_proto_rawDescGZIP(), []int{5, 2}+ return file_store_setting_proto_rawDescGZIP(), []int{6, 2}}func (x *Algorithm_MD5Mask) GetSalt() string {@@ -2031,7 +2092,7 @@ type Algorithm_InnerOuterMask struct {func (x *Algorithm_InnerOuterMask) Reset() {*x = Algorithm_InnerOuterMask{}- mi := &file_store_setting_proto_msgTypes[23]+ mi := &file_store_setting_proto_msgTypes[24]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -2043,7 +2104,7 @@ func (x *Algorithm_InnerOuterMask) String() string {func (*Algorithm_InnerOuterMask) ProtoMessage() {}func (x *Algorithm_InnerOuterMask) ProtoReflect() protoreflect.Message {- mi := &file_store_setting_proto_msgTypes[23]+ mi := &file_store_setting_proto_msgTypes[24]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -2056,7 +2117,7 @@ func (x *Algorithm_InnerOuterMask) ProtoReflect() protoreflect.Message {// Deprecated: Use Algorithm_InnerOuterMask.ProtoReflect.Descriptor instead.func (*Algorithm_InnerOuterMask) Descriptor() ([]byte, []int) {- return file_store_setting_proto_rawDescGZIP(), []int{5, 3}+ return file_store_setting_proto_rawDescGZIP(), []int{6, 3}}func (x *Algorithm_InnerOuterMask) GetPrefixLen() int32 {@@ -2104,7 +2165,7 @@ type Algorithm_RangeMask_Slice struct {func (x *Algorithm_RangeMask_Slice) Reset() {*x = Algorithm_RangeMask_Slice{}- mi := &file_store_setting_proto_msgTypes[24]+ mi := &file_store_setting_proto_msgTypes[25]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -2116,7 +2177,7 @@ func (x *Algorithm_RangeMask_Slice) String() string {func (*Algorithm_RangeMask_Slice) ProtoMessage() {}func (x *Algorithm_RangeMask_Slice) ProtoReflect() protoreflect.Message {- mi := &file_store_setting_proto_msgTypes[24]+ mi := &file_store_setting_proto_msgTypes[25]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -2129,7 +2190,7 @@ func (x *Algorithm_RangeMask_Slice) ProtoReflect() protoreflect.Message {// Deprecated: Use Algorithm_RangeMask_Slice.ProtoReflect.Descriptor instead.func (*Algorithm_RangeMask_Slice) Descriptor() ([]byte, []int) {- return file_store_setting_proto_rawDescGZIP(), []int{5, 1, 0}+ return file_store_setting_proto_rawDescGZIP(), []int{6, 1, 0}}func (x *Algorithm_RangeMask_Slice) GetStart() int32 {@@ -2170,7 +2231,7 @@ type SemanticTypeSetting_SemanticType struct {func (x *SemanticTypeSetting_SemanticType) Reset() {*x = SemanticTypeSetting_SemanticType{}- mi := &file_store_setting_proto_msgTypes[25]+ mi := &file_store_setting_proto_msgTypes[26]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -2182,7 +2243,7 @@ func (x *SemanticTypeSetting_SemanticType) String() string {func (*SemanticTypeSetting_SemanticType) ProtoMessage() {}func (x *SemanticTypeSetting_SemanticType) ProtoReflect() protoreflect.Message {- mi := &file_store_setting_proto_msgTypes[25]+ mi := &file_store_setting_proto_msgTypes[26]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -2195,7 +2256,7 @@ func (x *SemanticTypeSetting_SemanticType) ProtoReflect() protoreflect.Message {// Deprecated: Use SemanticTypeSetting_SemanticType.ProtoReflect.Descriptor instead.func (*SemanticTypeSetting_SemanticType) Descriptor() ([]byte, []int) {- return file_store_setting_proto_rawDescGZIP(), []int{6, 0}+ return file_store_setting_proto_rawDescGZIP(), []int{7, 0}}func (x *SemanticTypeSetting_SemanticType) GetId() string {@@ -2242,7 +2303,7 @@ type AppIMSetting_Slack struct {func (x *AppIMSetting_Slack) Reset() {*x = AppIMSetting_Slack{}- mi := &file_store_setting_proto_msgTypes[26]+ mi := &file_store_setting_proto_msgTypes[27]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -2254,7 +2315,7 @@ func (x *AppIMSetting_Slack) String() string {func (*AppIMSetting_Slack) ProtoMessage() {}func (x *AppIMSetting_Slack) ProtoReflect() protoreflect.Message {- mi := &file_store_setting_proto_msgTypes[26]+ mi := &file_store_setting_proto_msgTypes[27]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -2267,7 +2328,7 @@ func (x *AppIMSetting_Slack) ProtoReflect() protoreflect.Message {// Deprecated: Use AppIMSetting_Slack.ProtoReflect.Descriptor instead.func (*AppIMSetting_Slack) Descriptor() ([]byte, []int) {- return file_store_setting_proto_rawDescGZIP(), []int{7, 0}+ return file_store_setting_proto_rawDescGZIP(), []int{8, 0}}func (x *AppIMSetting_Slack) GetToken() string {@@ -2287,7 +2348,7 @@ type AppIMSetting_Feishu struct {func (x *AppIMSetting_Feishu) Reset() {*x = AppIMSetting_Feishu{}- mi := &file_store_setting_proto_msgTypes[27]+ mi := &file_store_setting_proto_msgTypes[28]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -2299,7 +2360,7 @@ func (x *AppIMSetting_Feishu) String() string {func (*AppIMSetting_Feishu) ProtoMessage() {}func (x *AppIMSetting_Feishu) ProtoReflect() protoreflect.Message {- mi := &file_store_setting_proto_msgTypes[27]+ mi := &file_store_setting_proto_msgTypes[28]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -2312,7 +2373,7 @@ func (x *AppIMSetting_Feishu) ProtoReflect() protoreflect.Message {// Deprecated: Use AppIMSetting_Feishu.ProtoReflect.Descriptor instead.func (*AppIMSetting_Feishu) Descriptor() ([]byte, []int) {- return file_store_setting_proto_rawDescGZIP(), []int{7, 1}+ return file_store_setting_proto_rawDescGZIP(), []int{8, 1}}func (x *AppIMSetting_Feishu) GetAppId() string {@@ -2340,7 +2401,7 @@ type AppIMSetting_Wecom struct {func (x *AppIMSetting_Wecom) Reset() {*x = AppIMSetting_Wecom{}- mi := &file_store_setting_proto_msgTypes[28]+ mi := &file_store_setting_proto_msgTypes[29]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -2352,7 +2413,7 @@ func (x *AppIMSetting_Wecom) String() string {func (*AppIMSetting_Wecom) ProtoMessage() {}func (x *AppIMSetting_Wecom) ProtoReflect() protoreflect.Message {- mi := &file_store_setting_proto_msgTypes[28]+ mi := &file_store_setting_proto_msgTypes[29]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -2365,7 +2426,7 @@ func (x *AppIMSetting_Wecom) ProtoReflect() protoreflect.Message {// Deprecated: Use AppIMSetting_Wecom.ProtoReflect.Descriptor instead.func (*AppIMSetting_Wecom) Descriptor() ([]byte, []int) {- return file_store_setting_proto_rawDescGZIP(), []int{7, 2}+ return file_store_setting_proto_rawDescGZIP(), []int{8, 2}}func (x *AppIMSetting_Wecom) GetCorpId() string {@@ -2399,7 +2460,7 @@ type AppIMSetting_Lark struct {func (x *AppIMSetting_Lark) Reset() {*x = AppIMSetting_Lark{}- mi := &file_store_setting_proto_msgTypes[29]+ mi := &file_store_setting_proto_msgTypes[30]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -2411,7 +2472,7 @@ func (x *AppIMSetting_Lark) String() string {func (*AppIMSetting_Lark) ProtoMessage() {}func (x *AppIMSetting_Lark) ProtoReflect() protoreflect.Message {- mi := &file_store_setting_proto_msgTypes[29]+ mi := &file_store_setting_proto_msgTypes[30]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -2424,7 +2485,7 @@ func (x *AppIMSetting_Lark) ProtoReflect() protoreflect.Message {// Deprecated: Use AppIMSetting_Lark.ProtoReflect.Descriptor instead.func (*AppIMSetting_Lark) Descriptor() ([]byte, []int) {- return file_store_setting_proto_rawDescGZIP(), []int{7, 3}+ return file_store_setting_proto_rawDescGZIP(), []int{8, 3}}func (x *AppIMSetting_Lark) GetAppId() string {@@ -2452,7 +2513,7 @@ type AppIMSetting_DingTalk struct {func (x *AppIMSetting_DingTalk) Reset() {*x = AppIMSetting_DingTalk{}- mi := &file_store_setting_proto_msgTypes[30]+ mi := &file_store_setting_proto_msgTypes[31]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -2464,7 +2525,7 @@ func (x *AppIMSetting_DingTalk) String() string {func (*AppIMSetting_DingTalk) ProtoMessage() {}func (x *AppIMSetting_DingTalk) ProtoReflect() protoreflect.Message {- mi := &file_store_setting_proto_msgTypes[30]+ mi := &file_store_setting_proto_msgTypes[31]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -2477,7 +2538,7 @@ func (x *AppIMSetting_DingTalk) ProtoReflect() protoreflect.Message {// Deprecated: Use AppIMSetting_DingTalk.ProtoReflect.Descriptor instead.func (*AppIMSetting_DingTalk) Descriptor() ([]byte, []int) {- return file_store_setting_proto_rawDescGZIP(), []int{7, 4}+ return file_store_setting_proto_rawDescGZIP(), []int{8, 4}}func (x *AppIMSetting_DingTalk) GetClientId() string {@@ -2515,7 +2576,7 @@ type AppIMSetting_Teams struct {func (x *AppIMSetting_Teams) Reset() {*x = AppIMSetting_Teams{}- mi := &file_store_setting_proto_msgTypes[31]+ mi := &file_store_setting_proto_msgTypes[32]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -2527,7 +2588,7 @@ func (x *AppIMSetting_Teams) String() string {func (*AppIMSetting_Teams) ProtoMessage() {}func (x *AppIMSetting_Teams) ProtoReflect() protoreflect.Message {- mi := &file_store_setting_proto_msgTypes[31]+ mi := &file_store_setting_proto_msgTypes[32]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -2540,7 +2601,7 @@ func (x *AppIMSetting_Teams) ProtoReflect() protoreflect.Message {// Deprecated: Use AppIMSetting_Teams.ProtoReflect.Descriptor instead.func (*AppIMSetting_Teams) Descriptor() ([]byte, []int) {- return file_store_setting_proto_rawDescGZIP(), []int{7, 5}+ return file_store_setting_proto_rawDescGZIP(), []int{8, 5}}func (x *AppIMSetting_Teams) GetTenantId() string {@@ -2582,7 +2643,7 @@ type AppIMSetting_IMSetting struct {func (x *AppIMSetting_IMSetting) Reset() {*x = AppIMSetting_IMSetting{}- mi := &file_store_setting_proto_msgTypes[32]+ mi := &file_store_setting_proto_msgTypes[33]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -2594,7 +2655,7 @@ func (x *AppIMSetting_IMSetting) String() string {func (*AppIMSetting_IMSetting) ProtoMessage() {}func (x *AppIMSetting_IMSetting) ProtoReflect() protoreflect.Message {- mi := &file_store_setting_proto_msgTypes[32]+ mi := &file_store_setting_proto_msgTypes[33]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -2607,7 +2668,7 @@ func (x *AppIMSetting_IMSetting) ProtoReflect() protoreflect.Message {// Deprecated: Use AppIMSetting_IMSetting.ProtoReflect.Descriptor instead.func (*AppIMSetting_IMSetting) Descriptor() ([]byte, []int) {- return file_store_setting_proto_rawDescGZIP(), []int{7, 6}+ return file_store_setting_proto_rawDescGZIP(), []int{8, 6}}func (x *AppIMSetting_IMSetting) GetType() WebhookType {@@ -2735,7 +2796,7 @@ type EnvironmentSetting_Environment struct {func (x *EnvironmentSetting_Environment) Reset() {*x = EnvironmentSetting_Environment{}- mi := &file_store_setting_proto_msgTypes[33]+ mi := &file_store_setting_proto_msgTypes[34]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -2747,7 +2808,7 @@ func (x *EnvironmentSetting_Environment) String() string {func (*EnvironmentSetting_Environment) ProtoMessage() {}func (x *EnvironmentSetting_Environment) ProtoReflect() protoreflect.Message {- mi := &file_store_setting_proto_msgTypes[33]+ mi := &file_store_setting_proto_msgTypes[34]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -2760,7 +2821,7 @@ func (x *EnvironmentSetting_Environment) ProtoReflect() protoreflect.Message {// Deprecated: Use EnvironmentSetting_Environment.ProtoReflect.Descriptor instead.func (*EnvironmentSetting_Environment) Descriptor() ([]byte, []int) {- return file_store_setting_proto_rawDescGZIP(), []int{9, 0}+ return file_store_setting_proto_rawDescGZIP(), []int{10, 0}}func (x *EnvironmentSetting_Environment) GetName() string {@@ -2812,7 +2873,7 @@ type EmailSetting_SMTPConfig struct {func (x *EmailSetting_SMTPConfig) Reset() {*x = EmailSetting_SMTPConfig{}- mi := &file_store_setting_proto_msgTypes[35]+ mi := &file_store_setting_proto_msgTypes[36]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -2824,7 +2885,7 @@ func (x *EmailSetting_SMTPConfig) String() string {func (*EmailSetting_SMTPConfig) ProtoMessage() {}func (x *EmailSetting_SMTPConfig) ProtoReflect() protoreflect.Message {- mi := &file_store_setting_proto_msgTypes[35]+ mi := &file_store_setting_proto_msgTypes[36]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -2837,7 +2898,7 @@ func (x *EmailSetting_SMTPConfig) ProtoReflect() protoreflect.Message {// Deprecated: Use EmailSetting_SMTPConfig.ProtoReflect.Descriptor instead.func (*EmailSetting_SMTPConfig) Descriptor() ([]byte, []int) {- return file_store_setting_proto_rawDescGZIP(), []int{10, 0}+ return file_store_setting_proto_rawDescGZIP(), []int{11, 0}}func (x *EmailSetting_SMTPConfig) GetHost() string {@@ -2888,7 +2949,7 @@ const file_store_setting_proto_rawDesc = "" +"\n" +"\x13store/setting.proto\x12\x0ebytebase.store\x1a\x1fgoogle/api/field_behavior.proto\x1a\x1egoogle/protobuf/duration.proto\x1a\x17google/type/color.proto\x1a\x16google/type/expr.proto\x1a\x14store/approval.proto\x1a\x12store/common.proto\"P\n" +"\rSystemSetting\x12\x18\n" +- "\alicense\x18\x03 \x01(\tR\alicenseJ\x04\b\x01\x10\x02J\x04\b\x02\x10\x03R\vauth_secretR\fworkspace_id\"\xd3\x13\n" ++ "\alicense\x18\x03 \x01(\tR\alicenseJ\x04\b\x01\x10\x02J\x04\b\x02\x10\x03R\vauth_secretR\fworkspace_id\"\xa7\x12\n" +"\x17WorkspaceProfileSetting\x12!\n" +"\fexternal_url\x18\x01 \x01(\tR\vexternalUrl\x12'\n" +"\x0fdisallow_signup\x18\x02 \x01(\bR\x0edisallowSignup\x12\x1f\n" +@@ -2914,8 +2975,7 @@ const file_store_setting_proto_rawDesc = "" +"\x17allow_email_code_signin\x18\x16 \x01(\bR\x14allowEmailCodeSignin\x12-\n" +"\x13sql_editor_theme_id\x18\x17 \x01(\tR\x10sqlEditorThemeId\x12\\\n" +"\x17sql_editor_custom_theme\x18\x18 \x01(\v2%.bytebase.store.SQLEditorThemeSettingR\x14sqlEditorCustomTheme\x12Q\n" +- "\x17maximum_role_expiration\x18\x19 \x01(\v2\x19.google.protobuf.DurationR\x15maximumRoleExpiration\x12\\\n" +- "\x0emcp_capability\x18\x1a \x01(\x0e25.bytebase.store.WorkspaceProfileSetting.MCPCapabilityR\rmcpCapability\x129\n" ++ "\x17maximum_role_expiration\x18\x19 \x01(\v2\x19.google.protobuf.DurationR\x15maximumRoleExpiration\x129\n" +"\x19directory_sync_token_hash\x18\x1b \x01(\tR\x16directorySyncTokenHash\x1a\x92\x02\n" +"\fAnnouncement\x12\x12\n" +"\x04text\x18\x02 \x01(\tR\x04text\x12\x12\n" +@@ -2939,13 +2999,20 @@ const file_store_setting_proto_rawDesc = "" +" DATABASE_CHANGE_MODE_UNSPECIFIED\x10\x00\x12\f\n" +"\bPIPELINE\x10\x01\x12\n" +"\n" +- "\x06EDITOR\x10\x02\"b\n" +- "\rMCPCapability\x12\x1e\n" +- "\x1aMCP_CAPABILITY_UNSPECIFIED\x10\x00\x12\f\n" ++ "\x06EDITOR\x10\x02J\x04\b\x0f\x10\x10J\x04\b\x1a\x10\x1bJ\x04\b\x10\x10\x11R\x0emcp_capability\"\xec\x01\n" ++ "\n" ++ "MCPSetting\x12E\n" ++ "\n" ++ "capability\x18\x01 \x01(\x0e2%.bytebase.store.MCPSetting.CapabilityR\n" ++ "capability\x12:\n" ++ "\x19ignore_masking_exemptions\x18\x02 \x01(\bR\x17ignoreMaskingExemptions\"[\n" ++ "\n" ++ "Capability\x12\x1a\n" ++ "\x16CAPABILITY_UNSPECIFIED\x10\x00\x12\f\n" +"\bDISABLED\x10\x01\x12\r\n" +"\tREAD_ONLY\x10\x03\x12\x0e\n" +"\n" +- "READ_WRITE\x10\x04\"\x04\b\x02\x10\x02J\x04\b\x0f\x10\x10J\x04\b\x10\x10\x11\"\xf6\x01\n" ++ "READ_WRITE\x10\x04\"\x04\b\x02\x10\x02\"\xf6\x01\n" +"\x15SQLEditorThemeSetting\x12\x0e\n" +"\x02id\x18\x01 \x01(\tR\x02id\x12\x12\n" +"\x04name\x18\x02 \x01(\tR\x04name\x12\x1f\n" +@@ -3112,7 +3179,7 @@ const file_store_setting_proto_rawDesc = "" +"\x04Type\x12\x14\n" +"\x10TYPE_UNSPECIFIED\x10\x00\x12\b\n" +"\x04SMTP\x10\x01B\b\n" +- "\x06config*\xc3\x01\n" ++ "\x06config*\xcc\x01\n" +"\vSettingName\x12\x1c\n" +"\x18SETTING_NAME_UNSPECIFIED\x10\x00\x12\n" +"\n" +@@ -3125,7 +3192,9 @@ const file_store_setting_proto_rawDesc = "" +"\x13DATA_CLASSIFICATION\x10\x06\x12\x12\n" +"\x0eSEMANTIC_TYPES\x10\a\x12\x0f\n" +"\vENVIRONMENT\x10\b\x12\t\n" +- "\x05EMAIL\x10\tB\x8f\x01\n" ++ "\x05EMAIL\x10\t\x12\a\n" ++ "\x03MCP\x10\n" ++ "B\x8f\x01\n" +"\x12com.bytebase.storeB\fSettingProtoP\x01Z\x12generated-go/store\xa2\x02\x03BSX\xaa\x02\x0eBytebase.Store\xca\x02\x0eBytebase\\Store\xe2\x02\x1aBytebase\\Store\\GPBMetadata\xea\x02\x0fBytebase::Storeb\x06proto3"var (@@ -3141,11 +3210,11 @@ func file_store_setting_proto_rawDescGZIP() []byte {}var file_store_setting_proto_enumTypes = make([]protoimpl.EnumInfo, 9)-var file_store_setting_proto_msgTypes = make([]protoimpl.MessageInfo, 36)+var file_store_setting_proto_msgTypes = make([]protoimpl.MessageInfo, 37)var file_store_setting_proto_goTypes = []any{(SettingName)(0), // 0: bytebase.store.SettingName(WorkspaceProfileSetting_DatabaseChangeMode)(0), // 1: bytebase.store.WorkspaceProfileSetting.DatabaseChangeMode- (WorkspaceProfileSetting_MCPCapability)(0), // 2: bytebase.store.WorkspaceProfileSetting.MCPCapability+ (MCPSetting_Capability)(0), // 2: bytebase.store.MCPSetting.Capability(WorkspaceApprovalSetting_Rule_Source)(0), // 3: bytebase.store.WorkspaceApprovalSetting.Rule.Source(Algorithm_InnerOuterMask_MaskType)(0), // 4: bytebase.store.Algorithm.InnerOuterMask.MaskType(AISetting_Provider)(0), // 5: bytebase.store.AISetting.Provider@@ -3154,94 +3223,95 @@ var file_store_setting_proto_goTypes = []any{(EmailSetting_SMTPConfig_Authentication)(0), // 8: bytebase.store.EmailSetting.SMTPConfig.Authentication(*SystemSetting)(nil), // 9: bytebase.store.SystemSetting(*WorkspaceProfileSetting)(nil), // 10: bytebase.store.WorkspaceProfileSetting- (*SQLEditorThemeSetting)(nil), // 11: bytebase.store.SQLEditorThemeSetting- (*WorkspaceApprovalSetting)(nil), // 12: bytebase.store.WorkspaceApprovalSetting- (*DataClassificationSetting)(nil), // 13: bytebase.store.DataClassificationSetting- (*Algorithm)(nil), // 14: bytebase.store.Algorithm- (*SemanticTypeSetting)(nil), // 15: bytebase.store.SemanticTypeSetting- (*AppIMSetting)(nil), // 16: bytebase.store.AppIMSetting- (*AISetting)(nil), // 17: bytebase.store.AISetting- (*EnvironmentSetting)(nil), // 18: bytebase.store.EnvironmentSetting- (*EmailSetting)(nil), // 19: bytebase.store.EmailSetting- (*WorkspaceProfileSetting_Announcement)(nil), // 20: bytebase.store.WorkspaceProfileSetting.Announcement- (*WorkspaceProfileSetting_PasswordRestriction)(nil), // 21: bytebase.store.WorkspaceProfileSetting.PasswordRestriction- (*WorkspaceProfileSetting_Announcement_AnnouncementTheme)(nil), // 22: bytebase.store.WorkspaceProfileSetting.Announcement.AnnouncementTheme- nil, // 23: bytebase.store.SQLEditorThemeSetting.TokensEntry- (*WorkspaceApprovalSetting_Rule)(nil), // 24: bytebase.store.WorkspaceApprovalSetting.Rule- (*DataClassificationSetting_DataClassificationConfig)(nil), // 25: bytebase.store.DataClassificationSetting.DataClassificationConfig- (*DataClassificationSetting_DataClassificationConfig_Level)(nil), // 26: bytebase.store.DataClassificationSetting.DataClassificationConfig.Level- (*DataClassificationSetting_DataClassificationConfig_DataClassification)(nil), // 27: bytebase.store.DataClassificationSetting.DataClassificationConfig.DataClassification- nil, // 28: bytebase.store.DataClassificationSetting.DataClassificationConfig.ClassificationEntry- (*Algorithm_FullMask)(nil), // 29: bytebase.store.Algorithm.FullMask- (*Algorithm_RangeMask)(nil), // 30: bytebase.store.Algorithm.RangeMask- (*Algorithm_MD5Mask)(nil), // 31: bytebase.store.Algorithm.MD5Mask- (*Algorithm_InnerOuterMask)(nil), // 32: bytebase.store.Algorithm.InnerOuterMask- (*Algorithm_RangeMask_Slice)(nil), // 33: bytebase.store.Algorithm.RangeMask.Slice- (*SemanticTypeSetting_SemanticType)(nil), // 34: bytebase.store.SemanticTypeSetting.SemanticType- (*AppIMSetting_Slack)(nil), // 35: bytebase.store.AppIMSetting.Slack- (*AppIMSetting_Feishu)(nil), // 36: bytebase.store.AppIMSetting.Feishu- (*AppIMSetting_Wecom)(nil), // 37: bytebase.store.AppIMSetting.Wecom- (*AppIMSetting_Lark)(nil), // 38: bytebase.store.AppIMSetting.Lark- (*AppIMSetting_DingTalk)(nil), // 39: bytebase.store.AppIMSetting.DingTalk- (*AppIMSetting_Teams)(nil), // 40: bytebase.store.AppIMSetting.Teams- (*AppIMSetting_IMSetting)(nil), // 41: bytebase.store.AppIMSetting.IMSetting- (*EnvironmentSetting_Environment)(nil), // 42: bytebase.store.EnvironmentSetting.Environment- nil, // 43: bytebase.store.EnvironmentSetting.Environment.TagsEntry- (*EmailSetting_SMTPConfig)(nil), // 44: bytebase.store.EmailSetting.SMTPConfig- (*durationpb.Duration)(nil), // 45: google.protobuf.Duration- (*color.Color)(nil), // 46: google.type.Color- (*ApprovalTemplate)(nil), // 47: bytebase.store.ApprovalTemplate- (*expr.Expr)(nil), // 48: google.type.Expr- (WebhookType)(0), // 49: bytebase.store.WebhookType+ (*MCPSetting)(nil), // 11: bytebase.store.MCPSetting+ (*SQLEditorThemeSetting)(nil), // 12: bytebase.store.SQLEditorThemeSetting+ (*WorkspaceApprovalSetting)(nil), // 13: bytebase.store.WorkspaceApprovalSetting+ (*DataClassificationSetting)(nil), // 14: bytebase.store.DataClassificationSetting+ (*Algorithm)(nil), // 15: bytebase.store.Algorithm+ (*SemanticTypeSetting)(nil), // 16: bytebase.store.SemanticTypeSetting+ (*AppIMSetting)(nil), // 17: bytebase.store.AppIMSetting+ (*AISetting)(nil), // 18: bytebase.store.AISetting+ (*EnvironmentSetting)(nil), // 19: bytebase.store.EnvironmentSetting+ (*EmailSetting)(nil), // 20: bytebase.store.EmailSetting+ (*WorkspaceProfileSetting_Announcement)(nil), // 21: bytebase.store.WorkspaceProfileSetting.Announcement+ (*WorkspaceProfileSetting_PasswordRestriction)(nil), // 22: bytebase.store.WorkspaceProfileSetting.PasswordRestriction+ (*WorkspaceProfileSetting_Announcement_AnnouncementTheme)(nil), // 23: bytebase.store.WorkspaceProfileSetting.Announcement.AnnouncementTheme+ nil, // 24: bytebase.store.SQLEditorThemeSetting.TokensEntry+ (*WorkspaceApprovalSetting_Rule)(nil), // 25: bytebase.store.WorkspaceApprovalSetting.Rule+ (*DataClassificationSetting_DataClassificationConfig)(nil), // 26: bytebase.store.DataClassificationSetting.DataClassificationConfig+ (*DataClassificationSetting_DataClassificationConfig_Level)(nil), // 27: bytebase.store.DataClassificationSetting.DataClassificationConfig.Level+ (*DataClassificationSetting_DataClassificationConfig_DataClassification)(nil), // 28: bytebase.store.DataClassificationSetting.DataClassificationConfig.DataClassification+ nil, // 29: bytebase.store.DataClassificationSetting.DataClassificationConfig.ClassificationEntry+ (*Algorithm_FullMask)(nil), // 30: bytebase.store.Algorithm.FullMask+ (*Algorithm_RangeMask)(nil), // 31: bytebase.store.Algorithm.RangeMask+ (*Algorithm_MD5Mask)(nil), // 32: bytebase.store.Algorithm.MD5Mask+ (*Algorithm_InnerOuterMask)(nil), // 33: bytebase.store.Algorithm.InnerOuterMask+ (*Algorithm_RangeMask_Slice)(nil), // 34: bytebase.store.Algorithm.RangeMask.Slice+ (*SemanticTypeSetting_SemanticType)(nil), // 35: bytebase.store.SemanticTypeSetting.SemanticType+ (*AppIMSetting_Slack)(nil), // 36: bytebase.store.AppIMSetting.Slack+ (*AppIMSetting_Feishu)(nil), // 37: bytebase.store.AppIMSetting.Feishu+ (*AppIMSetting_Wecom)(nil), // 38: bytebase.store.AppIMSetting.Wecom+ (*AppIMSetting_Lark)(nil), // 39: bytebase.store.AppIMSetting.Lark+ (*AppIMSetting_DingTalk)(nil), // 40: bytebase.store.AppIMSetting.DingTalk+ (*AppIMSetting_Teams)(nil), // 41: bytebase.store.AppIMSetting.Teams+ (*AppIMSetting_IMSetting)(nil), // 42: bytebase.store.AppIMSetting.IMSetting+ (*EnvironmentSetting_Environment)(nil), // 43: bytebase.store.EnvironmentSetting.Environment+ nil, // 44: bytebase.store.EnvironmentSetting.Environment.TagsEntry+ (*EmailSetting_SMTPConfig)(nil), // 45: bytebase.store.EmailSetting.SMTPConfig+ (*durationpb.Duration)(nil), // 46: google.protobuf.Duration+ (*color.Color)(nil), // 47: google.type.Color+ (*ApprovalTemplate)(nil), // 48: bytebase.store.ApprovalTemplate+ (*expr.Expr)(nil), // 49: google.type.Expr+ (WebhookType)(0), // 50: bytebase.store.WebhookType}var file_store_setting_proto_depIdxs = []int32{- 45, // 0: bytebase.store.WorkspaceProfileSetting.refresh_token_duration:type_name -> google.protobuf.Duration- 20, // 1: bytebase.store.WorkspaceProfileSetting.announcement:type_name -> bytebase.store.WorkspaceProfileSetting.Announcement- 45, // 2: bytebase.store.WorkspaceProfileSetting.maximum_request_expiration:type_name -> google.protobuf.Duration+ 46, // 0: bytebase.store.WorkspaceProfileSetting.refresh_token_duration:type_name -> google.protobuf.Duration+ 21, // 1: bytebase.store.WorkspaceProfileSetting.announcement:type_name -> bytebase.store.WorkspaceProfileSetting.Announcement+ 46, // 2: bytebase.store.WorkspaceProfileSetting.maximum_request_expiration:type_name -> google.protobuf.Duration1, // 3: bytebase.store.WorkspaceProfileSetting.database_change_mode:type_name -> bytebase.store.WorkspaceProfileSetting.DatabaseChangeMode- 45, // 4: bytebase.store.WorkspaceProfileSetting.inactive_session_timeout:type_name -> google.protobuf.Duration- 21, // 5: bytebase.store.WorkspaceProfileSetting.password_restriction:type_name -> bytebase.store.WorkspaceProfileSetting.PasswordRestriction- 45, // 6: bytebase.store.WorkspaceProfileSetting.access_token_duration:type_name -> google.protobuf.Duration- 45, // 7: bytebase.store.WorkspaceProfileSetting.query_timeout:type_name -> google.protobuf.Duration- 11, // 8: bytebase.store.WorkspaceProfileSetting.sql_editor_custom_theme:type_name -> bytebase.store.SQLEditorThemeSetting- 45, // 9: bytebase.store.WorkspaceProfileSetting.maximum_role_expiration:type_name -> google.protobuf.Duration- 2, // 10: bytebase.store.WorkspaceProfileSetting.mcp_capability:type_name -> bytebase.store.WorkspaceProfileSetting.MCPCapability- 23, // 11: bytebase.store.SQLEditorThemeSetting.tokens:type_name -> bytebase.store.SQLEditorThemeSetting.TokensEntry- 24, // 12: bytebase.store.WorkspaceApprovalSetting.rules:type_name -> bytebase.store.WorkspaceApprovalSetting.Rule- 25, // 13: bytebase.store.DataClassificationSetting.configs:type_name -> bytebase.store.DataClassificationSetting.DataClassificationConfig- 29, // 14: bytebase.store.Algorithm.full_mask:type_name -> bytebase.store.Algorithm.FullMask- 30, // 15: bytebase.store.Algorithm.range_mask:type_name -> bytebase.store.Algorithm.RangeMask- 31, // 16: bytebase.store.Algorithm.md5_mask:type_name -> bytebase.store.Algorithm.MD5Mask- 32, // 17: bytebase.store.Algorithm.inner_outer_mask:type_name -> bytebase.store.Algorithm.InnerOuterMask- 34, // 18: bytebase.store.SemanticTypeSetting.types:type_name -> bytebase.store.SemanticTypeSetting.SemanticType- 41, // 19: bytebase.store.AppIMSetting.settings:type_name -> bytebase.store.AppIMSetting.IMSetting+ 46, // 4: bytebase.store.WorkspaceProfileSetting.inactive_session_timeout:type_name -> google.protobuf.Duration+ 22, // 5: bytebase.store.WorkspaceProfileSetting.password_restriction:type_name -> bytebase.store.WorkspaceProfileSetting.PasswordRestriction+ 46, // 6: bytebase.store.WorkspaceProfileSetting.access_token_duration:type_name -> google.protobuf.Duration+ 46, // 7: bytebase.store.WorkspaceProfileSetting.query_timeout:type_name -> google.protobuf.Duration+ 12, // 8: bytebase.store.WorkspaceProfileSetting.sql_editor_custom_theme:type_name -> bytebase.store.SQLEditorThemeSetting+ 46, // 9: bytebase.store.WorkspaceProfileSetting.maximum_role_expiration:type_name -> google.protobuf.Duration+ 2, // 10: bytebase.store.MCPSetting.capability:type_name -> bytebase.store.MCPSetting.Capability+ 24, // 11: bytebase.store.SQLEditorThemeSetting.tokens:type_name -> bytebase.store.SQLEditorThemeSetting.TokensEntry+ 25, // 12: bytebase.store.WorkspaceApprovalSetting.rules:type_name -> bytebase.store.WorkspaceApprovalSetting.Rule+ 26, // 13: bytebase.store.DataClassificationSetting.configs:type_name -> bytebase.store.DataClassificationSetting.DataClassificationConfig+ 30, // 14: bytebase.store.Algorithm.full_mask:type_name -> bytebase.store.Algorithm.FullMask+ 31, // 15: bytebase.store.Algorithm.range_mask:type_name -> bytebase.store.Algorithm.RangeMask+ 32, // 16: bytebase.store.Algorithm.md5_mask:type_name -> bytebase.store.Algorithm.MD5Mask+ 33, // 17: bytebase.store.Algorithm.inner_outer_mask:type_name -> bytebase.store.Algorithm.InnerOuterMask+ 35, // 18: bytebase.store.SemanticTypeSetting.types:type_name -> bytebase.store.SemanticTypeSetting.SemanticType+ 42, // 19: bytebase.store.AppIMSetting.settings:type_name -> bytebase.store.AppIMSetting.IMSetting5, // 20: bytebase.store.AISetting.provider:type_name -> bytebase.store.AISetting.Provider- 42, // 21: bytebase.store.EnvironmentSetting.environments:type_name -> bytebase.store.EnvironmentSetting.Environment+ 43, // 21: bytebase.store.EnvironmentSetting.environments:type_name -> bytebase.store.EnvironmentSetting.Environment6, // 22: bytebase.store.EmailSetting.type:type_name -> bytebase.store.EmailSetting.Type- 44, // 23: bytebase.store.EmailSetting.smtp:type_name -> bytebase.store.EmailSetting.SMTPConfig- 22, // 24: bytebase.store.WorkspaceProfileSetting.Announcement.theme:type_name -> bytebase.store.WorkspaceProfileSetting.Announcement.AnnouncementTheme- 45, // 25: bytebase.store.WorkspaceProfileSetting.PasswordRestriction.password_rotation:type_name -> google.protobuf.Duration- 46, // 26: bytebase.store.WorkspaceProfileSetting.Announcement.AnnouncementTheme.background:type_name -> google.type.Color- 46, // 27: bytebase.store.WorkspaceProfileSetting.Announcement.AnnouncementTheme.text:type_name -> google.type.Color- 46, // 28: bytebase.store.SQLEditorThemeSetting.TokensEntry.value:type_name -> google.type.Color- 47, // 29: bytebase.store.WorkspaceApprovalSetting.Rule.template:type_name -> bytebase.store.ApprovalTemplate- 48, // 30: bytebase.store.WorkspaceApprovalSetting.Rule.condition:type_name -> google.type.Expr+ 45, // 23: bytebase.store.EmailSetting.smtp:type_name -> bytebase.store.EmailSetting.SMTPConfig+ 23, // 24: bytebase.store.WorkspaceProfileSetting.Announcement.theme:type_name -> bytebase.store.WorkspaceProfileSetting.Announcement.AnnouncementTheme+ 46, // 25: bytebase.store.WorkspaceProfileSetting.PasswordRestriction.password_rotation:type_name -> google.protobuf.Duration+ 47, // 26: bytebase.store.WorkspaceProfileSetting.Announcement.AnnouncementTheme.background:type_name -> google.type.Color+ 47, // 27: bytebase.store.WorkspaceProfileSetting.Announcement.AnnouncementTheme.text:type_name -> google.type.Color+ 47, // 28: bytebase.store.SQLEditorThemeSetting.TokensEntry.value:type_name -> google.type.Color+ 48, // 29: bytebase.store.WorkspaceApprovalSetting.Rule.template:type_name -> bytebase.store.ApprovalTemplate+ 49, // 30: bytebase.store.WorkspaceApprovalSetting.Rule.condition:type_name -> google.type.Expr3, // 31: bytebase.store.WorkspaceApprovalSetting.Rule.source:type_name -> bytebase.store.WorkspaceApprovalSetting.Rule.Source- 26, // 32: bytebase.store.DataClassificationSetting.DataClassificationConfig.levels:type_name -> bytebase.store.DataClassificationSetting.DataClassificationConfig.Level- 28, // 33: bytebase.store.DataClassificationSetting.DataClassificationConfig.classification:type_name -> bytebase.store.DataClassificationSetting.DataClassificationConfig.ClassificationEntry- 27, // 34: bytebase.store.DataClassificationSetting.DataClassificationConfig.ClassificationEntry.value:type_name -> bytebase.store.DataClassificationSetting.DataClassificationConfig.DataClassification- 33, // 35: bytebase.store.Algorithm.RangeMask.slices:type_name -> bytebase.store.Algorithm.RangeMask.Slice+ 27, // 32: bytebase.store.DataClassificationSetting.DataClassificationConfig.levels:type_name -> bytebase.store.DataClassificationSetting.DataClassificationConfig.Level+ 29, // 33: bytebase.store.DataClassificationSetting.DataClassificationConfig.classification:type_name -> bytebase.store.DataClassificationSetting.DataClassificationConfig.ClassificationEntry+ 28, // 34: bytebase.store.DataClassificationSetting.DataClassificationConfig.ClassificationEntry.value:type_name -> bytebase.store.DataClassificationSetting.DataClassificationConfig.DataClassification+ 34, // 35: bytebase.store.Algorithm.RangeMask.slices:type_name -> bytebase.store.Algorithm.RangeMask.Slice4, // 36: bytebase.store.Algorithm.InnerOuterMask.type:type_name -> bytebase.store.Algorithm.InnerOuterMask.MaskType- 14, // 37: bytebase.store.SemanticTypeSetting.SemanticType.algorithm:type_name -> bytebase.store.Algorithm- 49, // 38: bytebase.store.AppIMSetting.IMSetting.type:type_name -> bytebase.store.WebhookType- 35, // 39: bytebase.store.AppIMSetting.IMSetting.slack:type_name -> bytebase.store.AppIMSetting.Slack- 36, // 40: bytebase.store.AppIMSetting.IMSetting.feishu:type_name -> bytebase.store.AppIMSetting.Feishu- 37, // 41: bytebase.store.AppIMSetting.IMSetting.wecom:type_name -> bytebase.store.AppIMSetting.Wecom- 38, // 42: bytebase.store.AppIMSetting.IMSetting.lark:type_name -> bytebase.store.AppIMSetting.Lark- 39, // 43: bytebase.store.AppIMSetting.IMSetting.dingtalk:type_name -> bytebase.store.AppIMSetting.DingTalk- 40, // 44: bytebase.store.AppIMSetting.IMSetting.teams:type_name -> bytebase.store.AppIMSetting.Teams- 43, // 45: bytebase.store.EnvironmentSetting.Environment.tags:type_name -> bytebase.store.EnvironmentSetting.Environment.TagsEntry- 46, // 46: bytebase.store.EnvironmentSetting.Environment.color:type_name -> google.type.Color+ 15, // 37: bytebase.store.SemanticTypeSetting.SemanticType.algorithm:type_name -> bytebase.store.Algorithm+ 50, // 38: bytebase.store.AppIMSetting.IMSetting.type:type_name -> bytebase.store.WebhookType+ 36, // 39: bytebase.store.AppIMSetting.IMSetting.slack:type_name -> bytebase.store.AppIMSetting.Slack+ 37, // 40: bytebase.store.AppIMSetting.IMSetting.feishu:type_name -> bytebase.store.AppIMSetting.Feishu+ 38, // 41: bytebase.store.AppIMSetting.IMSetting.wecom:type_name -> bytebase.store.AppIMSetting.Wecom+ 39, // 42: bytebase.store.AppIMSetting.IMSetting.lark:type_name -> bytebase.store.AppIMSetting.Lark+ 40, // 43: bytebase.store.AppIMSetting.IMSetting.dingtalk:type_name -> bytebase.store.AppIMSetting.DingTalk+ 41, // 44: bytebase.store.AppIMSetting.IMSetting.teams:type_name -> bytebase.store.AppIMSetting.Teams+ 44, // 45: bytebase.store.EnvironmentSetting.Environment.tags:type_name -> bytebase.store.EnvironmentSetting.Environment.TagsEntry+ 47, // 46: bytebase.store.EnvironmentSetting.Environment.color:type_name -> google.type.Color7, // 47: bytebase.store.EmailSetting.SMTPConfig.encryption:type_name -> bytebase.store.EmailSetting.SMTPConfig.Encryption8, // 48: bytebase.store.EmailSetting.SMTPConfig.authentication:type_name -> bytebase.store.EmailSetting.SMTPConfig.Authentication49, // [49:49] is the sub-list for method output_type@@ -3258,17 +3328,17 @@ func file_store_setting_proto_init() {}file_store_approval_proto_init()file_store_common_proto_init()- file_store_setting_proto_msgTypes[5].OneofWrappers = []any{+ file_store_setting_proto_msgTypes[6].OneofWrappers = []any{(*Algorithm_FullMask_)(nil),(*Algorithm_RangeMask_)(nil),(*Algorithm_Md5Mask)(nil),(*Algorithm_InnerOuterMask_)(nil),}- file_store_setting_proto_msgTypes[10].OneofWrappers = []any{+ file_store_setting_proto_msgTypes[11].OneofWrappers = []any{(*EmailSetting_Smtp)(nil),}- file_store_setting_proto_msgTypes[18].OneofWrappers = []any{}- file_store_setting_proto_msgTypes[32].OneofWrappers = []any{+ file_store_setting_proto_msgTypes[19].OneofWrappers = []any{}+ file_store_setting_proto_msgTypes[33].OneofWrappers = []any{(*AppIMSetting_IMSetting_Slack)(nil),(*AppIMSetting_IMSetting_Feishu)(nil),(*AppIMSetting_IMSetting_Wecom)(nil),@@ -3282,7 +3352,7 @@ func file_store_setting_proto_init() {GoPackagePath: reflect.TypeOf(x{}).PkgPath(),RawDescriptor: unsafe.Slice(unsafe.StringData(file_store_setting_proto_rawDesc), len(file_store_setting_proto_rawDesc)),NumEnums: 9,- NumMessages: 36,+ NumMessages: 37,NumExtensions: 0,NumServices: 0,},diff --git a/backend/generated-go/store/setting_equal.pb.go b/backend/generated-go/store/setting_equal.pb.goindex db2702da27..3dfbcdce12 100644--- a/backend/generated-go/store/setting_equal.pb.go+++ b/backend/generated-go/store/setting_equal.pb.go@@ -173,10 +173,23 @@ func (x *WorkspaceProfileSetting) Equal(y *WorkspaceProfileSetting) bool {if p, q := x.MaximumRoleExpiration, y.MaximumRoleExpiration; (p == nil && q != nil) || (p != nil && (q == nil || p.Seconds != q.Seconds || p.Nanos != q.Nanos)) {return false}- if x.McpCapability != y.McpCapability {+ if x.DirectorySyncTokenHash != y.DirectorySyncTokenHash {return false}- if x.DirectorySyncTokenHash != y.DirectorySyncTokenHash {+ return true+}++func (x *MCPSetting) Equal(y *MCPSetting) bool {+ if x == y {+ return true+ }+ if x == nil || y == nil {+ return x == nil && y == nil+ }+ if x.Capability != y.Capability {+ return false+ }+ if x.IgnoreMaskingExemptions != y.IgnoreMaskingExemptions {return false}return truediff --git a/backend/generated-go/v1/setting_service.pb.go b/backend/generated-go/v1/setting_service.pb.goindex d461429bcd..2e50b23acc 100644--- a/backend/generated-go/v1/setting_service.pb.go+++ b/backend/generated-go/v1/setting_service.pb.go@@ -90,6 +90,7 @@ const (Setting_SEMANTIC_TYPES Setting_SettingName = 6Setting_ENVIRONMENT Setting_SettingName = 7Setting_EMAIL Setting_SettingName = 8+ Setting_MCP Setting_SettingName = 9)// Enum value maps for Setting_SettingName.@@ -104,6 +105,7 @@ var (6: "SEMANTIC_TYPES",7: "ENVIRONMENT",8: "EMAIL",+ 9: "MCP",}Setting_SettingName_value = map[string]int32{"SETTING_NAME_UNSPECIFIED": 0,@@ -115,6 +117,7 @@ var ("SEMANTIC_TYPES": 6,"ENVIRONMENT": 7,"EMAIL": 8,+ "MCP": 9,})@@ -145,67 +148,67 @@ func (Setting_SettingName) EnumDescriptor() ([]byte, []int) {return file_v1_setting_service_proto_rawDescGZIP(), []int{5, 0}}-// MCPCapability is the maximum capability an MCP (Model Context Protocol)-// session may have in the workspace. It is a ceiling: a session runs at this-// level or lower. Unset (UNSPECIFIED) is treated as READ_WRITE so existing-// workspaces are unaffected.-type WorkspaceProfileSetting_MCPCapability int32+// Capability is the ceiling: a session runs at this level or lower. An absent+// MCP setting resolves to READ_WRITE, so a workspace that never configured+// MCP is unaffected. Writing CAPABILITY_UNSPECIFIED explicitly is rejected —+// omit the update mask path to leave the ceiling unset.+type MCPSetting_Capability int32const (- WorkspaceProfileSetting_MCP_CAPABILITY_UNSPECIFIED WorkspaceProfileSetting_MCPCapability = 0+ MCPSetting_CAPABILITY_UNSPECIFIED MCPSetting_Capability = 0// MCP connections are rejected.- WorkspaceProfileSetting_DISABLED WorkspaceProfileSetting_MCPCapability = 1+ MCPSetting_DISABLED MCPSetting_Capability = 1// MCP may inspect metadata and run read-only queries. A session opens, and// what it may do is decided per method by the capability gate and per// statement by the SQL clamp: a request holding a statement that is not a// read is refused whole, and where the engine's driver has one the// database session is opened read-only as well.- WorkspaceProfileSetting_READ_ONLY WorkspaceProfileSetting_MCPCapability = 3+ MCPSetting_READ_ONLY MCPSetting_Capability = 3// MCP may perform mutations, still bounded by the user's RBAC.- WorkspaceProfileSetting_READ_WRITE WorkspaceProfileSetting_MCPCapability = 4+ MCPSetting_READ_WRITE MCPSetting_Capability = 4)-// Enum value maps for WorkspaceProfileSetting_MCPCapability.+// Enum value maps for MCPSetting_Capability.var (- WorkspaceProfileSetting_MCPCapability_name = map[int32]string{- 0: "MCP_CAPABILITY_UNSPECIFIED",+ MCPSetting_Capability_name = map[int32]string{+ 0: "CAPABILITY_UNSPECIFIED",1: "DISABLED",3: "READ_ONLY",4: "READ_WRITE",}- WorkspaceProfileSetting_MCPCapability_value = map[string]int32{- "MCP_CAPABILITY_UNSPECIFIED": 0,- "DISABLED": 1,- "READ_ONLY": 3,- "READ_WRITE": 4,+ MCPSetting_Capability_value = map[string]int32{+ "CAPABILITY_UNSPECIFIED": 0,+ "DISABLED": 1,+ "READ_ONLY": 3,+ "READ_WRITE": 4,})-func (x WorkspaceProfileSetting_MCPCapability) Enum() *WorkspaceProfileSetting_MCPCapability {- p := new(WorkspaceProfileSetting_MCPCapability)+func (x MCPSetting_Capability) Enum() *MCPSetting_Capability {+ p := new(MCPSetting_Capability)*p = xreturn p}-func (x WorkspaceProfileSetting_MCPCapability) String() string {+func (x MCPSetting_Capability) String() string {return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))}-func (WorkspaceProfileSetting_MCPCapability) Descriptor() protoreflect.EnumDescriptor {+func (MCPSetting_Capability) Descriptor() protoreflect.EnumDescriptor {return file_v1_setting_service_proto_enumTypes[2].Descriptor()}-func (WorkspaceProfileSetting_MCPCapability) Type() protoreflect.EnumType {+func (MCPSetting_Capability) Type() protoreflect.EnumType {return &file_v1_setting_service_proto_enumTypes[2]}-func (x WorkspaceProfileSetting_MCPCapability) Number() protoreflect.EnumNumber {+func (x MCPSetting_Capability) Number() protoreflect.EnumNumber {return protoreflect.EnumNumber(x)}-// Deprecated: Use WorkspaceProfileSetting_MCPCapability.Descriptor instead.-func (WorkspaceProfileSetting_MCPCapability) EnumDescriptor() ([]byte, []int) {- return file_v1_setting_service_proto_rawDescGZIP(), []int{8, 0}+// Deprecated: Use MCPSetting_Capability.Descriptor instead.+func (MCPSetting_Capability) EnumDescriptor() ([]byte, []int) {+ return file_v1_setting_service_proto_rawDescGZIP(), []int{9, 0}}type WorkspaceApprovalSetting_Rule_Source int32@@ -260,7 +263,7 @@ func (x WorkspaceApprovalSetting_Rule_Source) Number() protoreflect.EnumNumber {// Deprecated: Use WorkspaceApprovalSetting_Rule_Source.Descriptor instead.func (WorkspaceApprovalSetting_Rule_Source) EnumDescriptor() ([]byte, []int) {- return file_v1_setting_service_proto_rawDescGZIP(), []int{11, 0, 0}+ return file_v1_setting_service_proto_rawDescGZIP(), []int{12, 0, 0}}type Algorithm_InnerOuterMask_MaskType int32@@ -309,7 +312,7 @@ func (x Algorithm_InnerOuterMask_MaskType) Number() protoreflect.EnumNumber {// Deprecated: Use Algorithm_InnerOuterMask_MaskType.Descriptor instead.func (Algorithm_InnerOuterMask_MaskType) EnumDescriptor() ([]byte, []int) {- return file_v1_setting_service_proto_rawDescGZIP(), []int{14, 3, 0}+ return file_v1_setting_service_proto_rawDescGZIP(), []int{15, 3, 0}}type AISetting_Provider int32@@ -364,7 +367,7 @@ func (x AISetting_Provider) Number() protoreflect.EnumNumber {// Deprecated: Use AISetting_Provider.Descriptor instead.func (AISetting_Provider) EnumDescriptor() ([]byte, []int) {- return file_v1_setting_service_proto_rawDescGZIP(), []int{15, 0}+ return file_v1_setting_service_proto_rawDescGZIP(), []int{16, 0}}type EmailSetting_Type int32@@ -410,7 +413,7 @@ func (x EmailSetting_Type) Number() protoreflect.EnumNumber {// Deprecated: Use EmailSetting_Type.Descriptor instead.func (EmailSetting_Type) EnumDescriptor() ([]byte, []int) {- return file_v1_setting_service_proto_rawDescGZIP(), []int{17, 0}+ return file_v1_setting_service_proto_rawDescGZIP(), []int{18, 0}}type EmailSetting_SMTPConfig_Encryption int32@@ -462,7 +465,7 @@ func (x EmailSetting_SMTPConfig_Encryption) Number() protoreflect.EnumNumber {// Deprecated: Use EmailSetting_SMTPConfig_Encryption.Descriptor instead.func (EmailSetting_SMTPConfig_Encryption) EnumDescriptor() ([]byte, []int) {- return file_v1_setting_service_proto_rawDescGZIP(), []int{17, 0, 0}+ return file_v1_setting_service_proto_rawDescGZIP(), []int{18, 0, 0}}type EmailSetting_SMTPConfig_Authentication int32@@ -517,7 +520,7 @@ func (x EmailSetting_SMTPConfig_Authentication) Number() protoreflect.EnumNumber// Deprecated: Use EmailSetting_SMTPConfig_Authentication.Descriptor instead.func (EmailSetting_SMTPConfig_Authentication) EnumDescriptor() ([]byte, []int) {- return file_v1_setting_service_proto_rawDescGZIP(), []int{17, 0, 1}+ return file_v1_setting_service_proto_rawDescGZIP(), []int{18, 0, 1}}type ListSettingsRequest struct {@@ -834,6 +837,7 @@ type SettingValue struct {// *SettingValue_Ai// *SettingValue_Environment// *SettingValue_Email+ // *SettingValue_McpValue isSettingValue_Value `protobuf_oneof:"value"`unknownFields protoimpl.UnknownFieldssizeCache protoimpl.SizeCache@@ -948,6 +952,15 @@ func (x *SettingValue) GetEmail() *EmailSetting {return nil}+func (x *SettingValue) GetMcp() *MCPSetting {+ if x != nil {+ if x, ok := x.Value.(*SettingValue_Mcp); ok {+ return x.Mcp+ }+ }+ return nil+}+type isSettingValue_Value interface {isSettingValue_Value()}@@ -984,6 +997,10 @@ type SettingValue_Email struct {Email *EmailSetting `protobuf:"bytes,8,opt,name=email,proto3,oneof"`}+type SettingValue_Mcp struct {+ Mcp *MCPSetting `protobuf:"bytes,9,opt,name=mcp,proto3,oneof"`+}+func (*SettingValue_AppIm) isSettingValue_Value() {}func (*SettingValue_WorkspaceProfile) isSettingValue_Value() {}@@ -1000,6 +1017,8 @@ func (*SettingValue_Environment) isSettingValue_Value() {}func (*SettingValue_Email) isSettingValue_Value() {}+func (*SettingValue_Mcp) isSettingValue_Value() {}+type AppIMSetting struct {state protoimpl.MessageState `protogen:"open.v1"`Settings []*AppIMSetting_IMSetting `protobuf:"bytes,1,rep,name=settings,proto3" json:"settings,omitempty"`@@ -1099,12 +1118,6 @@ type WorkspaceProfileSetting struct {// The max expiration duration for request role.// Deprecated: use just-in-time access request flows instead.MaximumRoleExpiration *durationpb.Duration `protobuf:"bytes,25,opt,name=maximum_role_expiration,json=maximumRoleExpiration,proto3" json:"maximum_role_expiration,omitempty"`- // The maximum capability available to MCP (Model Context Protocol) sessions in- // this workspace, acting as an admin-set ceiling. Unset is treated as- // READ_WRITE for backward compatibility; DISABLED rejects all MCP- // connections. Writing MCP_CAPABILITY_UNSPECIFIED explicitly is rejected —- // omit the update mask path to leave the ceiling unset.- McpCapability WorkspaceProfileSetting_MCPCapability `protobuf:"varint,26,opt,name=mcp_capability,json=mcpCapability,proto3,enum=bytebase.v1.WorkspaceProfileSetting_MCPCapability" json:"mcp_capability,omitempty"`// Whether a directory sync token has been generated for this workspace.// The token itself is never returned; this only lets the UI decide between// offering "generate" and "regenerate".@@ -1304,16 +1317,79 @@ func (x *WorkspaceProfileSetting) GetMaximumRoleExpiration() *durationpb.Duratioreturn nil}-func (x *WorkspaceProfileSetting) GetMcpCapability() WorkspaceProfileSetting_MCPCapability {+func (x *WorkspaceProfileSetting) GetDirectorySyncTokenConfigured() bool {if x != nil {- return x.McpCapability+ return x.DirectorySyncTokenConfigured}- return WorkspaceProfileSetting_MCP_CAPABILITY_UNSPECIFIED+ return false}-func (x *WorkspaceProfileSetting) GetDirectorySyncTokenConfigured() bool {+// MCPSetting is what an MCP (Model Context Protocol) session may do in this+// workspace.+type MCPSetting struct {+ state protoimpl.MessageState `protogen:"open.v1"`+ // The maximum capability available to MCP sessions in this workspace, acting+ // as an admin-set ceiling. Enforced server-side at three points: the /mcp+ // endpoint decides whether a connection is admitted at all, the ceiling gate+ // on the internal MCP chain decides, per request, which method classes are+ // served, and under READ_ONLY the SQL clamp decides, per statement, whether+ // it only reads.+ Capability MCPSetting_Capability `protobuf:"varint,1,opt,name=capability,proto3,enum=bytebase.v1.MCPSetting_Capability" json:"capability,omitempty"`+ // Whether a request that arrived over MCP stops applying the caller's own+ // unmasking provisioning. Two mechanisms let a user see a real value and this+ // suppresses both: the masking exemptions granted to them, and the unmask+ // carried by an access grant. The same user in the console is untouched.+ //+ // It cannot force masking where there is none. Masking substitutes values in+ // query results, so this does not reach data copied into a column carrying no+ // masking policy, and it does nothing on the engines Bytebase does not mask.+ // It narrows what an agent reads through the paths Bytebase masks; it is not+ // a confidentiality boundary.+ IgnoreMaskingExemptions bool `protobuf:"varint,2,opt,name=ignore_masking_exemptions,json=ignoreMaskingExemptions,proto3" json:"ignore_masking_exemptions,omitempty"`+ unknownFields protoimpl.UnknownFields+ sizeCache protoimpl.SizeCache+}++func (x *MCPSetting) Reset() {+ *x = MCPSetting{}+ mi := &file_v1_setting_service_proto_msgTypes[9]+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ ms.StoreMessageInfo(mi)+}++func (x *MCPSetting) String() string {+ return protoimpl.X.MessageStringOf(x)+}++func (*MCPSetting) ProtoMessage() {}++func (x *MCPSetting) ProtoReflect() protoreflect.Message {+ mi := &file_v1_setting_service_proto_msgTypes[9]if x != nil {- return x.DirectorySyncTokenConfigured+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ if ms.LoadMessageInfo() == nil {+ ms.StoreMessageInfo(mi)+ }+ return ms+ }+ return mi.MessageOf(x)+}++// Deprecated: Use MCPSetting.ProtoReflect.Descriptor instead.+func (*MCPSetting) Descriptor() ([]byte, []int) {+ return file_v1_setting_service_proto_rawDescGZIP(), []int{9}+}++func (x *MCPSetting) GetCapability() MCPSetting_Capability {+ if x != nil {+ return x.Capability+ }+ return MCPSetting_CAPABILITY_UNSPECIFIED+}++func (x *MCPSetting) GetIgnoreMaskingExemptions() bool {+ if x != nil {+ return x.IgnoreMaskingExemptions}return false}@@ -1331,7 +1407,7 @@ type SQLEditorThemeSetting struct {func (x *SQLEditorThemeSetting) Reset() {*x = SQLEditorThemeSetting{}- mi := &file_v1_setting_service_proto_msgTypes[9]+ mi := &file_v1_setting_service_proto_msgTypes[10]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -1343,7 +1419,7 @@ func (x *SQLEditorThemeSetting) String() string {func (*SQLEditorThemeSetting) ProtoMessage() {}func (x *SQLEditorThemeSetting) ProtoReflect() protoreflect.Message {- mi := &file_v1_setting_service_proto_msgTypes[9]+ mi := &file_v1_setting_service_proto_msgTypes[10]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -1356,7 +1432,7 @@ func (x *SQLEditorThemeSetting) ProtoReflect() protoreflect.Message {// Deprecated: Use SQLEditorThemeSetting.ProtoReflect.Descriptor instead.func (*SQLEditorThemeSetting) Descriptor() ([]byte, []int) {- return file_v1_setting_service_proto_rawDescGZIP(), []int{9}+ return file_v1_setting_service_proto_rawDescGZIP(), []int{10}}func (x *SQLEditorThemeSetting) GetId() string {@@ -1402,7 +1478,7 @@ type Announcement struct {func (x *Announcement) Reset() {*x = Announcement{}- mi := &file_v1_setting_service_proto_msgTypes[10]+ mi := &file_v1_setting_service_proto_msgTypes[11]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -1414,7 +1490,7 @@ func (x *Announcement) String() string {func (*Announcement) ProtoMessage() {}func (x *Announcement) ProtoReflect() protoreflect.Message {- mi := &file_v1_setting_service_proto_msgTypes[10]+ mi := &file_v1_setting_service_proto_msgTypes[11]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -1427,7 +1503,7 @@ func (x *Announcement) ProtoReflect() protoreflect.Message {// Deprecated: Use Announcement.ProtoReflect.Descriptor instead.func (*Announcement) Descriptor() ([]byte, []int) {- return file_v1_setting_service_proto_rawDescGZIP(), []int{10}+ return file_v1_setting_service_proto_rawDescGZIP(), []int{11}}func (x *Announcement) GetText() string {@@ -1460,7 +1536,7 @@ type WorkspaceApprovalSetting struct {func (x *WorkspaceApprovalSetting) Reset() {*x = WorkspaceApprovalSetting{}- mi := &file_v1_setting_service_proto_msgTypes[11]+ mi := &file_v1_setting_service_proto_msgTypes[12]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -1472,7 +1548,7 @@ func (x *WorkspaceApprovalSetting) String() string {func (*WorkspaceApprovalSetting) ProtoMessage() {}func (x *WorkspaceApprovalSetting) ProtoReflect() protoreflect.Message {- mi := &file_v1_setting_service_proto_msgTypes[11]+ mi := &file_v1_setting_service_proto_msgTypes[12]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -1485,7 +1561,7 @@ func (x *WorkspaceApprovalSetting) ProtoReflect() protoreflect.Message {// Deprecated: Use WorkspaceApprovalSetting.ProtoReflect.Descriptor instead.func (*WorkspaceApprovalSetting) Descriptor() ([]byte, []int) {- return file_v1_setting_service_proto_rawDescGZIP(), []int{11}+ return file_v1_setting_service_proto_rawDescGZIP(), []int{12}}func (x *WorkspaceApprovalSetting) GetRules() []*WorkspaceApprovalSetting_Rule {@@ -1504,7 +1580,7 @@ type DataClassificationSetting struct {func (x *DataClassificationSetting) Reset() {*x = DataClassificationSetting{}- mi := &file_v1_setting_service_proto_msgTypes[12]+ mi := &file_v1_setting_service_proto_msgTypes[13]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -1516,7 +1592,7 @@ func (x *DataClassificationSetting) String() string {func (*DataClassificationSetting) ProtoMessage() {}func (x *DataClassificationSetting) ProtoReflect() protoreflect.Message {- mi := &file_v1_setting_service_proto_msgTypes[12]+ mi := &file_v1_setting_service_proto_msgTypes[13]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -1529,7 +1605,7 @@ func (x *DataClassificationSetting) ProtoReflect() protoreflect.Message {// Deprecated: Use DataClassificationSetting.ProtoReflect.Descriptor instead.func (*DataClassificationSetting) Descriptor() ([]byte, []int) {- return file_v1_setting_service_proto_rawDescGZIP(), []int{12}+ return file_v1_setting_service_proto_rawDescGZIP(), []int{13}}func (x *DataClassificationSetting) GetConfigs() []*DataClassificationSetting_DataClassificationConfig {@@ -1548,7 +1624,7 @@ type SemanticTypeSetting struct {func (x *SemanticTypeSetting) Reset() {*x = SemanticTypeSetting{}- mi := &file_v1_setting_service_proto_msgTypes[13]+ mi := &file_v1_setting_service_proto_msgTypes[14]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -1560,7 +1636,7 @@ func (x *SemanticTypeSetting) String() string {func (*SemanticTypeSetting) ProtoMessage() {}func (x *SemanticTypeSetting) ProtoReflect() protoreflect.Message {- mi := &file_v1_setting_service_proto_msgTypes[13]+ mi := &file_v1_setting_service_proto_msgTypes[14]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -1573,7 +1649,7 @@ func (x *SemanticTypeSetting) ProtoReflect() protoreflect.Message {// Deprecated: Use SemanticTypeSetting.ProtoReflect.Descriptor instead.func (*SemanticTypeSetting) Descriptor() ([]byte, []int) {- return file_v1_setting_service_proto_rawDescGZIP(), []int{13}+ return file_v1_setting_service_proto_rawDescGZIP(), []int{14}}func (x *SemanticTypeSetting) GetTypes() []*SemanticTypeSetting_SemanticType {@@ -1598,7 +1674,7 @@ type Algorithm struct {func (x *Algorithm) Reset() {*x = Algorithm{}- mi := &file_v1_setting_service_proto_msgTypes[14]+ mi := &file_v1_setting_service_proto_msgTypes[15]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -1610,7 +1686,7 @@ func (x *Algorithm) String() string {func (*Algorithm) ProtoMessage() {}func (x *Algorithm) ProtoReflect() protoreflect.Message {- mi := &file_v1_setting_service_proto_msgTypes[14]+ mi := &file_v1_setting_service_proto_msgTypes[15]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -1623,7 +1699,7 @@ func (x *Algorithm) ProtoReflect() protoreflect.Message {// Deprecated: Use Algorithm.ProtoReflect.Descriptor instead.func (*Algorithm) Descriptor() ([]byte, []int) {- return file_v1_setting_service_proto_rawDescGZIP(), []int{14}+ return file_v1_setting_service_proto_rawDescGZIP(), []int{15}}func (x *Algorithm) GetMask() isAlgorithm_Mask {@@ -1711,7 +1787,7 @@ type AISetting struct {func (x *AISetting) Reset() {*x = AISetting{}- mi := &file_v1_setting_service_proto_msgTypes[15]+ mi := &file_v1_setting_service_proto_msgTypes[16]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -1723,7 +1799,7 @@ func (x *AISetting) String() string {func (*AISetting) ProtoMessage() {}func (x *AISetting) ProtoReflect() protoreflect.Message {- mi := &file_v1_setting_service_proto_msgTypes[15]+ mi := &file_v1_setting_service_proto_msgTypes[16]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -1736,7 +1812,7 @@ func (x *AISetting) ProtoReflect() protoreflect.Message {// Deprecated: Use AISetting.ProtoReflect.Descriptor instead.func (*AISetting) Descriptor() ([]byte, []int) {- return file_v1_setting_service_proto_rawDescGZIP(), []int{15}+ return file_v1_setting_service_proto_rawDescGZIP(), []int{16}}func (x *AISetting) GetEnabled() bool {@@ -1790,7 +1866,7 @@ type EnvironmentSetting struct {func (x *EnvironmentSetting) Reset() {*x = EnvironmentSetting{}- mi := &file_v1_setting_service_proto_msgTypes[16]+ mi := &file_v1_setting_service_proto_msgTypes[17]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -1802,7 +1878,7 @@ func (x *EnvironmentSetting) String() string {func (*EnvironmentSetting) ProtoMessage() {}func (x *EnvironmentSetting) ProtoReflect() protoreflect.Message {- mi := &file_v1_setting_service_proto_msgTypes[16]+ mi := &file_v1_setting_service_proto_msgTypes[17]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -1815,7 +1891,7 @@ func (x *EnvironmentSetting) ProtoReflect() protoreflect.Message {// Deprecated: Use EnvironmentSetting.ProtoReflect.Descriptor instead.func (*EnvironmentSetting) Descriptor() ([]byte, []int) {- return file_v1_setting_service_proto_rawDescGZIP(), []int{16}+ return file_v1_setting_service_proto_rawDescGZIP(), []int{17}}func (x *EnvironmentSetting) GetEnvironments() []*EnvironmentSetting_Environment {@@ -1840,7 +1916,7 @@ type EmailSetting struct {func (x *EmailSetting) Reset() {*x = EmailSetting{}- mi := &file_v1_setting_service_proto_msgTypes[17]+ mi := &file_v1_setting_service_proto_msgTypes[18]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -1852,7 +1928,7 @@ func (x *EmailSetting) String() string {func (*EmailSetting) ProtoMessage() {}func (x *EmailSetting) ProtoReflect() protoreflect.Message {- mi := &file_v1_setting_service_proto_msgTypes[17]+ mi := &file_v1_setting_service_proto_msgTypes[18]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -1865,7 +1941,7 @@ func (x *EmailSetting) ProtoReflect() protoreflect.Message {// Deprecated: Use EmailSetting.ProtoReflect.Descriptor instead.func (*EmailSetting) Descriptor() ([]byte, []int) {- return file_v1_setting_service_proto_rawDescGZIP(), []int{17}+ return file_v1_setting_service_proto_rawDescGZIP(), []int{18}}func (x *EmailSetting) GetFrom() string {@@ -1926,7 +2002,7 @@ type TestEmailSettingRequest struct {func (x *TestEmailSettingRequest) Reset() {*x = TestEmailSettingRequest{}- mi := &file_v1_setting_service_proto_msgTypes[18]+ mi := &file_v1_setting_service_proto_msgTypes[19]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -1938,7 +2014,7 @@ func (x *TestEmailSettingRequest) String() string {func (*TestEmailSettingRequest) ProtoMessage() {}func (x *TestEmailSettingRequest) ProtoReflect() protoreflect.Message {- mi := &file_v1_setting_service_proto_msgTypes[18]+ mi := &file_v1_setting_service_proto_msgTypes[19]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -1951,7 +2027,7 @@ func (x *TestEmailSettingRequest) ProtoReflect() protoreflect.Message {// Deprecated: Use TestEmailSettingRequest.ProtoReflect.Descriptor instead.func (*TestEmailSettingRequest) Descriptor() ([]byte, []int) {- return file_v1_setting_service_proto_rawDescGZIP(), []int{18}+ return file_v1_setting_service_proto_rawDescGZIP(), []int{19}}func (x *TestEmailSettingRequest) GetParent() string {@@ -1985,7 +2061,7 @@ type TestEmailSettingResponse struct {func (x *TestEmailSettingResponse) Reset() {*x = TestEmailSettingResponse{}- mi := &file_v1_setting_service_proto_msgTypes[19]+ mi := &file_v1_setting_service_proto_msgTypes[20]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -1997,7 +2073,7 @@ func (x *TestEmailSettingResponse) String() string {func (*TestEmailSettingResponse) ProtoMessage() {}func (x *TestEmailSettingResponse) ProtoReflect() protoreflect.Message {- mi := &file_v1_setting_service_proto_msgTypes[19]+ mi := &file_v1_setting_service_proto_msgTypes[20]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -2010,7 +2086,7 @@ func (x *TestEmailSettingResponse) ProtoReflect() protoreflect.Message {// Deprecated: Use TestEmailSettingResponse.ProtoReflect.Descriptor instead.func (*TestEmailSettingResponse) Descriptor() ([]byte, []int) {- return file_v1_setting_service_proto_rawDescGZIP(), []int{19}+ return file_v1_setting_service_proto_rawDescGZIP(), []int{20}}func (x *TestEmailSettingResponse) GetSuccess() bool {@@ -2036,7 +2112,7 @@ type AppIMSetting_Slack struct {func (x *AppIMSetting_Slack) Reset() {*x = AppIMSetting_Slack{}- mi := &file_v1_setting_service_proto_msgTypes[20]+ mi := &file_v1_setting_service_proto_msgTypes[21]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -2048,7 +2124,7 @@ func (x *AppIMSetting_Slack) String() string {func (*AppIMSetting_Slack) ProtoMessage() {}func (x *AppIMSetting_Slack) ProtoReflect() protoreflect.Message {- mi := &file_v1_setting_service_proto_msgTypes[20]+ mi := &file_v1_setting_service_proto_msgTypes[21]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -2081,7 +2157,7 @@ type AppIMSetting_Feishu struct {func (x *AppIMSetting_Feishu) Reset() {*x = AppIMSetting_Feishu{}- mi := &file_v1_setting_service_proto_msgTypes[21]+ mi := &file_v1_setting_service_proto_msgTypes[22]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -2093,7 +2169,7 @@ func (x *AppIMSetting_Feishu) String() string {func (*AppIMSetting_Feishu) ProtoMessage() {}func (x *AppIMSetting_Feishu) ProtoReflect() protoreflect.Message {- mi := &file_v1_setting_service_proto_msgTypes[21]+ mi := &file_v1_setting_service_proto_msgTypes[22]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -2134,7 +2210,7 @@ type AppIMSetting_Wecom struct {func (x *AppIMSetting_Wecom) Reset() {*x = AppIMSetting_Wecom{}- mi := &file_v1_setting_service_proto_msgTypes[22]+ mi := &file_v1_setting_service_proto_msgTypes[23]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -2146,7 +2222,7 @@ func (x *AppIMSetting_Wecom) String() string {func (*AppIMSetting_Wecom) ProtoMessage() {}func (x *AppIMSetting_Wecom) ProtoReflect() protoreflect.Message {- mi := &file_v1_setting_service_proto_msgTypes[22]+ mi := &file_v1_setting_service_proto_msgTypes[23]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -2193,7 +2269,7 @@ type AppIMSetting_Lark struct {func (x *AppIMSetting_Lark) Reset() {*x = AppIMSetting_Lark{}- mi := &file_v1_setting_service_proto_msgTypes[23]+ mi := &file_v1_setting_service_proto_msgTypes[24]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -2205,7 +2281,7 @@ func (x *AppIMSetting_Lark) String() string {func (*AppIMSetting_Lark) ProtoMessage() {}func (x *AppIMSetting_Lark) ProtoReflect() protoreflect.Message {- mi := &file_v1_setting_service_proto_msgTypes[23]+ mi := &file_v1_setting_service_proto_msgTypes[24]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -2246,7 +2322,7 @@ type AppIMSetting_DingTalk struct {func (x *AppIMSetting_DingTalk) Reset() {*x = AppIMSetting_DingTalk{}- mi := &file_v1_setting_service_proto_msgTypes[24]+ mi := &file_v1_setting_service_proto_msgTypes[25]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -2258,7 +2334,7 @@ func (x *AppIMSetting_DingTalk) String() string {func (*AppIMSetting_DingTalk) ProtoMessage() {}func (x *AppIMSetting_DingTalk) ProtoReflect() protoreflect.Message {- mi := &file_v1_setting_service_proto_msgTypes[24]+ mi := &file_v1_setting_service_proto_msgTypes[25]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -2309,7 +2385,7 @@ type AppIMSetting_Teams struct {func (x *AppIMSetting_Teams) Reset() {*x = AppIMSetting_Teams{}- mi := &file_v1_setting_service_proto_msgTypes[25]+ mi := &file_v1_setting_service_proto_msgTypes[26]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -2321,7 +2397,7 @@ func (x *AppIMSetting_Teams) String() string {func (*AppIMSetting_Teams) ProtoMessage() {}func (x *AppIMSetting_Teams) ProtoReflect() protoreflect.Message {- mi := &file_v1_setting_service_proto_msgTypes[25]+ mi := &file_v1_setting_service_proto_msgTypes[26]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -2376,7 +2452,7 @@ type AppIMSetting_IMSetting struct {func (x *AppIMSetting_IMSetting) Reset() {*x = AppIMSetting_IMSetting{}- mi := &file_v1_setting_service_proto_msgTypes[26]+ mi := &file_v1_setting_service_proto_msgTypes[27]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -2388,7 +2464,7 @@ func (x *AppIMSetting_IMSetting) String() string {func (*AppIMSetting_IMSetting) ProtoMessage() {}func (x *AppIMSetting_IMSetting) ProtoReflect() protoreflect.Message {- mi := &file_v1_setting_service_proto_msgTypes[26]+ mi := &file_v1_setting_service_proto_msgTypes[27]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -2534,7 +2610,7 @@ type WorkspaceProfileSetting_PasswordRestriction struct {func (x *WorkspaceProfileSetting_PasswordRestriction) Reset() {*x = WorkspaceProfileSetting_PasswordRestriction{}- mi := &file_v1_setting_service_proto_msgTypes[27]+ mi := &file_v1_setting_service_proto_msgTypes[28]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -2546,7 +2622,7 @@ func (x *WorkspaceProfileSetting_PasswordRestriction) String() string {func (*WorkspaceProfileSetting_PasswordRestriction) ProtoMessage() {}func (x *WorkspaceProfileSetting_PasswordRestriction) ProtoReflect() protoreflect.Message {- mi := &file_v1_setting_service_proto_msgTypes[27]+ mi := &file_v1_setting_service_proto_msgTypes[28]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -2621,7 +2697,7 @@ type Announcement_AnnouncementTheme struct {func (x *Announcement_AnnouncementTheme) Reset() {*x = Announcement_AnnouncementTheme{}- mi := &file_v1_setting_service_proto_msgTypes[29]+ mi := &file_v1_setting_service_proto_msgTypes[30]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -2633,7 +2709,7 @@ func (x *Announcement_AnnouncementTheme) String() string {func (*Announcement_AnnouncementTheme) ProtoMessage() {}func (x *Announcement_AnnouncementTheme) ProtoReflect() protoreflect.Message {- mi := &file_v1_setting_service_proto_msgTypes[29]+ mi := &file_v1_setting_service_proto_msgTypes[30]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -2646,7 +2722,7 @@ func (x *Announcement_AnnouncementTheme) ProtoReflect() protoreflect.Message {// Deprecated: Use Announcement_AnnouncementTheme.ProtoReflect.Descriptor instead.func (*Announcement_AnnouncementTheme) Descriptor() ([]byte, []int) {- return file_v1_setting_service_proto_rawDescGZIP(), []int{10, 0}+ return file_v1_setting_service_proto_rawDescGZIP(), []int{11, 0}}func (x *Announcement_AnnouncementTheme) GetBackground() *color.Color {@@ -2701,7 +2777,7 @@ type WorkspaceApprovalSetting_Rule struct {func (x *WorkspaceApprovalSetting_Rule) Reset() {*x = WorkspaceApprovalSetting_Rule{}- mi := &file_v1_setting_service_proto_msgTypes[30]+ mi := &file_v1_setting_service_proto_msgTypes[31]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -2713,7 +2789,7 @@ func (x *WorkspaceApprovalSetting_Rule) String() string {func (*WorkspaceApprovalSetting_Rule) ProtoMessage() {}func (x *WorkspaceApprovalSetting_Rule) ProtoReflect() protoreflect.Message {- mi := &file_v1_setting_service_proto_msgTypes[30]+ mi := &file_v1_setting_service_proto_msgTypes[31]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -2726,7 +2802,7 @@ func (x *WorkspaceApprovalSetting_Rule) ProtoReflect() protoreflect.Message {// Deprecated: Use WorkspaceApprovalSetting_Rule.ProtoReflect.Descriptor instead.func (*WorkspaceApprovalSetting_Rule) Descriptor() ([]byte, []int) {- return file_v1_setting_service_proto_rawDescGZIP(), []int{11, 0}+ return file_v1_setting_service_proto_rawDescGZIP(), []int{12, 0}}func (x *WorkspaceApprovalSetting_Rule) GetTemplate() *ApprovalTemplate {@@ -2766,7 +2842,7 @@ type DataClassificationSetting_DataClassificationConfig struct {func (x *DataClassificationSetting_DataClassificationConfig) Reset() {*x = DataClassificationSetting_DataClassificationConfig{}- mi := &file_v1_setting_service_proto_msgTypes[31]+ mi := &file_v1_setting_service_proto_msgTypes[32]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -2778,7 +2854,7 @@ func (x *DataClassificationSetting_DataClassificationConfig) String() string {func (*DataClassificationSetting_DataClassificationConfig) ProtoMessage() {}func (x *DataClassificationSetting_DataClassificationConfig) ProtoReflect() protoreflect.Message {- mi := &file_v1_setting_service_proto_msgTypes[31]+ mi := &file_v1_setting_service_proto_msgTypes[32]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -2791,7 +2867,7 @@ func (x *DataClassificationSetting_DataClassificationConfig) ProtoReflect() prot// Deprecated: Use DataClassificationSetting_DataClassificationConfig.ProtoReflect.Descriptor instead.func (*DataClassificationSetting_DataClassificationConfig) Descriptor() ([]byte, []int) {- return file_v1_setting_service_proto_rawDescGZIP(), []int{12, 0}+ return file_v1_setting_service_proto_rawDescGZIP(), []int{13, 0}}func (x *DataClassificationSetting_DataClassificationConfig) GetId() string {@@ -2833,7 +2909,7 @@ type DataClassificationSetting_DataClassificationConfig_Level struct {func (x *DataClassificationSetting_DataClassificationConfig_Level) Reset() {*x = DataClassificationSetting_DataClassificationConfig_Level{}- mi := &file_v1_setting_service_proto_msgTypes[32]+ mi := &file_v1_setting_service_proto_msgTypes[33]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -2845,7 +2921,7 @@ func (x *DataClassificationSetting_DataClassificationConfig_Level) String() strifunc (*DataClassificationSetting_DataClassificationConfig_Level) ProtoMessage() {}func (x *DataClassificationSetting_DataClassificationConfig_Level) ProtoReflect() protoreflect.Message {- mi := &file_v1_setting_service_proto_msgTypes[32]+ mi := &file_v1_setting_service_proto_msgTypes[33]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -2858,7 +2934,7 @@ func (x *DataClassificationSetting_DataClassificationConfig_Level) ProtoReflect(// Deprecated: Use DataClassificationSetting_DataClassificationConfig_Level.ProtoReflect.Descriptor instead.func (*DataClassificationSetting_DataClassificationConfig_Level) Descriptor() ([]byte, []int) {- return file_v1_setting_service_proto_rawDescGZIP(), []int{12, 0, 0}+ return file_v1_setting_service_proto_rawDescGZIP(), []int{13, 0, 0}}func (x *DataClassificationSetting_DataClassificationConfig_Level) GetTitle() string {@@ -2888,7 +2964,7 @@ type DataClassificationSetting_DataClassificationConfig_DataClassification strucfunc (x *DataClassificationSetting_DataClassificationConfig_DataClassification) Reset() {*x = DataClassificationSetting_DataClassificationConfig_DataClassification{}- mi := &file_v1_setting_service_proto_msgTypes[33]+ mi := &file_v1_setting_service_proto_msgTypes[34]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -2900,7 +2976,7 @@ func (x *DataClassificationSetting_DataClassificationConfig_DataClassification)func (*DataClassificationSetting_DataClassificationConfig_DataClassification) ProtoMessage() {}func (x *DataClassificationSetting_DataClassificationConfig_DataClassification) ProtoReflect() protoreflect.Message {- mi := &file_v1_setting_service_proto_msgTypes[33]+ mi := &file_v1_setting_service_proto_msgTypes[34]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -2913,7 +2989,7 @@ func (x *DataClassificationSetting_DataClassificationConfig_DataClassification)// Deprecated: Use DataClassificationSetting_DataClassificationConfig_DataClassification.ProtoReflect.Descriptor instead.func (*DataClassificationSetting_DataClassificationConfig_DataClassification) Descriptor() ([]byte, []int) {- return file_v1_setting_service_proto_rawDescGZIP(), []int{12, 0, 1}+ return file_v1_setting_service_proto_rawDescGZIP(), []int{13, 0, 1}}func (x *DataClassificationSetting_DataClassificationConfig_DataClassification) GetId() string {@@ -2954,7 +3030,7 @@ type SemanticTypeSetting_SemanticType struct {func (x *SemanticTypeSetting_SemanticType) Reset() {*x = SemanticTypeSetting_SemanticType{}- mi := &file_v1_setting_service_proto_msgTypes[35]+ mi := &file_v1_setting_service_proto_msgTypes[36]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -2966,7 +3042,7 @@ func (x *SemanticTypeSetting_SemanticType) String() string {func (*SemanticTypeSetting_SemanticType) ProtoMessage() {}func (x *SemanticTypeSetting_SemanticType) ProtoReflect() protoreflect.Message {- mi := &file_v1_setting_service_proto_msgTypes[35]+ mi := &file_v1_setting_service_proto_msgTypes[36]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -2979,7 +3055,7 @@ func (x *SemanticTypeSetting_SemanticType) ProtoReflect() protoreflect.Message {// Deprecated: Use SemanticTypeSetting_SemanticType.ProtoReflect.Descriptor instead.func (*SemanticTypeSetting_SemanticType) Descriptor() ([]byte, []int) {- return file_v1_setting_service_proto_rawDescGZIP(), []int{13, 0}+ return file_v1_setting_service_proto_rawDescGZIP(), []int{14, 0}}func (x *SemanticTypeSetting_SemanticType) GetId() string {@@ -3028,7 +3104,7 @@ type Algorithm_FullMask struct {func (x *Algorithm_FullMask) Reset() {*x = Algorithm_FullMask{}- mi := &file_v1_setting_service_proto_msgTypes[36]+ mi := &file_v1_setting_service_proto_msgTypes[37]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -3040,7 +3116,7 @@ func (x *Algorithm_FullMask) String() string {func (*Algorithm_FullMask) ProtoMessage() {}func (x *Algorithm_FullMask) ProtoReflect() protoreflect.Message {- mi := &file_v1_setting_service_proto_msgTypes[36]+ mi := &file_v1_setting_service_proto_msgTypes[37]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -3053,7 +3129,7 @@ func (x *Algorithm_FullMask) ProtoReflect() protoreflect.Message {// Deprecated: Use Algorithm_FullMask.ProtoReflect.Descriptor instead.func (*Algorithm_FullMask) Descriptor() ([]byte, []int) {- return file_v1_setting_service_proto_rawDescGZIP(), []int{14, 0}+ return file_v1_setting_service_proto_rawDescGZIP(), []int{15, 0}}func (x *Algorithm_FullMask) GetSubstitution() string {@@ -3074,7 +3150,7 @@ type Algorithm_RangeMask struct {func (x *Algorithm_RangeMask) Reset() {*x = Algorithm_RangeMask{}- mi := &file_v1_setting_service_proto_msgTypes[37]+ mi := &file_v1_setting_service_proto_msgTypes[38]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -3086,7 +3162,7 @@ func (x *Algorithm_RangeMask) String() string {func (*Algorithm_RangeMask) ProtoMessage() {}func (x *Algorithm_RangeMask) ProtoReflect() protoreflect.Message {- mi := &file_v1_setting_service_proto_msgTypes[37]+ mi := &file_v1_setting_service_proto_msgTypes[38]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -3099,7 +3175,7 @@ func (x *Algorithm_RangeMask) ProtoReflect() protoreflect.Message {// Deprecated: Use Algorithm_RangeMask.ProtoReflect.Descriptor instead.func (*Algorithm_RangeMask) Descriptor() ([]byte, []int) {- return file_v1_setting_service_proto_rawDescGZIP(), []int{14, 1}+ return file_v1_setting_service_proto_rawDescGZIP(), []int{15, 1}}func (x *Algorithm_RangeMask) GetSlices() []*Algorithm_RangeMask_Slice {@@ -3119,7 +3195,7 @@ type Algorithm_MD5Mask struct {func (x *Algorithm_MD5Mask) Reset() {*x = Algorithm_MD5Mask{}- mi := &file_v1_setting_service_proto_msgTypes[38]+ mi := &file_v1_setting_service_proto_msgTypes[39]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -3131,7 +3207,7 @@ func (x *Algorithm_MD5Mask) String() string {func (*Algorithm_MD5Mask) ProtoMessage() {}func (x *Algorithm_MD5Mask) ProtoReflect() protoreflect.Message {- mi := &file_v1_setting_service_proto_msgTypes[38]+ mi := &file_v1_setting_service_proto_msgTypes[39]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -3144,7 +3220,7 @@ func (x *Algorithm_MD5Mask) ProtoReflect() protoreflect.Message {// Deprecated: Use Algorithm_MD5Mask.ProtoReflect.Descriptor instead.func (*Algorithm_MD5Mask) Descriptor() ([]byte, []int) {- return file_v1_setting_service_proto_rawDescGZIP(), []int{14, 2}+ return file_v1_setting_service_proto_rawDescGZIP(), []int{15, 2}}func (x *Algorithm_MD5Mask) GetSalt() string {@@ -3166,7 +3242,7 @@ type Algorithm_InnerOuterMask struct {func (x *Algorithm_InnerOuterMask) Reset() {*x = Algorithm_InnerOuterMask{}- mi := &file_v1_setting_service_proto_msgTypes[39]+ mi := &file_v1_setting_service_proto_msgTypes[40]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -3178,7 +3254,7 @@ func (x *Algorithm_InnerOuterMask) String() string {func (*Algorithm_InnerOuterMask) ProtoMessage() {}func (x *Algorithm_InnerOuterMask) ProtoReflect() protoreflect.Message {- mi := &file_v1_setting_service_proto_msgTypes[39]+ mi := &file_v1_setting_service_proto_msgTypes[40]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -3191,7 +3267,7 @@ func (x *Algorithm_InnerOuterMask) ProtoReflect() protoreflect.Message {// Deprecated: Use Algorithm_InnerOuterMask.ProtoReflect.Descriptor instead.func (*Algorithm_InnerOuterMask) Descriptor() ([]byte, []int) {- return file_v1_setting_service_proto_rawDescGZIP(), []int{14, 3}+ return file_v1_setting_service_proto_rawDescGZIP(), []int{15, 3}}func (x *Algorithm_InnerOuterMask) GetPrefixLen() int32 {@@ -3239,7 +3315,7 @@ type Algorithm_RangeMask_Slice struct {func (x *Algorithm_RangeMask_Slice) Reset() {*x = Algorithm_RangeMask_Slice{}- mi := &file_v1_setting_service_proto_msgTypes[40]+ mi := &file_v1_setting_service_proto_msgTypes[41]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -3251,7 +3327,7 @@ func (x *Algorithm_RangeMask_Slice) String() string {func (*Algorithm_RangeMask_Slice) ProtoMessage() {}func (x *Algorithm_RangeMask_Slice) ProtoReflect() protoreflect.Message {- mi := &file_v1_setting_service_proto_msgTypes[40]+ mi := &file_v1_setting_service_proto_msgTypes[41]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -3264,7 +3340,7 @@ func (x *Algorithm_RangeMask_Slice) ProtoReflect() protoreflect.Message {// Deprecated: Use Algorithm_RangeMask_Slice.ProtoReflect.Descriptor instead.func (*Algorithm_RangeMask_Slice) Descriptor() ([]byte, []int) {- return file_v1_setting_service_proto_rawDescGZIP(), []int{14, 1, 0}+ return file_v1_setting_service_proto_rawDescGZIP(), []int{15, 1, 0}}func (x *Algorithm_RangeMask_Slice) GetStart() int32 {@@ -3308,7 +3384,7 @@ type EnvironmentSetting_Environment struct {func (x *EnvironmentSetting_Environment) Reset() {*x = EnvironmentSetting_Environment{}- mi := &file_v1_setting_service_proto_msgTypes[41]+ mi := &file_v1_setting_service_proto_msgTypes[42]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -3320,7 +3396,7 @@ func (x *EnvironmentSetting_Environment) String() string {func (*EnvironmentSetting_Environment) ProtoMessage() {}func (x *EnvironmentSetting_Environment) ProtoReflect() protoreflect.Message {- mi := &file_v1_setting_service_proto_msgTypes[41]+ mi := &file_v1_setting_service_proto_msgTypes[42]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -3333,7 +3409,7 @@ func (x *EnvironmentSetting_Environment) ProtoReflect() protoreflect.Message {// Deprecated: Use EnvironmentSetting_Environment.ProtoReflect.Descriptor instead.func (*EnvironmentSetting_Environment) Descriptor() ([]byte, []int) {- return file_v1_setting_service_proto_rawDescGZIP(), []int{16, 0}+ return file_v1_setting_service_proto_rawDescGZIP(), []int{17, 0}}func (x *EnvironmentSetting_Environment) GetName() string {@@ -3385,7 +3461,7 @@ type EmailSetting_SMTPConfig struct {func (x *EmailSetting_SMTPConfig) Reset() {*x = EmailSetting_SMTPConfig{}- mi := &file_v1_setting_service_proto_msgTypes[43]+ mi := &file_v1_setting_service_proto_msgTypes[44]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -3397,7 +3473,7 @@ func (x *EmailSetting_SMTPConfig) String() string {func (*EmailSetting_SMTPConfig) ProtoMessage() {}func (x *EmailSetting_SMTPConfig) ProtoReflect() protoreflect.Message {- mi := &file_v1_setting_service_proto_msgTypes[43]+ mi := &file_v1_setting_service_proto_msgTypes[44]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -3410,7 +3486,7 @@ func (x *EmailSetting_SMTPConfig) ProtoReflect() protoreflect.Message {// Deprecated: Use EmailSetting_SMTPConfig.ProtoReflect.Descriptor instead.func (*EmailSetting_SMTPConfig) Descriptor() ([]byte, []int) {- return file_v1_setting_service_proto_rawDescGZIP(), []int{17, 0}+ return file_v1_setting_service_proto_rawDescGZIP(), []int{18, 0}}func (x *EmailSetting_SMTPConfig) GetHost() string {@@ -3473,10 +3549,10 @@ const file_v1_setting_service_proto_rawDesc = "" +"\rvalidate_only\x18\x02 \x01(\bR\fvalidateOnly\x12#\n" +"\rallow_missing\x18\x03 \x01(\bR\fallowMissing\x12;\n" +"\vupdate_mask\x18\x04 \x01(\v2\x1a.google.protobuf.FieldMaskR\n" +- "updateMask\"\xc1\x02\n" ++ "updateMask\"\xca\x02\n" +"\aSetting\x12\x17\n" +"\x04name\x18\x01 \x01(\tB\x03\xe0A\bR\x04name\x124\n" +- "\x05value\x18\x02 \x01(\v2\x19.bytebase.v1.SettingValueB\x03\xe0A\x02R\x05value\"\xb7\x01\n" ++ "\x05value\x18\x02 \x01(\v2\x19.bytebase.v1.SettingValueB\x03\xe0A\x02R\x05value\"\xc0\x01\n" +"\vSettingName\x12\x1c\n" +"\x18SETTING_NAME_UNSPECIFIED\x10\x00\x12\x15\n" +"\x11WORKSPACE_PROFILE\x10\x01\x12\x16\n" +@@ -3487,8 +3563,9 @@ const file_v1_setting_service_proto_rawDesc = "" +"\x13DATA_CLASSIFICATION\x10\x05\x12\x12\n" +"\x0eSEMANTIC_TYPES\x10\x06\x12\x0f\n" +"\vENVIRONMENT\x10\a\x12\t\n" +- "\x05EMAIL\x10\b:-\xeaA*\n" +- "\x14bytebase.com/Setting\x12\x12settings/{setting}\"\xbe\x04\n" ++ "\x05EMAIL\x10\b\x12\a\n" ++ "\x03MCP\x10\t:-\xeaA*\n" ++ "\x14bytebase.com/Setting\x12\x12settings/{setting}\"\xeb\x04\n" +"\fSettingValue\x122\n" +"\x06app_im\x18\x01 \x01(\v2\x19.bytebase.v1.AppIMSettingH\x00R\x05appIm\x12S\n" +"\x11workspace_profile\x18\x02 \x01(\v2$.bytebase.v1.WorkspaceProfileSettingH\x00R\x10workspaceProfile\x12V\n" +@@ -3497,7 +3574,8 @@ const file_v1_setting_service_proto_rawDesc = "" +"\rsemantic_type\x18\x05 \x01(\v2 .bytebase.v1.SemanticTypeSettingH\x00R\fsemanticType\x12(\n" +"\x02ai\x18\x06 \x01(\v2\x16.bytebase.v1.AISettingH\x00R\x02ai\x12C\n" +"\venvironment\x18\a \x01(\v2\x1f.bytebase.v1.EnvironmentSettingH\x00R\venvironment\x121\n" +- "\x05email\x18\b \x01(\v2\x19.bytebase.v1.EmailSettingH\x00R\x05emailB\a\n" ++ "\x05email\x18\b \x01(\v2\x19.bytebase.v1.EmailSettingH\x00R\x05email\x12+\n" ++ "\x03mcp\x18\t \x01(\v2\x17.bytebase.v1.MCPSettingH\x00R\x03mcpB\a\n" +"\x05value\"\x82\b\n" +"\fAppIMSetting\x12?\n" +"\bsettings\x18\x01 \x03(\v2#.bytebase.v1.AppIMSetting.IMSettingR\bsettings\x1a\"\n" +@@ -3532,7 +3610,7 @@ const file_v1_setting_service_proto_rawDesc = "" +"\x04lark\x18\x05 \x01(\v2\x1e.bytebase.v1.AppIMSetting.LarkH\x00R\x04lark\x12@\n" +"\bdingtalk\x18\x06 \x01(\v2\".bytebase.v1.AppIMSetting.DingTalkH\x00R\bdingtalk\x127\n" +"\x05teams\x18\a \x01(\v2\x1f.bytebase.v1.AppIMSetting.TeamsH\x00R\x05teamsB\t\n" +- "\apayload\"\xba\x10\n" ++ "\apayload\"\x91\x0f\n" +"\x17WorkspaceProfileSetting\x12!\n" +"\fexternal_url\x18\x01 \x01(\tR\vexternalUrl\x12'\n" +"\x0fdisallow_signup\x18\x02 \x01(\bR\x0edisallowSignup\x12\x1f\n" +@@ -3558,8 +3636,7 @@ const file_v1_setting_service_proto_rawDesc = "" +"\x17allow_email_code_signin\x18\x16 \x01(\bR\x14allowEmailCodeSignin\x12-\n" +"\x13sql_editor_theme_id\x18\x17 \x01(\tR\x10sqlEditorThemeId\x12Y\n" +"\x17sql_editor_custom_theme\x18\x18 \x01(\v2\".bytebase.v1.SQLEditorThemeSettingR\x14sqlEditorCustomTheme\x12Q\n" +- "\x17maximum_role_expiration\x18\x19 \x01(\v2\x19.google.protobuf.DurationR\x15maximumRoleExpiration\x12Y\n" +- "\x0emcp_capability\x18\x1a \x01(\x0e22.bytebase.v1.WorkspaceProfileSetting.MCPCapabilityR\rmcpCapability\x12J\n" ++ "\x17maximum_role_expiration\x18\x19 \x01(\v2\x19.google.protobuf.DurationR\x15maximumRoleExpiration\x12J\n" +"\x1fdirectory_sync_token_configured\x18\x1b \x01(\bB\x03\xe0A\x03R\x1cdirectorySyncTokenConfigured\x1a\x93\x03\n" +"\x13PasswordRestriction\x12\x1d\n" +"\n" +@@ -3569,13 +3646,20 @@ const file_v1_setting_service_proto_rawDesc = "" +"\x18require_uppercase_letter\x18\x04 \x01(\bR\x16requireUppercaseLetter\x12:\n" +"\x19require_special_character\x18\x05 \x01(\bR\x17requireSpecialCharacter\x12Q\n" +"&require_reset_password_for_first_login\x18\x06 \x01(\bR!requireResetPasswordForFirstLogin\x12F\n" +- "\x11password_rotation\x18\a \x01(\v2\x19.google.protobuf.DurationR\x10passwordRotation\"b\n" +- "\rMCPCapability\x12\x1e\n" +- "\x1aMCP_CAPABILITY_UNSPECIFIED\x10\x00\x12\f\n" ++ "\x11password_rotation\x18\a \x01(\v2\x19.google.protobuf.DurationR\x10passwordRotationJ\x04\b\x0f\x10\x10J\x04\b\x1a\x10\x1bJ\x04\b\x10\x10\x11R\x0emcp_capability\"\xe9\x01\n" ++ "\n" ++ "MCPSetting\x12B\n" ++ "\n" ++ "capability\x18\x01 \x01(\x0e2\".bytebase.v1.MCPSetting.CapabilityR\n" ++ "capability\x12:\n" ++ "\x19ignore_masking_exemptions\x18\x02 \x01(\bR\x17ignoreMaskingExemptions\"[\n" ++ "\n" ++ "Capability\x12\x1a\n" ++ "\x16CAPABILITY_UNSPECIFIED\x10\x00\x12\f\n" +"\bDISABLED\x10\x01\x12\r\n" +"\tREAD_ONLY\x10\x03\x12\x0e\n" +"\n" +- "READ_WRITE\x10\x04\"\x04\b\x02\x10\x02J\x04\b\x0f\x10\x10J\x04\b\x10\x10\x11\"\xf3\x01\n" ++ "READ_WRITE\x10\x04\"\x04\b\x02\x10\x02\"\xf3\x01\n" +"\x15SQLEditorThemeSetting\x12\x0e\n" +"\x02id\x18\x01 \x01(\tR\x02id\x12\x12\n" +"\x04name\x18\x02 \x01(\tR\x04name\x12\x1f\n" +@@ -3750,11 +3834,11 @@ func file_v1_setting_service_proto_rawDescGZIP() []byte {}var file_v1_setting_service_proto_enumTypes = make([]protoimpl.EnumInfo, 9)-var file_v1_setting_service_proto_msgTypes = make([]protoimpl.MessageInfo, 44)+var file_v1_setting_service_proto_msgTypes = make([]protoimpl.MessageInfo, 45)var file_v1_setting_service_proto_goTypes = []any{(DatabaseChangeMode)(0), // 0: bytebase.v1.DatabaseChangeMode(Setting_SettingName)(0), // 1: bytebase.v1.Setting.SettingName- (WorkspaceProfileSetting_MCPCapability)(0), // 2: bytebase.v1.WorkspaceProfileSetting.MCPCapability+ (MCPSetting_Capability)(0), // 2: bytebase.v1.MCPSetting.Capability(WorkspaceApprovalSetting_Rule_Source)(0), // 3: bytebase.v1.WorkspaceApprovalSetting.Rule.Source(Algorithm_InnerOuterMask_MaskType)(0), // 4: bytebase.v1.Algorithm.InnerOuterMask.MaskType(AISetting_Provider)(0), // 5: bytebase.v1.AISetting.Provider@@ -3770,125 +3854,127 @@ var file_v1_setting_service_proto_goTypes = []any{(*SettingValue)(nil), // 15: bytebase.v1.SettingValue(*AppIMSetting)(nil), // 16: bytebase.v1.AppIMSetting(*WorkspaceProfileSetting)(nil), // 17: bytebase.v1.WorkspaceProfileSetting- (*SQLEditorThemeSetting)(nil), // 18: bytebase.v1.SQLEditorThemeSetting- (*Announcement)(nil), // 19: bytebase.v1.Announcement- (*WorkspaceApprovalSetting)(nil), // 20: bytebase.v1.WorkspaceApprovalSetting- (*DataClassificationSetting)(nil), // 21: bytebase.v1.DataClassificationSetting- (*SemanticTypeSetting)(nil), // 22: bytebase.v1.SemanticTypeSetting- (*Algorithm)(nil), // 23: bytebase.v1.Algorithm- (*AISetting)(nil), // 24: bytebase.v1.AISetting- (*EnvironmentSetting)(nil), // 25: bytebase.v1.EnvironmentSetting- (*EmailSetting)(nil), // 26: bytebase.v1.EmailSetting- (*TestEmailSettingRequest)(nil), // 27: bytebase.v1.TestEmailSettingRequest- (*TestEmailSettingResponse)(nil), // 28: bytebase.v1.TestEmailSettingResponse- (*AppIMSetting_Slack)(nil), // 29: bytebase.v1.AppIMSetting.Slack- (*AppIMSetting_Feishu)(nil), // 30: bytebase.v1.AppIMSetting.Feishu- (*AppIMSetting_Wecom)(nil), // 31: bytebase.v1.AppIMSetting.Wecom- (*AppIMSetting_Lark)(nil), // 32: bytebase.v1.AppIMSetting.Lark- (*AppIMSetting_DingTalk)(nil), // 33: bytebase.v1.AppIMSetting.DingTalk- (*AppIMSetting_Teams)(nil), // 34: bytebase.v1.AppIMSetting.Teams- (*AppIMSetting_IMSetting)(nil), // 35: bytebase.v1.AppIMSetting.IMSetting- (*WorkspaceProfileSetting_PasswordRestriction)(nil), // 36: bytebase.v1.WorkspaceProfileSetting.PasswordRestriction- nil, // 37: bytebase.v1.SQLEditorThemeSetting.TokensEntry- (*Announcement_AnnouncementTheme)(nil), // 38: bytebase.v1.Announcement.AnnouncementTheme- (*WorkspaceApprovalSetting_Rule)(nil), // 39: bytebase.v1.WorkspaceApprovalSetting.Rule- (*DataClassificationSetting_DataClassificationConfig)(nil), // 40: bytebase.v1.DataClassificationSetting.DataClassificationConfig- (*DataClassificationSetting_DataClassificationConfig_Level)(nil), // 41: bytebase.v1.DataClassificationSetting.DataClassificationConfig.Level- (*DataClassificationSetting_DataClassificationConfig_DataClassification)(nil), // 42: bytebase.v1.DataClassificationSetting.DataClassificationConfig.DataClassification- nil, // 43: bytebase.v1.DataClassificationSetting.DataClassificationConfig.ClassificationEntry- (*SemanticTypeSetting_SemanticType)(nil), // 44: bytebase.v1.SemanticTypeSetting.SemanticType- (*Algorithm_FullMask)(nil), // 45: bytebase.v1.Algorithm.FullMask- (*Algorithm_RangeMask)(nil), // 46: bytebase.v1.Algorithm.RangeMask- (*Algorithm_MD5Mask)(nil), // 47: bytebase.v1.Algorithm.MD5Mask- (*Algorithm_InnerOuterMask)(nil), // 48: bytebase.v1.Algorithm.InnerOuterMask- (*Algorithm_RangeMask_Slice)(nil), // 49: bytebase.v1.Algorithm.RangeMask.Slice- (*EnvironmentSetting_Environment)(nil), // 50: bytebase.v1.EnvironmentSetting.Environment- nil, // 51: bytebase.v1.EnvironmentSetting.Environment.TagsEntry- (*EmailSetting_SMTPConfig)(nil), // 52: bytebase.v1.EmailSetting.SMTPConfig- (*fieldmaskpb.FieldMask)(nil), // 53: google.protobuf.FieldMask- (*durationpb.Duration)(nil), // 54: google.protobuf.Duration- (WebhookType)(0), // 55: bytebase.v1.WebhookType- (*color.Color)(nil), // 56: google.type.Color- (*ApprovalTemplate)(nil), // 57: bytebase.v1.ApprovalTemplate- (*expr.Expr)(nil), // 58: google.type.Expr+ (*MCPSetting)(nil), // 18: bytebase.v1.MCPSetting+ (*SQLEditorThemeSetting)(nil), // 19: bytebase.v1.SQLEditorThemeSetting+ (*Announcement)(nil), // 20: bytebase.v1.Announcement+ (*WorkspaceApprovalSetting)(nil), // 21: bytebase.v1.WorkspaceApprovalSetting+ (*DataClassificationSetting)(nil), // 22: bytebase.v1.DataClassificationSetting+ (*SemanticTypeSetting)(nil), // 23: bytebase.v1.SemanticTypeSetting+ (*Algorithm)(nil), // 24: bytebase.v1.Algorithm+ (*AISetting)(nil), // 25: bytebase.v1.AISetting+ (*EnvironmentSetting)(nil), // 26: bytebase.v1.EnvironmentSetting+ (*EmailSetting)(nil), // 27: bytebase.v1.EmailSetting+ (*TestEmailSettingRequest)(nil), // 28: bytebase.v1.TestEmailSettingRequest+ (*TestEmailSettingResponse)(nil), // 29: bytebase.v1.TestEmailSettingResponse+ (*AppIMSetting_Slack)(nil), // 30: bytebase.v1.AppIMSetting.Slack+ (*AppIMSetting_Feishu)(nil), // 31: bytebase.v1.AppIMSetting.Feishu+ (*AppIMSetting_Wecom)(nil), // 32: bytebase.v1.AppIMSetting.Wecom+ (*AppIMSetting_Lark)(nil), // 33: bytebase.v1.AppIMSetting.Lark+ (*AppIMSetting_DingTalk)(nil), // 34: bytebase.v1.AppIMSetting.DingTalk+ (*AppIMSetting_Teams)(nil), // 35: bytebase.v1.AppIMSetting.Teams+ (*AppIMSetting_IMSetting)(nil), // 36: bytebase.v1.AppIMSetting.IMSetting+ (*WorkspaceProfileSetting_PasswordRestriction)(nil), // 37: bytebase.v1.WorkspaceProfileSetting.PasswordRestriction+ nil, // 38: bytebase.v1.SQLEditorThemeSetting.TokensEntry+ (*Announcement_AnnouncementTheme)(nil), // 39: bytebase.v1.Announcement.AnnouncementTheme+ (*WorkspaceApprovalSetting_Rule)(nil), // 40: bytebase.v1.WorkspaceApprovalSetting.Rule+ (*DataClassificationSetting_DataClassificationConfig)(nil), // 41: bytebase.v1.DataClassificationSetting.DataClassificationConfig+ (*DataClassificationSetting_DataClassificationConfig_Level)(nil), // 42: bytebase.v1.DataClassificationSetting.DataClassificationConfig.Level+ (*DataClassificationSetting_DataClassificationConfig_DataClassification)(nil), // 43: bytebase.v1.DataClassificationSetting.DataClassificationConfig.DataClassification+ nil, // 44: bytebase.v1.DataClassificationSetting.DataClassificationConfig.ClassificationEntry+ (*SemanticTypeSetting_SemanticType)(nil), // 45: bytebase.v1.SemanticTypeSetting.SemanticType+ (*Algorithm_FullMask)(nil), // 46: bytebase.v1.Algorithm.FullMask+ (*Algorithm_RangeMask)(nil), // 47: bytebase.v1.Algorithm.RangeMask+ (*Algorithm_MD5Mask)(nil), // 48: bytebase.v1.Algorithm.MD5Mask+ (*Algorithm_InnerOuterMask)(nil), // 49: bytebase.v1.Algorithm.InnerOuterMask+ (*Algorithm_RangeMask_Slice)(nil), // 50: bytebase.v1.Algorithm.RangeMask.Slice+ (*EnvironmentSetting_Environment)(nil), // 51: bytebase.v1.EnvironmentSetting.Environment+ nil, // 52: bytebase.v1.EnvironmentSetting.Environment.TagsEntry+ (*EmailSetting_SMTPConfig)(nil), // 53: bytebase.v1.EmailSetting.SMTPConfig+ (*fieldmaskpb.FieldMask)(nil), // 54: google.protobuf.FieldMask+ (*durationpb.Duration)(nil), // 55: google.protobuf.Duration+ (WebhookType)(0), // 56: bytebase.v1.WebhookType+ (*color.Color)(nil), // 57: google.type.Color+ (*ApprovalTemplate)(nil), // 58: bytebase.v1.ApprovalTemplate+ (*expr.Expr)(nil), // 59: google.type.Expr}var file_v1_setting_service_proto_depIdxs = []int32{14, // 0: bytebase.v1.ListSettingsResponse.settings:type_name -> bytebase.v1.Setting14, // 1: bytebase.v1.GetSettingResponse.setting:type_name -> bytebase.v1.Setting14, // 2: bytebase.v1.UpdateSettingRequest.setting:type_name -> bytebase.v1.Setting- 53, // 3: bytebase.v1.UpdateSettingRequest.update_mask:type_name -> google.protobuf.FieldMask+ 54, // 3: bytebase.v1.UpdateSettingRequest.update_mask:type_name -> google.protobuf.FieldMask15, // 4: bytebase.v1.Setting.value:type_name -> bytebase.v1.SettingValue16, // 5: bytebase.v1.SettingValue.app_im:type_name -> bytebase.v1.AppIMSetting17, // 6: bytebase.v1.SettingValue.workspace_profile:type_name -> bytebase.v1.WorkspaceProfileSetting- 20, // 7: bytebase.v1.SettingValue.workspace_approval:type_name -> bytebase.v1.WorkspaceApprovalSetting- 21, // 8: bytebase.v1.SettingValue.data_classification:type_name -> bytebase.v1.DataClassificationSetting- 22, // 9: bytebase.v1.SettingValue.semantic_type:type_name -> bytebase.v1.SemanticTypeSetting- 24, // 10: bytebase.v1.SettingValue.ai:type_name -> bytebase.v1.AISetting- 25, // 11: bytebase.v1.SettingValue.environment:type_name -> bytebase.v1.EnvironmentSetting- 26, // 12: bytebase.v1.SettingValue.email:type_name -> bytebase.v1.EmailSetting- 35, // 13: bytebase.v1.AppIMSetting.settings:type_name -> bytebase.v1.AppIMSetting.IMSetting- 54, // 14: bytebase.v1.WorkspaceProfileSetting.refresh_token_duration:type_name -> google.protobuf.Duration- 19, // 15: bytebase.v1.WorkspaceProfileSetting.announcement:type_name -> bytebase.v1.Announcement- 54, // 16: bytebase.v1.WorkspaceProfileSetting.maximum_request_expiration:type_name -> google.protobuf.Duration- 0, // 17: bytebase.v1.WorkspaceProfileSetting.database_change_mode:type_name -> bytebase.v1.DatabaseChangeMode- 54, // 18: bytebase.v1.WorkspaceProfileSetting.inactive_session_timeout:type_name -> google.protobuf.Duration- 36, // 19: bytebase.v1.WorkspaceProfileSetting.password_restriction:type_name -> bytebase.v1.WorkspaceProfileSetting.PasswordRestriction- 54, // 20: bytebase.v1.WorkspaceProfileSetting.access_token_duration:type_name -> google.protobuf.Duration- 54, // 21: bytebase.v1.WorkspaceProfileSetting.query_timeout:type_name -> google.protobuf.Duration- 18, // 22: bytebase.v1.WorkspaceProfileSetting.sql_editor_custom_theme:type_name -> bytebase.v1.SQLEditorThemeSetting- 54, // 23: bytebase.v1.WorkspaceProfileSetting.maximum_role_expiration:type_name -> google.protobuf.Duration- 2, // 24: bytebase.v1.WorkspaceProfileSetting.mcp_capability:type_name -> bytebase.v1.WorkspaceProfileSetting.MCPCapability- 37, // 25: bytebase.v1.SQLEditorThemeSetting.tokens:type_name -> bytebase.v1.SQLEditorThemeSetting.TokensEntry- 38, // 26: bytebase.v1.Announcement.theme:type_name -> bytebase.v1.Announcement.AnnouncementTheme- 39, // 27: bytebase.v1.WorkspaceApprovalSetting.rules:type_name -> bytebase.v1.WorkspaceApprovalSetting.Rule- 40, // 28: bytebase.v1.DataClassificationSetting.configs:type_name -> bytebase.v1.DataClassificationSetting.DataClassificationConfig- 44, // 29: bytebase.v1.SemanticTypeSetting.types:type_name -> bytebase.v1.SemanticTypeSetting.SemanticType- 45, // 30: bytebase.v1.Algorithm.full_mask:type_name -> bytebase.v1.Algorithm.FullMask- 46, // 31: bytebase.v1.Algorithm.range_mask:type_name -> bytebase.v1.Algorithm.RangeMask- 47, // 32: bytebase.v1.Algorithm.md5_mask:type_name -> bytebase.v1.Algorithm.MD5Mask- 48, // 33: bytebase.v1.Algorithm.inner_outer_mask:type_name -> bytebase.v1.Algorithm.InnerOuterMask- 5, // 34: bytebase.v1.AISetting.provider:type_name -> bytebase.v1.AISetting.Provider- 50, // 35: bytebase.v1.EnvironmentSetting.environments:type_name -> bytebase.v1.EnvironmentSetting.Environment- 6, // 36: bytebase.v1.EmailSetting.type:type_name -> bytebase.v1.EmailSetting.Type- 52, // 37: bytebase.v1.EmailSetting.smtp:type_name -> bytebase.v1.EmailSetting.SMTPConfig- 26, // 38: bytebase.v1.TestEmailSettingRequest.email_setting:type_name -> bytebase.v1.EmailSetting- 55, // 39: bytebase.v1.AppIMSetting.IMSetting.type:type_name -> bytebase.v1.WebhookType- 29, // 40: bytebase.v1.AppIMSetting.IMSetting.slack:type_name -> bytebase.v1.AppIMSetting.Slack- 30, // 41: bytebase.v1.AppIMSetting.IMSetting.feishu:type_name -> bytebase.v1.AppIMSetting.Feishu- 31, // 42: bytebase.v1.AppIMSetting.IMSetting.wecom:type_name -> bytebase.v1.AppIMSetting.Wecom- 32, // 43: bytebase.v1.AppIMSetting.IMSetting.lark:type_name -> bytebase.v1.AppIMSetting.Lark- 33, // 44: bytebase.v1.AppIMSetting.IMSetting.dingtalk:type_name -> bytebase.v1.AppIMSetting.DingTalk- 34, // 45: bytebase.v1.AppIMSetting.IMSetting.teams:type_name -> bytebase.v1.AppIMSetting.Teams- 54, // 46: bytebase.v1.WorkspaceProfileSetting.PasswordRestriction.password_rotation:type_name -> google.protobuf.Duration- 56, // 47: bytebase.v1.SQLEditorThemeSetting.TokensEntry.value:type_name -> google.type.Color- 56, // 48: bytebase.v1.Announcement.AnnouncementTheme.background:type_name -> google.type.Color- 56, // 49: bytebase.v1.Announcement.AnnouncementTheme.text:type_name -> google.type.Color- 57, // 50: bytebase.v1.WorkspaceApprovalSetting.Rule.template:type_name -> bytebase.v1.ApprovalTemplate- 58, // 51: bytebase.v1.WorkspaceApprovalSetting.Rule.condition:type_name -> google.type.Expr- 3, // 52: bytebase.v1.WorkspaceApprovalSetting.Rule.source:type_name -> bytebase.v1.WorkspaceApprovalSetting.Rule.Source- 41, // 53: bytebase.v1.DataClassificationSetting.DataClassificationConfig.levels:type_name -> bytebase.v1.DataClassificationSetting.DataClassificationConfig.Level- 43, // 54: bytebase.v1.DataClassificationSetting.DataClassificationConfig.classification:type_name -> bytebase.v1.DataClassificationSetting.DataClassificationConfig.ClassificationEntry- 42, // 55: bytebase.v1.DataClassificationSetting.DataClassificationConfig.ClassificationEntry.value:type_name -> bytebase.v1.DataClassificationSetting.DataClassificationConfig.DataClassification- 23, // 56: bytebase.v1.SemanticTypeSetting.SemanticType.algorithm:type_name -> bytebase.v1.Algorithm- 49, // 57: bytebase.v1.Algorithm.RangeMask.slices:type_name -> bytebase.v1.Algorithm.RangeMask.Slice- 4, // 58: bytebase.v1.Algorithm.InnerOuterMask.type:type_name -> bytebase.v1.Algorithm.InnerOuterMask.MaskType- 51, // 59: bytebase.v1.EnvironmentSetting.Environment.tags:type_name -> bytebase.v1.EnvironmentSetting.Environment.TagsEntry- 56, // 60: bytebase.v1.EnvironmentSetting.Environment.color:type_name -> google.type.Color- 7, // 61: bytebase.v1.EmailSetting.SMTPConfig.encryption:type_name -> bytebase.v1.EmailSetting.SMTPConfig.Encryption- 8, // 62: bytebase.v1.EmailSetting.SMTPConfig.authentication:type_name -> bytebase.v1.EmailSetting.SMTPConfig.Authentication- 9, // 63: bytebase.v1.SettingService.ListSettings:input_type -> bytebase.v1.ListSettingsRequest- 11, // 64: bytebase.v1.SettingService.GetSetting:input_type -> bytebase.v1.GetSettingRequest- 13, // 65: bytebase.v1.SettingService.UpdateSetting:input_type -> bytebase.v1.UpdateSettingRequest- 27, // 66: bytebase.v1.SettingService.TestEmailSetting:input_type -> bytebase.v1.TestEmailSettingRequest- 10, // 67: bytebase.v1.SettingService.ListSettings:output_type -> bytebase.v1.ListSettingsResponse- 14, // 68: bytebase.v1.SettingService.GetSetting:output_type -> bytebase.v1.Setting- 14, // 69: bytebase.v1.SettingService.UpdateSetting:output_type -> bytebase.v1.Setting- 28, // 70: bytebase.v1.SettingService.TestEmailSetting:output_type -> bytebase.v1.TestEmailSettingResponse- 67, // [67:71] is the sub-list for method output_type- 63, // [63:67] is the sub-list for method input_type- 63, // [63:63] is the sub-list for extension type_name- 63, // [63:63] is the sub-list for extension extendee- 0, // [0:63] is the sub-list for field type_name+ 21, // 7: bytebase.v1.SettingValue.workspace_approval:type_name -> bytebase.v1.WorkspaceApprovalSetting+ 22, // 8: bytebase.v1.SettingValue.data_classification:type_name -> bytebase.v1.DataClassificationSetting+ 23, // 9: bytebase.v1.SettingValue.semantic_type:type_name -> bytebase.v1.SemanticTypeSetting+ 25, // 10: bytebase.v1.SettingValue.ai:type_name -> bytebase.v1.AISetting+ 26, // 11: bytebase.v1.SettingValue.environment:type_name -> bytebase.v1.EnvironmentSetting+ 27, // 12: bytebase.v1.SettingValue.email:type_name -> bytebase.v1.EmailSetting+ 18, // 13: bytebase.v1.SettingValue.mcp:type_name -> bytebase.v1.MCPSetting+ 36, // 14: bytebase.v1.AppIMSetting.settings:type_name -> bytebase.v1.AppIMSetting.IMSetting+ 55, // 15: bytebase.v1.WorkspaceProfileSetting.refresh_token_duration:type_name -> google.protobuf.Duration+ 20, // 16: bytebase.v1.WorkspaceProfileSetting.announcement:type_name -> bytebase.v1.Announcement+ 55, // 17: bytebase.v1.WorkspaceProfileSetting.maximum_request_expiration:type_name -> google.protobuf.Duration+ 0, // 18: bytebase.v1.WorkspaceProfileSetting.database_change_mode:type_name -> bytebase.v1.DatabaseChangeMode+ 55, // 19: bytebase.v1.WorkspaceProfileSetting.inactive_session_timeout:type_name -> google.protobuf.Duration+ 37, // 20: bytebase.v1.WorkspaceProfileSetting.password_restriction:type_name -> bytebase.v1.WorkspaceProfileSetting.PasswordRestriction+ 55, // 21: bytebase.v1.WorkspaceProfileSetting.access_token_duration:type_name -> google.protobuf.Duration+ 55, // 22: bytebase.v1.WorkspaceProfileSetting.query_timeout:type_name -> google.protobuf.Duration+ 19, // 23: bytebase.v1.WorkspaceProfileSetting.sql_editor_custom_theme:type_name -> bytebase.v1.SQLEditorThemeSetting+ 55, // 24: bytebase.v1.WorkspaceProfileSetting.maximum_role_expiration:type_name -> google.protobuf.Duration+ 2, // 25: bytebase.v1.MCPSetting.capability:type_name -> bytebase.v1.MCPSetting.Capability+ 38, // 26: bytebase.v1.SQLEditorThemeSetting.tokens:type_name -> bytebase.v1.SQLEditorThemeSetting.TokensEntry+ 39, // 27: bytebase.v1.Announcement.theme:type_name -> bytebase.v1.Announcement.AnnouncementTheme+ 40, // 28: bytebase.v1.WorkspaceApprovalSetting.rules:type_name -> bytebase.v1.WorkspaceApprovalSetting.Rule+ 41, // 29: bytebase.v1.DataClassificationSetting.configs:type_name -> bytebase.v1.DataClassificationSetting.DataClassificationConfig+ 45, // 30: bytebase.v1.SemanticTypeSetting.types:type_name -> bytebase.v1.SemanticTypeSetting.SemanticType+ 46, // 31: bytebase.v1.Algorithm.full_mask:type_name -> bytebase.v1.Algorithm.FullMask+ 47, // 32: bytebase.v1.Algorithm.range_mask:type_name -> bytebase.v1.Algorithm.RangeMask+ 48, // 33: bytebase.v1.Algorithm.md5_mask:type_name -> bytebase.v1.Algorithm.MD5Mask+ 49, // 34: bytebase.v1.Algorithm.inner_outer_mask:type_name -> bytebase.v1.Algorithm.InnerOuterMask+ 5, // 35: bytebase.v1.AISetting.provider:type_name -> bytebase.v1.AISetting.Provider+ 51, // 36: bytebase.v1.EnvironmentSetting.environments:type_name -> bytebase.v1.EnvironmentSetting.Environment+ 6, // 37: bytebase.v1.EmailSetting.type:type_name -> bytebase.v1.EmailSetting.Type+ 53, // 38: bytebase.v1.EmailSetting.smtp:type_name -> bytebase.v1.EmailSetting.SMTPConfig+ 27, // 39: bytebase.v1.TestEmailSettingRequest.email_setting:type_name -> bytebase.v1.EmailSetting+ 56, // 40: bytebase.v1.AppIMSetting.IMSetting.type:type_name -> bytebase.v1.WebhookType+ 30, // 41: bytebase.v1.AppIMSetting.IMSetting.slack:type_name -> bytebase.v1.AppIMSetting.Slack+ 31, // 42: bytebase.v1.AppIMSetting.IMSetting.feishu:type_name -> bytebase.v1.AppIMSetting.Feishu+ 32, // 43: bytebase.v1.AppIMSetting.IMSetting.wecom:type_name -> bytebase.v1.AppIMSetting.Wecom+ 33, // 44: bytebase.v1.AppIMSetting.IMSetting.lark:type_name -> bytebase.v1.AppIMSetting.Lark+ 34, // 45: bytebase.v1.AppIMSetting.IMSetting.dingtalk:type_name -> bytebase.v1.AppIMSetting.DingTalk+ 35, // 46: bytebase.v1.AppIMSetting.IMSetting.teams:type_name -> bytebase.v1.AppIMSetting.Teams+ 55, // 47: bytebase.v1.WorkspaceProfileSetting.PasswordRestriction.password_rotation:type_name -> google.protobuf.Duration+ 57, // 48: bytebase.v1.SQLEditorThemeSetting.TokensEntry.value:type_name -> google.type.Color+ 57, // 49: bytebase.v1.Announcement.AnnouncementTheme.background:type_name -> google.type.Color+ 57, // 50: bytebase.v1.Announcement.AnnouncementTheme.text:type_name -> google.type.Color+ 58, // 51: bytebase.v1.WorkspaceApprovalSetting.Rule.template:type_name -> bytebase.v1.ApprovalTemplate+ 59, // 52: bytebase.v1.WorkspaceApprovalSetting.Rule.condition:type_name -> google.type.Expr+ 3, // 53: bytebase.v1.WorkspaceApprovalSetting.Rule.source:type_name -> bytebase.v1.WorkspaceApprovalSetting.Rule.Source+ 42, // 54: bytebase.v1.DataClassificationSetting.DataClassificationConfig.levels:type_name -> bytebase.v1.DataClassificationSetting.DataClassificationConfig.Level+ 44, // 55: bytebase.v1.DataClassificationSetting.DataClassificationConfig.classification:type_name -> bytebase.v1.DataClassificationSetting.DataClassificationConfig.ClassificationEntry+ 43, // 56: bytebase.v1.DataClassificationSetting.DataClassificationConfig.ClassificationEntry.value:type_name -> bytebase.v1.DataClassificationSetting.DataClassificationConfig.DataClassification+ 24, // 57: bytebase.v1.SemanticTypeSetting.SemanticType.algorithm:type_name -> bytebase.v1.Algorithm+ 50, // 58: bytebase.v1.Algorithm.RangeMask.slices:type_name -> bytebase.v1.Algorithm.RangeMask.Slice+ 4, // 59: bytebase.v1.Algorithm.InnerOuterMask.type:type_name -> bytebase.v1.Algorithm.InnerOuterMask.MaskType+ 52, // 60: bytebase.v1.EnvironmentSetting.Environment.tags:type_name -> bytebase.v1.EnvironmentSetting.Environment.TagsEntry+ 57, // 61: bytebase.v1.EnvironmentSetting.Environment.color:type_name -> google.type.Color+ 7, // 62: bytebase.v1.EmailSetting.SMTPConfig.encryption:type_name -> bytebase.v1.EmailSetting.SMTPConfig.Encryption+ 8, // 63: bytebase.v1.EmailSetting.SMTPConfig.authentication:type_name -> bytebase.v1.EmailSetting.SMTPConfig.Authentication+ 9, // 64: bytebase.v1.SettingService.ListSettings:input_type -> bytebase.v1.ListSettingsRequest+ 11, // 65: bytebase.v1.SettingService.GetSetting:input_type -> bytebase.v1.GetSettingRequest+ 13, // 66: bytebase.v1.SettingService.UpdateSetting:input_type -> bytebase.v1.UpdateSettingRequest+ 28, // 67: bytebase.v1.SettingService.TestEmailSetting:input_type -> bytebase.v1.TestEmailSettingRequest+ 10, // 68: bytebase.v1.SettingService.ListSettings:output_type -> bytebase.v1.ListSettingsResponse+ 14, // 69: bytebase.v1.SettingService.GetSetting:output_type -> bytebase.v1.Setting+ 14, // 70: bytebase.v1.SettingService.UpdateSetting:output_type -> bytebase.v1.Setting+ 29, // 71: bytebase.v1.SettingService.TestEmailSetting:output_type -> bytebase.v1.TestEmailSettingResponse+ 68, // [68:72] is the sub-list for method output_type+ 64, // [64:68] is the sub-list for method input_type+ 64, // [64:64] is the sub-list for extension type_name+ 64, // [64:64] is the sub-list for extension extendee+ 0, // [0:64] is the sub-list for field type_name}func init() { file_v1_setting_service_proto_init() }@@ -3908,17 +3994,18 @@ func file_v1_setting_service_proto_init() {(*SettingValue_Ai)(nil),(*SettingValue_Environment)(nil),(*SettingValue_Email)(nil),+ (*SettingValue_Mcp)(nil),}- file_v1_setting_service_proto_msgTypes[14].OneofWrappers = []any{+ file_v1_setting_service_proto_msgTypes[15].OneofWrappers = []any{(*Algorithm_FullMask_)(nil),(*Algorithm_RangeMask_)(nil),(*Algorithm_Md5Mask)(nil),(*Algorithm_InnerOuterMask_)(nil),}- file_v1_setting_service_proto_msgTypes[17].OneofWrappers = []any{+ file_v1_setting_service_proto_msgTypes[18].OneofWrappers = []any{(*EmailSetting_Smtp)(nil),}- file_v1_setting_service_proto_msgTypes[26].OneofWrappers = []any{+ file_v1_setting_service_proto_msgTypes[27].OneofWrappers = []any{(*AppIMSetting_IMSetting_Slack)(nil),(*AppIMSetting_IMSetting_Feishu)(nil),(*AppIMSetting_IMSetting_Wecom)(nil),@@ -3926,14 +4013,14 @@ func file_v1_setting_service_proto_init() {(*AppIMSetting_IMSetting_Dingtalk)(nil),(*AppIMSetting_IMSetting_Teams)(nil),}- file_v1_setting_service_proto_msgTypes[33].OneofWrappers = []any{}+ file_v1_setting_service_proto_msgTypes[34].OneofWrappers = []any{}type x struct{}out := protoimpl.TypeBuilder{File: protoimpl.DescBuilder{GoPackagePath: reflect.TypeOf(x{}).PkgPath(),RawDescriptor: unsafe.Slice(unsafe.StringData(file_v1_setting_service_proto_rawDesc), len(file_v1_setting_service_proto_rawDesc)),NumEnums: 9,- NumMessages: 44,+ NumMessages: 45,NumExtensions: 0,NumServices: 1,},diff --git a/backend/generated-go/v1/setting_service_equal.pb.go b/backend/generated-go/v1/setting_service_equal.pb.goindex a96ec6e0de..d87de87740 100644--- a/backend/generated-go/v1/setting_service_equal.pb.go+++ b/backend/generated-go/v1/setting_service_equal.pb.go@@ -137,6 +137,9 @@ func (x *SettingValue) Equal(y *SettingValue) bool {if !x.GetEmail().Equal(y.GetEmail()) {return false}+ if !x.GetMcp().Equal(y.GetMcp()) {+ return false+ }return true}@@ -403,10 +406,23 @@ func (x *WorkspaceProfileSetting) Equal(y *WorkspaceProfileSetting) bool {if p, q := x.MaximumRoleExpiration, y.MaximumRoleExpiration; (p == nil && q != nil) || (p != nil && (q == nil || p.Seconds != q.Seconds || p.Nanos != q.Nanos)) {return false}- if x.McpCapability != y.McpCapability {+ if x.DirectorySyncTokenConfigured != y.DirectorySyncTokenConfigured {return false}- if x.DirectorySyncTokenConfigured != y.DirectorySyncTokenConfigured {+ return true+}++func (x *MCPSetting) Equal(y *MCPSetting) bool {+ if x == y {+ return true+ }+ if x == nil || y == nil {+ return x == nil && y == nil+ }+ if x.Capability != y.Capability {+ return false+ }+ if x.IgnoreMaskingExemptions != y.IgnoreMaskingExemptions {return false}return truediff --git a/backend/store/setting.go b/backend/store/setting.goindex ac0c1a5b21..61675bf865 100644--- a/backend/store/setting.go+++ b/backend/store/setting.go@@ -4,7 +4,9 @@ import ("context""database/sql""encoding/json"+ "log/slog""math"+ "slices""time""github.com/pkg/errors"@@ -43,6 +45,8 @@ func getSettingMessage(name storepb.SettingName) (proto.Message, error) {return &storepb.EnvironmentSetting{}, nilcase storepb.SettingName_EMAIL:return &storepb.EmailSetting{}, nil+ case storepb.SettingName_MCP:+ return &storepb.MCPSetting{}, nildefault:return nil, errors.Errorf("unknown setting name: %v", name)}@@ -337,7 +341,12 @@ func (s *Store) ListSettings(ctx context.Context, find *FindSettingMessage) ([]*}value, ok := storepb.SettingName_value[nameString]if !ok {- return nil, errors.Errorf("invalid setting name string: %s", nameString)+ // A replica on a newer build writes setting names this enum does+ // not carry. Returning here would fail the list for every setting+ // this build does know.+ slog.Warn("skipping a setting row whose name this build does not know",+ slog.String("name", nameString), slog.String("workspace", settingMessage.Workspace))+ continue}settingMessage.Name = storepb.SettingName(value)@@ -364,6 +373,51 @@ func (s *Store) ListSettings(ctx context.Context, find *FindSettingMessage) ([]*return settingMessages, nil}+// RawSettingValue returns a setting row's stored JSON, and whether the row+// exists. Callers that must reason about what the row literally says — rather+// than what the unmarshaler could make of it — read it through this.+func (s *Store) RawSettingValue(ctx context.Context, workspace string, name storepb.SettingName) (string, bool, error) {+ q := qb.Q().Space(`+ SELECT value FROM setting WHERE workspace = ? AND name = ?+ `, workspace, name.String())+ query, args, err := q.ToSQL()+ if err != nil {+ return "", false, errors.Wrap(err, "failed to build sql")+ }+ var valueString string+ if err := s.GetDB().QueryRowContext(ctx, query, args...).Scan(&valueString); err != nil {+ if errors.Is(err, sql.ErrNoRows) {+ return "", false, nil+ }+ return "", false, errors.Wrapf(err, "failed to read the %s setting", name)+ }+ return valueString, true, nil+}++// EnsureSettingRow creates an empty row for a setting that has none, and does+// nothing when one exists. It is what lets a setting not seeded at workspace+// creation be updated under a row lock: UpdateSettingAtomic deliberately+// refuses a missing row, so the first write has to make one first.+//+// Only safe for a setting whose readers answer an empty row and an absent one+// the same way. The MCP setting does: SettingService.GetSetting returns a zero+// message for both, and GetMCPSettingsUncached resolves both to READ_WRITE.+// WorkspaceProfileSetting does not — an absent row is an error there.+func (s *Store) EnsureSettingRow(ctx context.Context, workspace string, name storepb.SettingName) error {+ q := qb.Q().Space(`+ INSERT INTO setting (name, workspace, value) VALUES (?, ?, '{}')+ ON CONFLICT (name, workspace) DO NOTHING+ `, name.String(), workspace)+ query, args, err := q.ToSQL()+ if err != nil {+ return errors.Wrap(err, "failed to build sql")+ }+ if _, err := s.GetDB().ExecContext(ctx, query, args...); err != nil {+ return errors.Wrapf(err, "failed to create setting %s", name)+ }+ return nil+}+// UpdateSettingAtomic performs a row-locking read-modify-write of a setting:// the current value is read under SELECT ... FOR UPDATE, apply transforms it,// and the result is written back in the same transaction — so a concurrent@@ -379,7 +433,14 @@ func (s *Store) ListSettings(ctx context.Context, find *FindSettingMessage) ([]*// it runs while holding the transaction's pooled connection and the row// lock, and a nested read wanting a second connection is the bounded-pool// starvation cycle.-func (s *Store) UpdateSettingAtomic(ctx context.Context, workspace string, name storepb.SettingName, apply func(current proto.Message) (proto.Message, error), postCommit func(current *SettingMessage)) (*SettingMessage, error) {+//+// apply also receives the locked row's raw bytes. The unmarshaler discards what+// it cannot interpret — an enum name from a newer release, say — and marshalling+// omits a zero field, so a merge that only looked at current would write the row+// back with that value silently deleted. A caller that must not do that reads+// the raw bytes, and reads them from the locked row rather than a pre-flight, so+// there is no window for a concurrent writer to slip a value in between.+func (s *Store) UpdateSettingAtomic(ctx context.Context, workspace string, name storepb.SettingName, apply func(current proto.Message, raw []byte) (proto.Message, error), postCommit func(current *SettingMessage)) (*SettingMessage, error) {tx, err := s.GetDB().BeginTx(ctx, nil)if err != nil {return nil, errors.Wrap(err, "failed to begin transaction")@@ -408,7 +469,7 @@ func (s *Store) UpdateSettingAtomic(ctx context.Context, workspace string, namereturn nil, errors.Wrapf(err, "failed to unmarshal setting %s", name)}- next, err := apply(current)+ next, err := apply(current, []byte(valueString))if err != nil {return nil, err}@@ -553,7 +614,7 @@ func (s *Store) DeleteSetting(ctx context.Context, workspace string, name storep// ErrMCPCapabilityUnreadable marks a stored MCP capability ceiling this build// cannot interpret: an enum name it does not know, a wrong-typed value, a row-// that is not the JSON the profile expects. It is deliberately distinct from a+// that is not the JSON the setting expects. It is deliberately distinct from a// failed READ, because the two are opposite outcomes for the caller. A read// that failed is an outage and will likely succeed on retry; a value that// cannot be interpreted will never succeed until an admin rewrites it, so@@ -561,84 +622,126 @@ func (s *Store) DeleteSetting(ctx context.Context, workspace string, name storep// truth. Both refuse.var ErrMCPCapabilityUnreadable = errors.New("the stored MCP capability ceiling cannot be interpreted")-// GetMCPCapabilityUncached reads the workspace's stored MCP capability ceiling-// straight from the database, bypassing the setting cache. The cache has no TTL-// and only in-process writes refresh it, so a ceiling flipped out of band —-// direct SQL, another replica — must still bite on the next request.+// MCPSettings is the MCP setting resolved for enforcement: the effective+// ceiling, never UNSPECIFIED, and the masking toggle.+type MCPSettings struct {+ Capability storepb.MCPSetting_Capability+ // IgnoreMaskingExemptions is false when unset, so a workspace that never+ // configured MCP keeps following each user's masking provisioning.+ IgnoreMaskingExemptions bool+}++// GetMCPSettingsUncached reads the workspace's stored MCP setting straight from+// the database, bypassing the setting cache. The cache has no TTL and only+// in-process writes refresh it, so a setting flipped out of band — direct SQL,+// another replica — must still bite on the next request.//-// It reads the row's JSON rather than taking the parsed message, because the-// shared unmarshaler discards unknown fields and that is the one case a ceiling-// must not swallow. A stored `{"mcpCapability":"READ_ONLYY"}` parses to the-// unset value, which resolves to READ_WRITE below, so a typo would-// silently reopen the workspace. An unknown enum NUMBER survives protojson and-// fails closed on its own — no mode serves it — and only an unknown NAME-// disappears, so the check is the raw key's presence against the parsed field-// and nothing else about the row is read strictly. Rejecting the whole row on-// any unknown field would let one field from a newer release disable MCP-// workspace-wide.+// Both fields come off one row, so the gate cannot admit a call that a later+// enforcement point then judges under a different row.//-// The returned ceiling is the effective one, never UNSPECIFIED: a workspace-// that never set a ceiling resolves to READ_WRITE so existing workspaces are-// unaffected. Every state this cannot make sense of is an error instead, and-// every caller fails closed on one — so a caller has exactly one decision to-// take, and it is the same decision in both of them.-func (s *Store) GetMCPCapabilityUncached(ctx context.Context, workspace string) (storepb.WorkspaceProfileSetting_MCPCapability, error) {- const unset = storepb.WorkspaceProfileSetting_MCP_CAPABILITY_UNSPECIFIED- const whenUnset = storepb.WorkspaceProfileSetting_READ_WRITE-- q := qb.Q().Space(`- SELECT value FROM setting WHERE workspace = ? AND name = ?- `, workspace, storepb.SettingName_WORKSPACE_PROFILE.String())- query, args, err := q.ToSQL()+// The raw-key check exists because protojson silently discards an enum NAME it+// does not know, and the discarded value resolves to the permissive default+// below, so a stored {"capability":"READ_ONLYY"} would reopen the workspace. An+// unknown enum NUMBER survives protojson and fails closed on its own, because+// no mode serves it, so only the name case needs the raw read. Nothing else+// about the row is read strictly: rejecting it for an unknown field would let+// one field from a newer release disable MCP workspace-wide.+//+// Before this change the ceiling lived on the workspace profile as+// mcp_capability. That key is not read here and is not migrated. The shared+// unmarshaler discards unknown fields, so a profile row still carrying it is+// inert, and a workspace that set a ceiling before upgrading resolves to+// READ_WRITE until the MCP setting is saved.+//+// Deliberate: 3.21.0 and 3.21.1 served the field on the settings API, but the+// only UI sat behind isDev() (GeneralPage.tsx) and Terraform never exposed it,+// so setting a ceiling took a hand-built UpdateSetting call naming the+// field-mask path.+func (s *Store) GetMCPSettingsUncached(ctx context.Context, workspace string) (MCPSettings, error) {+ const unset = storepb.MCPSetting_CAPABILITY_UNSPECIFIED+ const whenUnset = storepb.MCPSetting_READ_WRITE+ failClosed := MCPSettings{Capability: unset}++ valueString, exists, err := s.RawSettingValue(ctx, workspace, storepb.SettingName_MCP)if err != nil {- return unset, errors.Wrap(err, "failed to build sql")+ return failClosed, err}- var valueString string- if err := s.GetDB().QueryRowContext(ctx, query, args...).Scan(&valueString); err != nil {- if errors.Is(err, sql.ErrNoRows) {- // No workspace profile row at all: the ceiling was never set.- return whenUnset, nil- }- return unset, errors.Wrap(err, "failed to read the workspace profile setting")+ if !exists {+ // No MCP setting row: this workspace never configured MCP.+ return MCPSettings{Capability: whenUnset}, nil}- profile := &storepb.WorkspaceProfileSetting{}- if err := common.ProtojsonUnmarshaler.Unmarshal([]byte(valueString), profile); err != nil {- return unset, errors.Wrapf(ErrMCPCapabilityUnreadable, "the workspace profile setting does not parse: %v", err)+ setting := &storepb.MCPSetting{}+ if err := common.ProtojsonUnmarshaler.Unmarshal([]byte(valueString), setting); err != nil {+ return failClosed, errors.Wrapf(ErrMCPCapabilityUnreadable, "the MCP setting does not parse: %v", err)}- if capability := profile.GetMcpCapability(); capability != unset {- return capability, nil+ settings := MCPSettings{+ Capability: setting.GetCapability(),+ IgnoreMaskingExemptions: setting.GetIgnoreMaskingExemptions(),+ }+ if settings.Capability != unset {+ return settings, nil}- stored, err := storedMCPCapability(valueString)+ stored, err := RawMCPCapability(valueString)if err != nil {- return unset, err+ return failClosed, err}if stored != "" {- return unset, errors.Wrapf(ErrMCPCapabilityUnreadable, "%s is not a value this build understands", stored)+ return failClosed, errors.Wrapf(ErrMCPCapabilityUnreadable, "%s is not a value this build understands", stored)}- return whenUnset, nil+ settings.Capability = whenUnset+ return settings, nil}-// storedMCPCapability returns the workspace profile row's raw mcp_capability-// value, or "" when the row carries no such key. protojson accepts both the-// JSON name and the proto field name, so a hand-written row may use either.+// UnknownSettingKeys returns the top-level keys a stored row carries that the+// given message does not define, sorted.//-// A key present alongside a parsed-unset field means the stored name is one-// this build does not know. An explicit MCP_CAPABILITY_UNSPECIFIED counts as-// that too, deliberately: protojson omits a zero enum when it writes, and the-// settings API rejects an explicit UNSPECIFIED, so no Bytebase write produces-// this key with that value — only a hand-edited row does, and there it is-// indistinguishable from a typo.-func storedMCPCapability(value string) (string, error) {+// The unmarshaler discards them, so a read is unaffected — deliberately: one+// field from a newer release must not disable a setting workspace-wide. A+// partial WRITE is the opposite case. It re-marshals what the build understood+// and the discarded keys are gone, so a merge on an older replica during a+// rolling upgrade would delete configuration a newer one wrote. A caller that+// merges rather than replaces checks this first.+func UnknownSettingKeys(raw string, m proto.Message) ([]string, error) {+ var fields map[string]json.RawMessage+ if err := json.Unmarshal([]byte(raw), &fields); err != nil {+ return nil, errors.Wrapf(err, "the setting is not a JSON object")+ }+ known := map[string]bool{}+ descriptors := m.ProtoReflect().Descriptor().Fields()+ for i := 0; i < descriptors.Len(); i++ {+ field := descriptors.Get(i)+ known[field.JSONName()] = true+ known[string(field.Name())] = true+ }+ var unknown []string+ for key := range fields {+ if !known[key] {+ unknown = append(unknown, key)+ }+ }+ slices.Sort(unknown)+ return unknown, nil+}++// RawMCPCapability returns the MCP setting row's raw capability value, or ""+// when the row carries no such key. The JSON name and the proto field name are+// both "capability", so there is one spelling to check.+//+// A key present alongside a parsed-unset field means the stored name is one this+// build does not know. An explicit CAPABILITY_UNSPECIFIED counts as that too,+// deliberately: protojson omits a zero enum when it writes, and the settings API+// rejects an explicit UNSPECIFIED, so no Bytebase write produces this key with+// that value — only a hand-edited row does, and there it is indistinguishable+// from a typo.+func RawMCPCapability(value string) (string, error) {var fields map[string]json.RawMessageif err := json.Unmarshal([]byte(value), &fields); err != nil {- return "", errors.Wrapf(ErrMCPCapabilityUnreadable, "the workspace profile setting is not a JSON object: %v", err)+ return "", errors.Wrapf(ErrMCPCapabilityUnreadable, "the MCP setting is not a JSON object: %v", err)}- for _, key := range []string{"mcpCapability", "mcp_capability"} {- if raw, ok := fields[key]; ok {- return string(raw), nil- }+ if raw, ok := fields["capability"]; ok {+ return string(raw), nil}return "", nil}diff --git a/backend/store/setting_atomic_test.go b/backend/store/setting_atomic_test.goindex a3f27d6801..d70afac74c 100644--- a/backend/store/setting_atomic_test.go+++ b/backend/store/setting_atomic_test.go@@ -78,7 +78,7 @@ func TestUpdateSettingAtomicInterleaving(t *testing.T) {firstResult := make(chan error, 1)go func() {_, err := s.UpdateSettingAtomic(ctx, "default", storepb.SettingName_WORKSPACE_PROFILE,- func(current proto.Message) (proto.Message, error) {+ func(current proto.Message, _ []byte) (proto.Message, error) {profile, ok := current.(*storepb.WorkspaceProfileSetting)if !ok {return nil, errors.Errorf("unexpected type %T", current)@@ -100,12 +100,12 @@ func TestUpdateSettingAtomicInterleaving(t *testing.T) {secondResult := make(chan error, 1)go func() {_, err := s.UpdateSettingAtomic(ctx, "default", storepb.SettingName_WORKSPACE_PROFILE,- func(current proto.Message) (proto.Message, error) {+ func(current proto.Message, _ []byte) (proto.Message, error) {profile, ok := current.(*storepb.WorkspaceProfileSetting)if !ok {return nil, errors.Errorf("unexpected type %T", current)}- profile.McpCapability = storepb.WorkspaceProfileSetting_DISABLED+ profile.Watermark = truereturn profile, nil}, nil)secondResult <- err@@ -147,14 +147,14 @@ func TestUpdateSettingAtomicInterleaving(t *testing.T) {require.NoError(t, err)freshProfile := mustProfile(t, fresh)require.True(t, freshProfile.EnableMetricCollection, "first update's field must survive")- require.Equal(t, storepb.WorkspaceProfileSetting_DISABLED, freshProfile.McpCapability,+ require.True(t, freshProfile.Watermark,"second update's field must survive")// ... and in the setting cache.cached, err := s.GetSetting(ctx, "default", storepb.SettingName_WORKSPACE_PROFILE)require.NoError(t, err)cachedProfile := mustProfile(t, cached)require.True(t, cachedProfile.EnableMetricCollection)- require.Equal(t, storepb.WorkspaceProfileSetting_DISABLED, cachedProfile.McpCapability)+ require.True(t, cachedProfile.Watermark)}// TestUpdateSettingAtomicApplyAbort pins that an error from apply aborts the@@ -165,7 +165,7 @@ func TestUpdateSettingAtomicApplyAbort(t *testing.T) {sentinel := errors.New("validation failed")_, err := s.UpdateSettingAtomic(ctx, "default", storepb.SettingName_WORKSPACE_PROFILE,- func(current proto.Message) (proto.Message, error) {+ func(current proto.Message, _ []byte) (proto.Message, error) {profile, ok := current.(*storepb.WorkspaceProfileSetting)if !ok {return nil, errors.Errorf("unexpected type %T", current)@@ -191,7 +191,7 @@ func TestUpdateSettingAtomicMissingRow(t *testing.T) {ctx, _, s := newSettingAtomicFixture(t)_, err := s.UpdateSettingAtomic(ctx, "default", storepb.SettingName_AI,- func(current proto.Message) (proto.Message, error) {+ func(current proto.Message, _ []byte) (proto.Message, error) {return current, nil}, nil)require.Error(t, err)@@ -241,7 +241,7 @@ func TestUpdateSettingAtomicPublishOrder(t *testing.T) {firstResult := make(chan error, 1)go func() {_, err := s.UpdateSettingAtomic(ctx, "default", storepb.SettingName_WORKSPACE_PROFILE,- func(current proto.Message) (proto.Message, error) {+ func(current proto.Message, _ []byte) (proto.Message, error) {profile, ok := current.(*storepb.WorkspaceProfileSetting)if !ok {return nil, errors.Errorf("unexpected type %T", current)@@ -261,12 +261,12 @@ func TestUpdateSettingAtomicPublishOrder(t *testing.T) {secondResult := make(chan error, 1)go func() {_, err := s.UpdateSettingAtomic(ctx, "default", storepb.SettingName_WORKSPACE_PROFILE,- func(current proto.Message) (proto.Message, error) {+ func(current proto.Message, _ []byte) (proto.Message, error) {profile, ok := current.(*storepb.WorkspaceProfileSetting)if !ok {return nil, errors.Errorf("unexpected type %T", current)}- profile.McpCapability = storepb.WorkspaceProfileSetting_DISABLED+ profile.Watermark = truereturn profile, nil}, recordPostCommit())secondResult <- err@@ -283,7 +283,7 @@ func TestUpdateSettingAtomicPublishOrder(t *testing.T) {return false}profile, ok := committed.Value.(*storepb.WorkspaceProfileSetting)- return ok && profile.McpCapability == storepb.WorkspaceProfileSetting_DISABLED+ return ok && profile.Watermark}, 10*time.Second, 10*time.Millisecond,"second update must commit while its publish waits on the mutex")@@ -312,7 +312,7 @@ func TestUpdateSettingAtomicPublishOrder(t *testing.T) {require.NoError(t, err)cachedProfile := mustProfile(t, cached)require.True(t, cachedProfile.EnableMetricCollection, "cache must not serve pre-first-update state")- require.Equal(t, storepb.WorkspaceProfileSetting_DISABLED, cachedProfile.McpCapability,+ require.True(t, cachedProfile.Watermark,"cache must not be overwritten by the earlier committer's stale publish")postCommitMu.Lock()defer postCommitMu.Unlock()@@ -320,7 +320,7 @@ func TestUpdateSettingAtomicPublishOrder(t *testing.T) {for _, seen := range postCommitSeen {require.True(t, seen.EnableMetricCollection,"postCommit must observe committed truth, not the caller's own write")- require.Equal(t, storepb.WorkspaceProfileSetting_DISABLED, seen.McpCapability,+ require.True(t, seen.Watermark,"postCommit must observe committed truth, not the caller's own write")}}@@ -373,7 +373,7 @@ func TestGetSettingCacheDisabledNotSerialized(t *testing.T) {writerResult := make(chan error, 1)go func() {_, err := s.UpdateSettingAtomic(ctx, "default", storepb.SettingName_WORKSPACE_PROFILE,- func(current proto.Message) (proto.Message, error) {+ func(current proto.Message, _ []byte) (proto.Message, error) {profile, ok := current.(*storepb.WorkspaceProfileSetting)if !ok {return nil, errors.Errorf("unexpected type %T", current)@@ -436,7 +436,7 @@ func TestUpdateSettingAtomicPublishSurvivesCancellation(t *testing.T) {var observed *storepb.WorkspaceProfileSetting_, err := s.UpdateSettingAtomic(updateCtx, "default", storepb.SettingName_WORKSPACE_PROFILE,- func(current proto.Message) (proto.Message, error) {+ func(current proto.Message, _ []byte) (proto.Message, error) {profile, ok := current.(*storepb.WorkspaceProfileSetting)if !ok {return nil, errors.Errorf("unexpected type %T", current)@@ -458,3 +458,36 @@ func TestUpdateSettingAtomicPublishSurvivesCancellation(t *testing.T) {require.True(t, mustProfile(t, cached).EnableMetricCollection,"the served cache must reflect the committed write despite request cancellation")}++// TestListSettingsSkipsNamesThisBuildDoesNotKnow pins that a setting row a+// newer replica wrote does not fail the list for the settings this build does+// know. SettingName is a closed enum here, so a name added in a later release+// decodes to nothing — and the unfiltered list is how the settings API serves+// every other setting, so one unreadable row must not take them all down.+func TestListSettingsSkipsNamesThisBuildDoesNotKnow(t *testing.T) {+ ctx, db, s := newSettingAtomicFixture(t)++ // Inserted by hand because the point is a name this build's enum cannot+ // produce; there is no store call that writes one.+ _, err := db.ExecContext(ctx,+ `INSERT INTO setting (name, workspace, value) VALUES ('FUTURE_SETTING', 'default', '{}')`)+ require.NoError(t, err)++ settings, err := s.ListSettings(ctx, &store.FindSettingMessage{Workspace: "default"})+ require.NoError(t, err, "one row this build cannot name must not fail the whole list")++ var names []storepb.SettingName+ for _, setting := range settings {+ names = append(names, setting.Name)+ }+ require.Contains(t, names, storepb.SettingName_WORKSPACE_PROFILE,+ "the settings this build does know still come back")+ require.NotContains(t, names, storepb.SettingName_SETTING_NAME_UNSPECIFIED,+ "the unknown row is skipped, not decoded to the zero name")++ // The filtered read is unaffected either way: it selects by name, so the+ // unknown row never reaches the loop.+ profile, err := s.GetSetting(ctx, "default", storepb.SettingName_WORKSPACE_PROFILE)+ require.NoError(t, err)+ require.NotNil(t, profile)+}diff --git a/backend/tests/mcp_capability_setting_test.go b/backend/tests/mcp_capability_setting_test.goindex 8308bbc2a5..ec7729d714 100644--- a/backend/tests/mcp_capability_setting_test.go+++ b/backend/tests/mcp_capability_setting_test.go@@ -3,6 +3,7 @@ package testsimport ("context""database/sql"+ "strings""testing""connectrpc.com/connect"@@ -13,39 +14,49 @@ import ()// setMCPCapability sets the workspace MCP capability ceiling via the settings API.-func (ctl *controller) setMCPCapability(ctx context.Context, capability v1pb.WorkspaceProfileSetting_MCPCapability) error {+func (ctl *controller) setMCPCapability(ctx context.Context, capability v1pb.MCPSetting_Capability) error {return ctl.updateMCPCapability(ctx, capability, false)}-func (ctl *controller) updateMCPCapability(ctx context.Context, capability v1pb.WorkspaceProfileSetting_MCPCapability, validateOnly bool) error {+func (ctl *controller) updateMCPCapability(ctx context.Context, capability v1pb.MCPSetting_Capability, validateOnly bool) error {_, err := ctl.settingServiceClient.UpdateSetting(ctx, connect.NewRequest(&v1pb.UpdateSettingRequest{AllowMissing: true,ValidateOnly: validateOnly,Setting: &v1pb.Setting{- Name: "settings/" + v1pb.Setting_WORKSPACE_PROFILE.String(),+ Name: "settings/" + v1pb.Setting_MCP.String(),Value: &v1pb.SettingValue{- Value: &v1pb.SettingValue_WorkspaceProfile{- WorkspaceProfile: &v1pb.WorkspaceProfileSetting{- McpCapability: capability,- },+ Value: &v1pb.SettingValue_Mcp{+ Mcp: &v1pb.MCPSetting{Capability: capability},},},},UpdateMask: &fieldmaskpb.FieldMask{- Paths: []string{"value.workspace_profile.mcp_capability"},+ Paths: []string{"value.mcp.capability"},},}))return err}-func (ctl *controller) getMCPCapability(ctx context.Context) (v1pb.WorkspaceProfileSetting_MCPCapability, error) {+func (ctl *controller) getMCPCapability(ctx context.Context) (v1pb.MCPSetting_Capability, error) {resp, err := ctl.settingServiceClient.GetSetting(ctx, connect.NewRequest(&v1pb.GetSettingRequest{- Name: "settings/" + v1pb.Setting_WORKSPACE_PROFILE.String(),+ Name: "settings/" + v1pb.Setting_MCP.String(),}))if err != nil {- return v1pb.WorkspaceProfileSetting_MCP_CAPABILITY_UNSPECIFIED, err+ return v1pb.MCPSetting_CAPABILITY_UNSPECIFIED, err}- return resp.Msg.Value.GetWorkspaceProfile().GetMcpCapability(), nil+ return resp.Msg.Value.GetMcp().GetCapability(), nil+}++// currentWorkspaceID returns the id the setting rows are keyed by. setting has+// PRIMARY KEY (workspace, name), so a raw predicate naming only the name reaches+// every workspace in the metadata database, not this test's own.+func currentWorkspaceID(ctx context.Context, t *testing.T, ctl *controller) string {+ t.Helper()+ workspace, err := ctl.workspaceServiceClient.GetWorkspace(ctx, connect.NewRequest(&v1pb.GetWorkspaceRequest{+ Name: "workspaces/-",+ }))+ require.NoError(t, err)+ return strings.TrimPrefix(workspace.Msg.Name, "workspaces/")}// TestMCPCapabilitySettingRoundTrip verifies the workspace MCP capability@@ -66,12 +77,12 @@ func TestMCPCapabilitySettingRoundTrip(t *testing.T) {// A fresh workspace has no explicit ceiling.capability, err := ctl.getMCPCapability(ctx)a.NoError(err)- a.Equal(v1pb.WorkspaceProfileSetting_MCP_CAPABILITY_UNSPECIFIED, capability)+ a.Equal(v1pb.MCPSetting_CAPABILITY_UNSPECIFIED, capability)- for _, want := range []v1pb.WorkspaceProfileSetting_MCPCapability{- v1pb.WorkspaceProfileSetting_DISABLED,- v1pb.WorkspaceProfileSetting_READ_ONLY,- v1pb.WorkspaceProfileSetting_READ_WRITE,+ for _, want := range []v1pb.MCPSetting_Capability{+ v1pb.MCPSetting_DISABLED,+ v1pb.MCPSetting_READ_ONLY,+ v1pb.MCPSetting_READ_WRITE,} {a.NoError(ctl.setMCPCapability(ctx, want), want.String())got, err := ctl.getMCPCapability(ctx)@@ -82,10 +93,10 @@ func TestMCPCapabilitySettingRoundTrip(t *testing.T) {// Explicit UNSPECIFIED and unknown enum numbers — including the reserved// number 2 (was METADATA_ONLY) — are rejected, and the stored value is left// untouched.- for _, invalid := range []v1pb.WorkspaceProfileSetting_MCPCapability{- v1pb.WorkspaceProfileSetting_MCP_CAPABILITY_UNSPECIFIED,- v1pb.WorkspaceProfileSetting_MCPCapability(2),- v1pb.WorkspaceProfileSetting_MCPCapability(99),+ for _, invalid := range []v1pb.MCPSetting_Capability{+ v1pb.MCPSetting_CAPABILITY_UNSPECIFIED,+ v1pb.MCPSetting_Capability(2),+ v1pb.MCPSetting_Capability(99),} {err = ctl.setMCPCapability(ctx, invalid)a.Error(err, invalid.String())@@ -93,47 +104,191 @@ func TestMCPCapabilitySettingRoundTrip(t *testing.T) {}got, err := ctl.getMCPCapability(ctx)a.NoError(err)- a.Equal(v1pb.WorkspaceProfileSetting_READ_WRITE, got)+ a.Equal(v1pb.MCPSetting_READ_WRITE, got)// A validate-only update must not leak into served state: the store caches- // the profile object, so an in-place mutation would flip the live /mcp gate+ // the setting object, so an in-place mutation would flip the live /mcp gate// without persisting anything.- a.NoError(ctl.setMCPCapability(ctx, v1pb.WorkspaceProfileSetting_DISABLED))- a.NoError(ctl.updateMCPCapability(ctx, v1pb.WorkspaceProfileSetting_READ_WRITE, true))+ a.NoError(ctl.setMCPCapability(ctx, v1pb.MCPSetting_DISABLED))+ a.NoError(ctl.updateMCPCapability(ctx, v1pb.MCPSetting_READ_WRITE, true))got, err = ctl.getMCPCapability(ctx)a.NoError(err)- a.Equal(v1pb.WorkspaceProfileSetting_DISABLED, got)+ a.Equal(v1pb.MCPSetting_DISABLED, got)- // Saving an unrelated profile field must not revert a ceiling written- // out-of-band (emergency SQL): the update path writes the whole profile- // back, so merging onto a stale cached base would silently clear the kill- // switch. The cache is warm from the reads above and holds DISABLED; flip- // the stored value behind the server's back, then update another field.+ // Saving the other field of the MCP setting must not revert a ceiling+ // written out-of-band (emergency SQL): the update path merges the named+ // mask paths onto the stored value and writes the whole message back, so+ // merging onto a stale cached base would silently clear the kill switch.+ // The cache is warm from the reads above and holds DISABLED; flip the+ // stored value behind the server's back, then update the other field.+ workspaceID := currentWorkspaceID(ctx, t, ctl)db, err := sql.Open("pgx", ctl.profile.PgURL)a.NoError(err)defer db.Close()_, err = db.ExecContext(ctx, `- UPDATE setting SET value = jsonb_set(value, '{mcpCapability}', '"READ_ONLY"')- WHERE name = 'WORKSPACE_PROFILE';- `)+ UPDATE setting SET value = jsonb_set(value, '{capability}', '"READ_ONLY"')+ WHERE workspace = $1 AND name = 'MCP';+ `, workspaceID)+ a.NoError(err)+ a.NoError(ctl.setIgnoreMaskingExemptions(ctx, true))+ got, err = ctl.getMCPCapability(ctx)+ a.NoError(err)+ a.Equal(v1pb.MCPSetting_READ_ONLY, got,+ "the sibling update must merge onto the stored setting, not a stale cached one")+ ignoring, err := ctl.getIgnoreMaskingExemptions(ctx)+ a.NoError(err)+ a.True(ignoring, "and the field it named must actually be written")+}++// TestMCPSettingIsPresentBeforeItIsConfigured is the answer to "does+// settings/MCP exist?" on a workspace that never touched it. Get, List and+// Update have to agree: a client that reads the resource and then cannot patch+// it with default update semantics has been told two different things.+func TestMCPSettingIsPresentBeforeItIsConfigured(t *testing.T) {+ t.Parallel()+ a := require.New(t)+ ctx := context.Background()+ ctl := &controller{}+ ctx, err := ctl.StartServerWithExternalPg(ctx)+ a.NoError(err)+ defer ctl.Close(ctx)++ got, err := ctl.settingServiceClient.GetSetting(ctx, connect.NewRequest(&v1pb.GetSettingRequest{+ Name: "settings/" + v1pb.Setting_MCP.String(),+ }))+ a.NoError(err, "an unconfigured MCP setting reads as its zero value, not 404")+ a.Equal(v1pb.MCPSetting_CAPABILITY_UNSPECIFIED, got.Msg.Value.GetMcp().GetCapability())++ list, err := ctl.settingServiceClient.ListSettings(ctx, connect.NewRequest(&v1pb.ListSettingsRequest{}))a.NoError(err)+ var listed bool+ for _, setting := range list.Msg.Settings {+ if setting.Name == "settings/"+v1pb.Setting_MCP.String() {+ listed = true+ }+ }+ a.True(listed, "a list-based client must be able to discover the setting it can read")++ // No allow_missing: the default update semantics have to work on a resource+ // the API just said exists._, err = ctl.settingServiceClient.UpdateSetting(ctx, connect.NewRequest(&v1pb.UpdateSettingRequest{- AllowMissing: true,Setting: &v1pb.Setting{- Name: "settings/" + v1pb.Setting_WORKSPACE_PROFILE.String(),- Value: &v1pb.SettingValue{- Value: &v1pb.SettingValue_WorkspaceProfile{- WorkspaceProfile: &v1pb.WorkspaceProfileSetting{EnableMetricCollection: true},- },- },- },- UpdateMask: &fieldmaskpb.FieldMask{- Paths: []string{"value.workspace_profile.enable_metric_collection"},+ Name: "settings/" + v1pb.Setting_MCP.String(),+ Value: &v1pb.SettingValue{Value: &v1pb.SettingValue_Mcp{+ Mcp: &v1pb.MCPSetting{Capability: v1pb.MCPSetting_READ_ONLY},+ }},},+ UpdateMask: &fieldmaskpb.FieldMask{Paths: []string{"value.mcp.capability"}},}))+ a.NoError(err, "reading the resource then failing to patch it is two answers to one question")++ stored, err := ctl.getMCPCapability(ctx)a.NoError(err)- got, err = ctl.getMCPCapability(ctx)+ a.Equal(v1pb.MCPSetting_READ_ONLY, stored)+}++// TestMCPUnreadableCeilingSurvivesAToggleOnlyUpdate is the write-path half of+// the fail-closed rule. GetMCPSettingsUncached refuses a stored capability this+// build cannot read; the merge would erase it, because the unmarshaler drops an+// enum name it does not know and marshalling omits the zero enum — so the row+// would come back with no capability key and the next read would resolve it to+// READ_WRITE. Saving the masking toggle would reopen MCP.+//+// Reachable on a rolling upgrade, not only from a typo: a newer replica can+// write a capability name this build has never heard of.+func TestMCPUnreadableCeilingSurvivesAToggleOnlyUpdate(t *testing.T) {+ t.Parallel()+ a := require.New(t)+ ctx := context.Background()+ ctl := &controller{}+ ctx, err := ctl.StartServerWithExternalPg(ctx)a.NoError(err)- a.Equal(v1pb.WorkspaceProfileSetting_READ_ONLY, got,- "an unrelated profile update must merge onto the stored profile, not a stale cached one")+ defer ctl.Close(ctx)++ a.NoError(ctl.setMCPCapability(ctx, v1pb.MCPSetting_DISABLED))++ workspaceID := currentWorkspaceID(ctx, t, ctl)+ db, err := sql.Open("pgx", ctl.profile.PgURL)+ a.NoError(err)+ defer db.Close()+ result, err := db.ExecContext(ctx, `+ UPDATE setting SET value = jsonb_set(value, '{capability}', '"READ_ONLYY"')+ WHERE workspace = $1 AND name = 'MCP';+ `, workspaceID)+ a.NoError(err)+ affected, err := result.RowsAffected()+ a.NoError(err)+ a.Equal(int64(1), affected, "the MCP setting row must exist for this test to mean anything")++ err = ctl.setIgnoreMaskingExemptions(ctx, true)+ a.Error(err, "saving the toggle must not erase a ceiling this build cannot read")+ a.Equal(connect.CodeFailedPrecondition, connect.CodeOf(err))+ a.Contains(err.Error(), "value.mcp.capability", "the refusal must name the way out")++ var stored string+ a.NoError(db.QueryRowContext(ctx, `+ SELECT value ->> 'capability' FROM setting+ WHERE workspace = $1 AND name = 'MCP';+ `, workspaceID).Scan(&stored))+ a.Equal("READ_ONLYY", stored, "the unreadable ceiling is still there, so enforcement still fails closed")++ // The dry run reads the same raw row the locked merge does, so it cannot+ // report success on a request the real write refuses.+ dryRun := ctl.updateMCPCapability(ctx, v1pb.MCPSetting_READ_ONLY, true)+ a.NoError(dryRun, "a dry run that repairs the capability is fine")++ // The same request that sets a capability repairs the row.+ a.NoError(ctl.setMCPCapability(ctx, v1pb.MCPSetting_READ_ONLY))+ got, err := ctl.getMCPCapability(ctx)+ a.NoError(err)+ a.Equal(v1pb.MCPSetting_READ_ONLY, got)+ a.NoError(ctl.setIgnoreMaskingExemptions(ctx, true), "and the toggle saves once the ceiling is readable")+}++// TestMCPUnknownFieldSurvivesAPartialUpdate is the mixed-version half of the+// same rule. An older replica parses the row with the shared unmarshaler, which+// discards what it cannot name, and re-marshalling writes the row back without+// it — so a partial update on the old replica would delete configuration the+// new one wrote. Reads stay lenient on purpose (one field from a newer release+// must not disable MCP); the write refuses.+func TestMCPUnknownFieldSurvivesAPartialUpdate(t *testing.T) {+ t.Parallel()+ a := require.New(t)+ ctx := context.Background()+ ctl := &controller{}+ ctx, err := ctl.StartServerWithExternalPg(ctx)+ a.NoError(err)+ defer ctl.Close(ctx)++ a.NoError(ctl.setMCPCapability(ctx, v1pb.MCPSetting_READ_ONLY))++ workspaceID := currentWorkspaceID(ctx, t, ctl)+ db, err := sql.Open("pgx", ctl.profile.PgURL)+ a.NoError(err)+ defer db.Close()+ result, err := db.ExecContext(ctx, `+ UPDATE setting SET value = jsonb_set(value, '{rulesFromANewerRelease}', '[{"x":1}]')+ WHERE workspace = $1 AND name = 'MCP';+ `, workspaceID)+ a.NoError(err)+ affected, err := result.RowsAffected()+ a.NoError(err)+ a.Equal(int64(1), affected, "the MCP setting row must exist for this test to mean anything")++ // The read is unaffected: an unknown field must not disable MCP.+ capability, err := ctl.getMCPCapability(ctx)+ a.NoError(err)+ a.Equal(v1pb.MCPSetting_READ_ONLY, capability)++ err = ctl.setIgnoreMaskingExemptions(ctx, true)+ a.Error(err, "a partial write must not delete a field a newer replica wrote")+ a.Equal(connect.CodeFailedPrecondition, connect.CodeOf(err))+ a.Contains(err.Error(), "rulesFromANewerRelease", "the refusal must name what would be lost")++ var present bool+ a.NoError(db.QueryRowContext(ctx, `+ SELECT jsonb_exists(value, 'rulesFromANewerRelease') FROM setting+ WHERE workspace = $1 AND name = 'MCP';+ `, workspaceID).Scan(&present))+ a.True(present, "and the field is still there")}diff --git a/backend/tests/mcp_forbidden_credential_mints_test.go b/backend/tests/mcp_forbidden_credential_mints_test.goindex fcca40e283..3008b2e5a7 100644--- a/backend/tests/mcp_forbidden_credential_mints_test.go+++ b/backend/tests/mcp_forbidden_credential_mints_test.go@@ -587,9 +587,9 @@ func TestMCPCannotRetargetADataSource(t *testing.T) {// TestMCPCannotRewriteItsOwnCeiling covers the one method refused for what it// governs rather than for what it hands out.//-// SettingService/UpdateSetting writes value.workspace_profile.mcp_capability,-// which IS the MCP ceiling — the workspace switch that decides whether MCP-// sessions are served at all, and at 1b-2 whether they are served read-only.+// SettingService/UpdateSetting writes value.mcp.capability, which IS the MCP+// ceiling — the workspace switch that decides whether MCP sessions are served+// at all, and at 1b-2 whether they are served read-only.// A session that can widen its own ceiling is not bounded by it, and "flip the// workspace MCP switch" stops being one of the three levers that contain a// runaway agent. The same method also keeps the stored SMTP password when@@ -614,11 +614,8 @@ func TestMCPCannotRewriteItsOwnCeiling(t *testing.T) {}))a.NoError(err)- before, err := ctl.settingServiceClient.GetSetting(ctx, connect.NewRequest(&v1pb.GetSettingRequest{- Name: "settings/WORKSPACE_PROFILE",- }))+ ceilingBefore, err := ctl.getMCPCapability(ctx)a.NoError(err)- ceilingBefore := before.Msg.GetValue().GetWorkspaceProfile().GetMcpCapability()// Seed the two settings the retarget vectors merge into. Without a stored// setting the handler answers NotFound, so an unguarded build would report@@ -659,10 +656,10 @@ func TestMCPCannotRewriteItsOwnCeiling(t *testing.T) {widened := callAPIOnSession(ctx, t, session, "SettingService/UpdateSetting", map[string]any{"setting": map[string]any{- "name": "settings/WORKSPACE_PROFILE",- "value": map[string]any{"workspaceProfile": map[string]any{"mcpCapability": "READ_WRITE"}},+ "name": "settings/MCP",+ "value": map[string]any{"mcp": map[string]any{"capability": "READ_WRITE"}},},- "updateMask": "value.workspaceProfile.mcpCapability",+ "updateMask": "value.mcp.capability",})redirected := callAPIOnSession(ctx, t, session, "SettingService/UpdateSetting", map[string]any{"setting": map[string]any{@@ -703,11 +700,9 @@ func TestMCPCannotRewriteItsOwnCeiling(t *testing.T) {"the %s denial must name the boundary, not a credential it did not hand out", name)}- after, err := ctl.settingServiceClient.GetSetting(ctx, connect.NewRequest(&v1pb.GetSettingRequest{- Name: "settings/WORKSPACE_PROFILE",- }))+ after, err := ctl.getMCPCapability(ctx)a.NoError(err)- a.Equal(ceilingBefore, after.Msg.GetValue().GetWorkspaceProfile().GetMcpCapability(),+ a.Equal(ceilingBefore, after,"the session must not have moved the ceiling that governs it")// The destinations are still ours. Reads blank the secrets themselves, so@@ -741,24 +736,12 @@ func TestMCPCannotRewriteItsOwnCeiling(t *testing.T) {// An explicit value rather than an echo of ceilingBefore, which the fixture// leaves UNSPECIFIED — validateMCPCapability rejects writing that back, so// echoing it would fail for a reason that has nothing to do with the gate.- _, err = ctl.settingServiceClient.UpdateSetting(ctx, connect.NewRequest(&v1pb.UpdateSettingRequest{- Setting: &v1pb.Setting{- Name: "settings/WORKSPACE_PROFILE",- Value: &v1pb.SettingValue{Value: &v1pb.SettingValue_WorkspaceProfile{- WorkspaceProfile: &v1pb.WorkspaceProfileSetting{- McpCapability: v1pb.WorkspaceProfileSetting_READ_ONLY,- },- }},- },- UpdateMask: &fieldmaskpb.FieldMask{Paths: []string{"value.workspace_profile.mcp_capability"}},- }))- a.NoError(err, "a normal session must still be able to write workspace settings")+ a.NoError(ctl.setMCPCapability(ctx, v1pb.MCPSetting_READ_ONLY),+ "a normal session must still be able to write workspace settings")- moved, err := ctl.settingServiceClient.GetSetting(ctx, connect.NewRequest(&v1pb.GetSettingRequest{- Name: "settings/WORKSPACE_PROFILE",- }))+ moved, err := ctl.getMCPCapability(ctx)a.NoError(err)- a.Equal(v1pb.WorkspaceProfileSetting_READ_ONLY, moved.Msg.GetValue().GetWorkspaceProfile().GetMcpCapability(),+ a.Equal(v1pb.MCPSetting_READ_ONLY, moved,"the console write must actually land — otherwise the denial above proves nothing about the gate")}diff --git a/backend/tests/mcp_masking_test.go b/backend/tests/mcp_masking_test.gonew file mode 100644index 0000000000..9079a93e8f--- /dev/null+++ b/backend/tests/mcp_masking_test.go@@ -0,0 +1,952 @@+package tests++// ignore_masking_exemptions is the workspace toggle these tests exercise: an+// MCP request stops applying the caller's own unmasking provisioning.+//+// Two separate mechanisms let a user see a real value, and the toggle has to+// suppress both, so each gets a test of its own here: the masking exemptions+// granted to them (TestMCPMaskingIgnoresTheUsersExemption) and the unmask+// carried by an access grant (TestMCPMaskingIgnoresTheAccessGrantUnmask).+// Suppressing only one would leave the other serving real values to the agent,+// and no unit test composes both — the exemption seam and SkipMasking sit on+// different sides of the masking pass.+//+// It is not a confidentiality boundary. Masking runs only where the engine+// supports it and only on classified columns, so this narrows what an agent+// reads through the paths Bytebase masks and nothing else.+//+// The other half of the claim is the console: the toggle keys on the delegated+// grant, so the same user reading the same column signed in to Bytebase is+// untouched. Every read test below asserts both paths on one fixture, because+// a mask that appeared on both would satisfy "the agent sees a mask" while+// destroying the feature.++import (+ "bytes"+ "context"+ "database/sql"+ "encoding/base64"+ "encoding/json"+ "fmt"+ "io"+ "net/http"+ "strconv"+ "strings"+ "testing"+ "time"++ "connectrpc.com/connect"+ "github.com/alexmullins/zip"+ "github.com/modelcontextprotocol/go-sdk/mcp"+ "github.com/stretchr/testify/require"+ "google.golang.org/genproto/googleapis/type/expr"+ "google.golang.org/protobuf/types/known/fieldmaskpb"+ "google.golang.org/protobuf/types/known/timestamppb"++ v1pb "github.com/bytebase/bytebase/backend/generated-go/v1"+)++const (+ // maskPlaceholder is what a full mask puts in place of a value when the+ // admin chose no substitution, and it is the whole of the masked-write+ // guard's detectable set (masker.DefaultFullMaskSubstitution). The literal+ // is written out rather than imported from the masker package: it is what+ // an agent actually reads back and what it must not write, so a test that+ // borrowed the constant would follow a drift instead of catching it.+ maskPlaceholder = "******"+ // maskedSecret is the value behind the mask, distinctive enough that an+ // assertion can say the real data reached the caller rather than only that+ // the placeholder did not.+ maskedSecret = "hunter2-in-the-clear"+ // secretQuery is the one statement every read here runs. An access grant+ // matches on the exact query text, so a second spelling of the same read+ // would need a second grant.+ secretQuery = "SELECT secret FROM employee"+)++// setIgnoreMaskingExemptions writes the workspace masking toggle through the+// settings API. There is no console control yet — the toggle card is 1b-6 — so+// this is the only way to set it today.+func (ctl *controller) setIgnoreMaskingExemptions(ctx context.Context, ignore bool) error {+ _, err := ctl.settingServiceClient.UpdateSetting(ctx, connect.NewRequest(&v1pb.UpdateSettingRequest{+ AllowMissing: true,+ Setting: &v1pb.Setting{+ Name: "settings/" + v1pb.Setting_MCP.String(),+ Value: &v1pb.SettingValue{+ Value: &v1pb.SettingValue_Mcp{+ Mcp: &v1pb.MCPSetting{IgnoreMaskingExemptions: ignore},+ },+ },+ },+ UpdateMask: &fieldmaskpb.FieldMask{+ Paths: []string{"value.mcp.ignore_masking_exemptions"},+ },+ }))+ return err+}++func (ctl *controller) getIgnoreMaskingExemptions(ctx context.Context) (bool, error) {+ resp, err := ctl.settingServiceClient.GetSetting(ctx, connect.NewRequest(&v1pb.GetSettingRequest{+ Name: "settings/" + v1pb.Setting_MCP.String(),+ }))+ if err != nil {+ return false, err+ }+ return resp.Msg.Value.GetMcp().GetIgnoreMaskingExemptions(), nil+}++// mcpMaskingFixture is one live server holding one Postgres row whose `secret`+// column carries a full-mask semantic type, reachable two ways: an open MCP+// session and the console clients on ctl. Both belong to the same principal,+// which is what makes every assertion below about the transport rather than+// about who is asking.+type mcpMaskingFixture struct {+ ctl *controller+ ctx context.Context+ // database is the full resource name, for the API; name is the short one+ // query_database resolves on.+ database string+ name string+ workspaceID string+ session *mcp.ClientSession+}++func setupMCPMaskingFixture(ctx context.Context, t *testing.T) *mcpMaskingFixture {+ t.Helper()+ a := require.New(t)+ ctl := &controller{}+ ctx, err := ctl.StartServerWithExternalPg(ctx)+ a.NoError(err)+ t.Cleanup(func() { ctl.Close(ctx) })++ workspace, err := ctl.workspaceServiceClient.GetWorkspace(ctx, connect.NewRequest(&v1pb.GetWorkspaceRequest{+ Name: "workspaces/-",+ }))+ a.NoError(err)++ // The substitution is spelled out rather than left to the default, because+ // the masked-write guard recognizes this one string: a workspace that+ // configured any other substitution is outside what the guard can detect,+ // and pinning the recognizable one is what makes the write half testable.+ _, err = ctl.settingServiceClient.UpdateSetting(ctx, connect.NewRequest(&v1pb.UpdateSettingRequest{+ AllowMissing: true,+ Setting: &v1pb.Setting{+ Name: "settings/" + v1pb.Setting_SEMANTIC_TYPES.String(),+ Value: &v1pb.SettingValue{+ Value: &v1pb.SettingValue_SemanticType{+ SemanticType: &v1pb.SemanticTypeSetting{+ Types: []*v1pb.SemanticTypeSetting_SemanticType{+ {+ Id: "default",+ Title: "Default",+ Algorithm: &v1pb.Algorithm{+ Mask: &v1pb.Algorithm_FullMask_{+ FullMask: &v1pb.Algorithm_FullMask{Substitution: maskPlaceholder},+ },+ },+ },+ },+ },+ },+ },+ },+ }))+ a.NoError(err)++ container, err := provisionPgInstance(ctx, t)+ a.NoError(err)+ instanceResp, err := ctl.instanceServiceClient.CreateInstance(ctx, connect.NewRequest(&v1pb.CreateInstanceRequest{+ InstanceId: generateRandomString("mcp-masking"),+ Instance: &v1pb.Instance{+ Title: "MCP masking",+ Engine: v1pb.Engine_POSTGRES,+ Environment: new("environments/prod"),+ Activation: true,+ DataSources: []*v1pb.DataSource{container.adminDataSource()},+ },+ }))+ a.NoError(err)++ databaseName := generateRandomString("maskdb")+ a.NoError(ctl.createDatabase(ctx, ctl.project, instanceResp.Msg, nil, databaseName, ""))+ databaseResp, err := ctl.databaseServiceClient.GetDatabase(ctx, connect.NewRequest(&v1pb.GetDatabaseRequest{+ Name: fmt.Sprintf("%s/databases/%s", instanceResp.Msg.Name, databaseName),+ }))+ a.NoError(err)++ setup, err := ctl.sheetServiceClient.CreateSheet(ctx, connect.NewRequest(&v1pb.CreateSheetRequest{+ Parent: ctl.project.Name,+ Sheet: &v1pb.Sheet{Content: fmt.Appendf(nil,+ `CREATE TABLE employee(id INT PRIMARY KEY, name TEXT, secret TEXT); INSERT INTO employee VALUES (1, 'Bytebase', '%s');`,+ maskedSecret)},+ }))+ a.NoError(err)+ a.NoError(ctl.changeDatabase(ctx, ctl.project, databaseResp.Msg, setup.Msg, false))++ // Postgres puts the table in `public`; the catalog is keyed by the schema+ // the query span resolves, so an empty schema name here would attach the+ // semantic type to nothing and every mask assertion below would be vacuous.+ _, err = ctl.databaseCatalogServiceClient.UpdateDatabaseCatalog(ctx, connect.NewRequest(&v1pb.UpdateDatabaseCatalogRequest{+ Catalog: &v1pb.DatabaseCatalog{+ Name: fmt.Sprintf("%s/catalog", databaseResp.Msg.Name),+ Schemas: []*v1pb.SchemaCatalog{+ {+ Name: "public",+ Tables: []*v1pb.TableCatalog{+ {+ Name: "employee",+ Kind: &v1pb.TableCatalog_Columns_{+ Columns: &v1pb.TableCatalog_Columns{+ Columns: []*v1pb.ColumnCatalog{+ {Name: "secret", SemanticType: "default"},+ },+ },+ },+ },+ },+ },+ },+ },+ }))+ a.NoError(err)++ // READ_WRITE rather than READ_ONLY: the toggle's write half — the+ // masked-write guard — sits on methods a read-only ceiling already refuses+ // for a different reason, and a read is served under either ceiling.+ a.NoError(ctl.setMCPCapability(ctx, v1pb.MCPSetting_READ_WRITE))+ token, _ := mintMCPOAuthToken(t, ctl, ctl.authInterceptor.token)+ session := openMCPSession(ctx, t, ctl, token)+ t.Cleanup(func() { session.Close() })++ f := &mcpMaskingFixture{+ ctl: ctl,+ ctx: ctx,+ database: databaseResp.Msg.Name,+ name: databaseName,+ workspaceID: strings.TrimPrefix(workspace.Msg.Name, "workspaces/"),+ session: session,+ }++ // The precondition every later assertion rests on. With nothing granted to+ // anybody the column is masked on both paths, so a test that expects a mask+ // is testing the toggle rather than a fixture where the semantic type never+ // attached.+ a.Equal(maskPlaceholder, f.consoleReadsSecret(t),+ "precondition: the semantic type must actually mask the column")+ a.Equal(maskPlaceholder, f.agentReadsSecret(t, session),+ "precondition: and mask it over MCP too")+ return f+}++// consoleReadsSecret is the human path: a person signed in to Bytebase running+// the same statement the agent runs. It carries no delegated grant, which is+// the only thing the toggle keys on.+func (f *mcpMaskingFixture) consoleReadsSecret(t *testing.T) string {+ t.Helper()+ resp, err := f.ctl.sqlServiceClient.Query(f.ctx, connect.NewRequest(&v1pb.QueryRequest{+ Name: f.database,+ Statement: secretQuery,+ }))+ require.NoError(t, err)+ require.Len(t, resp.Msg.Results, 1)+ require.Empty(t, resp.Msg.Results[0].Error)+ require.Len(t, resp.Msg.Results[0].Rows, 1)+ require.Len(t, resp.Msg.Results[0].Rows[0].Values, 1)+ return resp.Msg.Results[0].Rows[0].Values[0].GetStringValue()+}++// agentReadsSecret is the same read through query_database, the tool an agent+// actually reaches for.+func (f *mcpMaskingFixture) agentReadsSecret(t *testing.T, session *mcp.ClientSession) string {+ t.Helper()+ read := queryDatabaseOnSession(f.ctx, t, session, f.name, secretQuery)+ require.False(t, read.isError, "the agent's read must be served, or nothing was masked: %s", read.text)+ require.Len(t, read.output.Rows, 1)+ require.Len(t, read.output.Rows[0], 1)+ value, ok := read.output.Rows[0][0].(string)+ require.True(t, ok, "a TEXT column reaches the agent as a string, masked or not: %v", read.output.Rows[0][0])+ return value+}++// exemptFromMasking grants member a masking exemption over the whole project.+// An empty condition means every database with no expiration, which keeps the+// exemption out of the way of what is under test: whether the toggle suppresses+// it, not whether its CEL matched.+func (f *mcpMaskingFixture) exemptFromMasking(t *testing.T, member string) {+ t.Helper()+ _, err := f.ctl.orgPolicyServiceClient.CreatePolicy(f.ctx, connect.NewRequest(&v1pb.CreatePolicyRequest{+ Parent: f.ctl.project.Name,+ Policy: &v1pb.Policy{+ Type: v1pb.PolicyType_MASKING_EXEMPTION,+ Policy: &v1pb.Policy_MaskingExemptionPolicy{+ MaskingExemptionPolicy: &v1pb.MaskingExemptionPolicy{+ Exemptions: []*v1pb.MaskingExemptionPolicy_Exemption{+ {Members: []string{member}, Condition: &expr.Expr{}},+ },+ },+ },+ },+ }))+ require.NoError(t, err)+}++// grantUnmask creates and activates an access grant that unmasks exactly+// secretQuery on the fixture's database.+//+// This is the second mechanism the toggle suppresses, and it reaches masking+// through a different door from an exemption: it turns the whole masking pass+// off at the query context (db.QueryContext.SkipMasking) rather than filtering+// the caller's exemptions inside it.+//+// preCheckAccess finds a grant only on an exact match of creator, trimmed query+// text, ACTIVE status and a live expire_time, so all four are pinned here+// instead of being left to the issue workflow that also activates grants.+func (f *mcpMaskingFixture) grantUnmask(t *testing.T, export bool) {+ t.Helper()+ a := require.New(t)++ // preCheckAccess returns early unless the project allows JIT access, so+ // without this the grant would exist and never be consulted.+ _, err := f.ctl.projectServiceClient.UpdateProject(f.ctx, connect.NewRequest(&v1pb.UpdateProjectRequest{+ Project: &v1pb.Project{Name: f.ctl.project.Name, AllowJustInTimeAccess: true},+ UpdateMask: &fieldmaskpb.FieldMask{Paths: []string{"allow_just_in_time_access"}},+ }))+ a.NoError(err)++ created, err := f.ctl.accessGrantServiceClient.CreateAccessGrant(f.ctx, connect.NewRequest(&v1pb.CreateAccessGrantRequest{+ Parent: f.ctl.project.Name,+ AccessGrant: &v1pb.AccessGrant{+ Creator: f.ctl.principalName,+ Targets: []string{f.database},+ Query: secretQuery,+ Reason: "masking toggle end-to-end coverage",+ Unmask: true,+ Export: export,+ Expiration: &v1pb.AccessGrant_ExpireTime{ExpireTime: timestamppb.New(time.Now().Add(time.Hour))},+ },+ }))+ a.NoError(err)++ active, err := f.ctl.accessGrantServiceClient.ActivateAccessGrant(f.ctx, connect.NewRequest(&v1pb.ActivateAccessGrantRequest{+ Name: created.Msg.Name,+ }))+ a.NoError(err)+ a.Equal(v1pb.AccessGrant_ACTIVE, active.Msg.Status)+ a.True(active.Msg.GetExpireTime().AsTime().After(time.Now()),+ "the grant has to be live, or preCheckAccess filters it out and the test proves nothing")+}++// storedMaskingToggleKey reports whether the workspace profile row carries a+// ignoreMaskingExemptions key at all.+//+// protojson omits a false bool, so "never set" and "set to false" are the same+// row. That is exactly why the resolver has to read the missing key as false+// rather than as unknown, and why the absent case is worth pinning separately+// from the explicit one.+func (f *mcpMaskingFixture) storedMaskingToggleKey(t *testing.T) bool {+ t.Helper()+ db, err := sql.Open("pgx", f.ctl.profile.PgURL)+ require.NoError(t, err)+ defer db.Close()+ var present bool+ require.NoError(t, db.QueryRowContext(f.ctx, `+ SELECT jsonb_exists(value, 'ignoreMaskingExemptions') FROM setting+ WHERE workspace = $1 AND name = 'MCP';+ `, f.workspaceID).Scan(&present))+ return present+}++// writeMaskingToggleOutOfBand flips the toggle behind the server's back. The+// setting cache has no TTL and only in-process writes refresh it, so this is+// the one state a cached read would miss — a direct SQL edit, or another+// replica's write.+func (f *mcpMaskingFixture) writeMaskingToggleOutOfBand(t *testing.T, ignore bool) {+ t.Helper()+ a := require.New(t)+ db, err := sql.Open("pgx", f.ctl.profile.PgURL)+ a.NoError(err)+ defer db.Close()+ result, err := db.ExecContext(f.ctx, `+ UPDATE setting SET value = jsonb_set(value, '{ignoreMaskingExemptions}', $2::jsonb)+ WHERE workspace = $1 AND name = 'MCP';+ `, f.workspaceID, strconv.FormatBool(ignore))+ a.NoError(err)+ affected, err := result.RowsAffected()+ a.NoError(err)+ a.Equal(int64(1), affected, "the MCP setting row must exist for the out-of-band write to mean anything")+}++// agentExportsCSV runs SQLService/Export over an MCP session. No MCP tool wraps+// Export, so call_api is the shape an agent actually reaches it in.+func (f *mcpMaskingFixture) agentExportsCSV(t *testing.T, session *mcp.ClientSession) string {+ t.Helper()+ out := callAPIOnSession(f.ctx, t, session, "SQLService/Export", map[string]any{+ "name": f.database,+ "statement": secretQuery,+ "format": "CSV",+ })+ require.Equal(t, http.StatusOK, out.Status, "the export must be served: %s", out.Error)+ var payload struct {+ Content []byte `json:"content"`+ }+ require.NoError(t, json.Unmarshal([]byte(out.RawResponse), &payload))+ return exportedCSV(t, payload.Content)+}++func (f *mcpMaskingFixture) consoleExportsCSV(t *testing.T) string {+ t.Helper()+ resp, err := f.ctl.sqlServiceClient.Export(f.ctx, connect.NewRequest(&v1pb.ExportRequest{+ Name: f.database,+ Statement: secretQuery,+ Format: v1pb.ExportFormat_CSV,+ }))+ require.NoError(t, err)+ return exportedCSV(t, resp.Msg.Content)+}++// exportedCSV returns the result entries of an export payload. An export is a+// zip carrying a .sql statement file and a .result.<format> file per statement,+// so the statement half is skipped: it echoes the SQL the caller sent and would+// match a value assertion for a reason that has nothing to do with masking.+func exportedCSV(t *testing.T, content []byte) string {+ t.Helper()+ reader, err := zip.NewReader(bytes.NewReader(content), int64(len(content)))+ require.NoError(t, err)+ var sb strings.Builder+ for _, file := range reader.File {+ if !strings.HasSuffix(file.Name, ".result.csv") {+ continue+ }+ sb.WriteString(readZipEntry(t, file))+ }+ require.NotEmpty(t, sb.String(), "the export must carry a CSV result entry")+ return sb.String()+}++func readZipEntry(t *testing.T, file *zip.File) string {+ t.Helper()+ entry, err := file.Open()+ require.NoError(t, err)+ defer entry.Close()+ body, err := io.ReadAll(entry)+ require.NoError(t, err)+ return string(body)+}++// queryValueOnSession runs SQLService/Query through call_api and returns the+// single value the statement selects.+//+// call_api rather than query_database wherever the session belongs to a+// non-admin: query_database resolves the database by listing workspace-wide+// first, so a listing denial would refuse the read for a reason that is not the+// one under test.+func queryValueOnSession(ctx context.Context, t *testing.T, session *mcp.ClientSession, database, statement string) string {+ t.Helper()+ a := require.New(t)+ out := callAPIOnSession(ctx, t, session, "SQLService/Query", map[string]any{+ "name": database,+ "statement": statement,+ })+ a.Equal(http.StatusOK, out.Status, "the read must be served: %s", out.Error)+ var payload struct {+ Results []struct {+ Error string `json:"error"`+ Rows []struct {+ Values []struct {+ StringValue string `json:"stringValue"`+ } `json:"values"`+ } `json:"rows"`+ } `json:"results"`+ }+ a.NoError(json.Unmarshal([]byte(out.RawResponse), &payload))+ a.Len(payload.Results, 1)+ a.Empty(payload.Results[0].Error)+ a.Len(payload.Results[0].Rows, 1)+ a.Len(payload.Results[0].Rows[0].Values, 1)+ return payload.Results[0].Rows[0].Values[0].StringValue+}++// changeToolResult is what an agent gets back from propose_database_change:+// the text a model reads and whether the tool reported a failure.+type changeToolResult struct {+ text string+ isError bool+}++func proposeChangeOnSession(ctx context.Context, t *testing.T, session *mcp.ClientSession, database, statement, title string) changeToolResult {+ t.Helper()+ result, err := session.CallTool(ctx, &mcp.CallToolParams{+ Name: "propose_database_change",+ Arguments: map[string]any{+ "database": database,+ "sql": statement,+ "title": title,+ },+ })+ require.NoError(t, err)+ out := changeToolResult{isError: result.IsError}+ var sb strings.Builder+ for _, content := range result.Content {+ if text, ok := content.(*mcp.TextContent); ok {+ sb.WriteString(text.Text)+ }+ }+ out.text = sb.String()+ return out+}++// sheetBody is the CreateSheet request an agent sends through call_api. Sheet+// content is bytes, so it crosses as base64 — which is also why the guard scans+// the decoded statement rather than the wire text.+func sheetBody(project, statement string) map[string]any {+ return map[string]any{+ "parent": project,+ "sheet": map[string]any{"content": base64.StdEncoding.EncodeToString([]byte(statement))},+ }+}++// TestMCPMaskingIgnoresTheUsersExemption is the headline: the toggle+// suppresses the caller's OWN masking provisioning, not merely the masking they+// were never granted an exemption from.+//+// One principal, one column, two transports. The exemption is live throughout —+// the control at the top proves it by serving the real value to both paths with+// the toggle off — so the only thing that changes between the two halves is+// which transport the request arrived on.+//+// The RED state: drop the mcpIgnoresMaskingExemptions check from+// QueryResultMasker.exemptionsForPrincipal and the agent's read goes back to+// the real value, because the exemption is filtered to this caller and passes.+func TestMCPMaskingIgnoresTheUsersExemption(t *testing.T) {+ t.Parallel()+ a := require.New(t)+ f := setupMCPMaskingFixture(context.Background(), t)++ f.exemptFromMasking(t, "user:[email protected]")++ // With the toggle off the exemption reaches both paths, so it is the+ // toggle and not the exemption that the second half turns on.+ a.NoError(f.ctl.setIgnoreMaskingExemptions(f.ctx, false))+ a.Equal(maskedSecret, f.consoleReadsSecret(t),+ "the exemption must serve the real value in the console")+ a.Equal(maskedSecret, f.agentReadsSecret(t, f.session),+ "and with the toggle off the agent inherits the same exemption")++ a.NoError(f.ctl.setIgnoreMaskingExemptions(f.ctx, true))++ a.Equal(maskedSecret, f.consoleReadsSecret(t),+ "the toggle is about what an agent may read; the console keeps the exemption")+ a.Equal(maskPlaceholder, f.agentReadsSecret(t, f.session),+ "the toggle must stop applying the exemption the caller holds")+}++// TestMCPMaskingIgnoresTheAccessGrantUnmask is the other mechanism.+// An access grant with unmask=true never reaches the exemption filter at all:+// it sets db.QueryContext.SkipMasking, which turns the whole masking pass off+// one layer earlier. So suppressing exemptions alone would leave this path+// handing the agent real values.+//+// The RED state: drop `&& !mcpIgnoresMaskingExemptions(ctx)` from the SkipMasking term in+// SQLService.Query and the agent's read under the toggle goes back to the real+// value.+func TestMCPMaskingIgnoresTheAccessGrantUnmask(t *testing.T) {+ t.Parallel()+ a := require.New(t)+ f := setupMCPMaskingFixture(context.Background(), t)++ f.grantUnmask(t, false /* export */)++ a.NoError(f.ctl.setIgnoreMaskingExemptions(f.ctx, false))+ a.Equal(maskedSecret, f.consoleReadsSecret(t), "the grant unmasks in the console")+ a.Equal(maskedSecret, f.agentReadsSecret(t, f.session),+ "and with the toggle off the same grant unmasks over MCP")++ a.NoError(f.ctl.setIgnoreMaskingExemptions(f.ctx, true))++ a.Equal(maskedSecret, f.consoleReadsSecret(t),+ "the human's grant is untouched — the toggle did not revoke it")+ a.Equal(maskPlaceholder, f.agentReadsSecret(t, f.session),+ "the toggle must stop applying the unmask an access grant carries")+}++// TestMCPMaskingIgnoresExemptionsOnExport covers the second way data leaves the+// product. Export is a WRITE method, so a READ_WRITE MCP session reaches it,+// and it carries its own copy of the access-grant unmask rather than sharing+// Query's — one enforcement point per copy, which is why suppressing it in+// Query alone would leave the whole dataset exportable in the clear.+//+// The RED state: drop `&& !mcpIgnoresMaskingExemptions(ctx)` from the skipMasking term in+// SQLService.Export and the CSV under the toggle carries the real value.+func TestMCPMaskingIgnoresExemptionsOnExport(t *testing.T) {+ t.Parallel()+ a := require.New(t)+ f := setupMCPMaskingFixture(context.Background(), t)++ f.grantUnmask(t, true /* export */)++ a.NoError(f.ctl.setIgnoreMaskingExemptions(f.ctx, false))+ a.Contains(f.agentExportsCSV(t, f.session), maskedSecret,+ "with the toggle off the grant unmasks the agent's export too")++ a.NoError(f.ctl.setIgnoreMaskingExemptions(f.ctx, true))++ exported := f.agentExportsCSV(t, f.session)+ a.Contains(exported, maskPlaceholder, "an export under the toggle must carry the mask")+ a.NotContains(exported, maskedSecret, "and must not carry the value behind it")++ a.Contains(f.consoleExportsCSV(t), maskedSecret,+ "the same grant still exports in the clear for a person in the console")+}++// TestMCPMaskingToggleOffFollowsProvisioning pins the two states an existing workspace+// can be in. Absent is the one that matters on upgrade: nothing wrote the key,+// and a resolver that read the missing key as anything but false would start+// masking for every workspace that upgraded into this build.+//+// Explicit false is stored the same way — protojson omits a false bool — so the+// row is identical and the assertion is that the API round trip and the served+// behavior agree with it.+func TestMCPMaskingToggleOffFollowsProvisioning(t *testing.T) {+ t.Parallel()+ a := require.New(t)+ f := setupMCPMaskingFixture(context.Background(), t)++ f.exemptFromMasking(t, "user:[email protected]")++ a.False(f.storedMaskingToggleKey(t),+ "precondition: the fixture wrote a ceiling and nothing else, so the toggle was never set")+ stored, err := f.ctl.getIgnoreMaskingExemptions(f.ctx)+ a.NoError(err)+ a.False(stored)+ a.Equal(maskedSecret, f.consoleReadsSecret(t))+ a.Equal(maskedSecret, f.agentReadsSecret(t, f.session),+ "a workspace that never set the toggle follows each user's own provisioning")++ a.NoError(f.ctl.setIgnoreMaskingExemptions(f.ctx, false))++ a.False(f.storedMaskingToggleKey(t),+ "a false bool is stored as absence, which is why both states must resolve the same way")+ stored, err = f.ctl.getIgnoreMaskingExemptions(f.ctx)+ a.NoError(err)+ a.False(stored)+ a.Equal(maskedSecret, f.consoleReadsSecret(t))+ a.Equal(maskedSecret, f.agentReadsSecret(t, f.session),+ "an explicit false must behave exactly as absent does")+}++// TestMCPMaskingToggleSparesHumanSessions is the half of the claim that+// keeps the toggle shippable. It keys on the delegated grant a session carries,+// never on the user or on a field value, so a person signed in to the console+// is untouched whatever the workspace tells agents to ignore.+//+// The principal here is a non-admin who holds the exemption, so the console+// half cannot pass by way of some admin bypass, and the MCP half runs on the+// SAME principal to show the toggle really is on while the console read serves+// the real value.+//+// The RED state: key mcpIgnoresMaskingExemptions on anything other than the grant's+// presence — the consented scope, say, which a legacy session leaves empty —+// and either the console read starts masking or the MCP read stops.+func TestMCPMaskingToggleSparesHumanSessions(t *testing.T) {+ t.Parallel()+ a := require.New(t)+ f := setupMCPMaskingFixture(context.Background(), t)++ const readerEmail = "[email protected]"+ const readerPassword = "1024bytebase"+ reader, err := f.ctl.userServiceClient.CreateUser(f.ctx, connect.NewRequest(&v1pb.CreateUserRequest{+ User: &v1pb.User{Title: "masking reader", Email: readerEmail, Password: readerPassword},+ }))+ a.NoError(err)+ _, err = f.ctl.addMemberToWorkspaceIAM(f.ctx, reader.Msg.Workspace, "user:"+readerEmail, "roles/workspaceMember")+ a.NoError(err)++ policy, err := f.ctl.projectServiceClient.GetIamPolicy(f.ctx, connect.NewRequest(&v1pb.GetIamPolicyRequest{+ Resource: f.ctl.project.Name,+ }))+ a.NoError(err)+ policy.Msg.Bindings = append(policy.Msg.Bindings, &v1pb.Binding{+ Role: "roles/sqlEditorUser", Members: []string{"user:" + readerEmail},+ })+ _, err = f.ctl.projectServiceClient.SetIamPolicy(f.ctx, connect.NewRequest(&v1pb.SetIamPolicyRequest{+ Resource: f.ctl.project.Name,+ Policy: policy.Msg,+ }))+ a.NoError(err)++ f.exemptFromMasking(t, "user:"+readerEmail)+ a.NoError(f.ctl.setIgnoreMaskingExemptions(f.ctx, true))++ login, err := f.ctl.authServiceClient.Login(f.ctx, connect.NewRequest(&v1pb.LoginRequest{+ Email: readerEmail, Password: readerPassword,+ }))+ a.NoError(err)++ admin := f.ctl.authInterceptor.token+ f.ctl.authInterceptor.token = login.Msg.Token+ console := f.consoleReadsSecret(t)+ f.ctl.authInterceptor.token = admin+ a.Equal(maskedSecret, console,+ "a person signed in to Bytebase keeps their exemption while agents lose it")++ // The same principal one transport over, so the toggle is demonstrably on+ // rather than merely written.+ readerMCP, _ := mintMCPOAuthToken(t, f.ctl, login.Msg.Token)+ session := openMCPSession(f.ctx, t, f.ctl, readerMCP)+ defer session.Close()+ a.Equal(maskPlaceholder, queryValueOnSession(f.ctx, t, session, f.database, secretQuery),+ "the same user's agent session is held to the mask")+}++// TestMCPMaskingToggleBitesTheNextRequest is the live-state pin. The gate reads+// the MCP setting straight from the database on every request and stamps+// what it read, so an admin flipping the toggle binds the next request of a+// session that is already open: no re-consent, no reconnect, no restart.+//+// The out-of-band half is what makes the claim about the READ rather than about+// the write. An in-process UpdateSetting refreshes the setting cache, so a+// cached read would satisfy it too; a direct SQL edit is the state only an+// uncached read answers correctly.+//+// The RED state: point the gate at the cached Store.GetSetting instead of+// GetMCPSettingsUncached and the two out-of-band flips stop biting.+func TestMCPMaskingToggleBitesTheNextRequest(t *testing.T) {+ t.Parallel()+ a := require.New(t)+ f := setupMCPMaskingFixture(context.Background(), t)++ f.exemptFromMasking(t, "user:[email protected]")+ a.Equal(maskedSecret, f.agentReadsSecret(t, f.session),+ "the session starts serving the caller's exemption")++ a.NoError(f.ctl.setIgnoreMaskingExemptions(f.ctx, true))+ a.Equal(maskPlaceholder, f.agentReadsSecret(t, f.session),+ "the toggle must bite the very next request of the session already open")++ f.writeMaskingToggleOutOfBand(t, false)+ a.Equal(maskedSecret, f.agentReadsSecret(t, f.session),+ "the gate must read the row rather than the profile it cached")++ f.writeMaskingToggleOutOfBand(t, true)+ a.Equal(maskPlaceholder, f.agentReadsSecret(t, f.session),+ "live in both directions, on the unchanged session")+}++// TestMCPMaskedWriteIsRefused is the corruption the read half would otherwise+// invite: the agent reads a masked column, gets the placeholder, and writes the+// placeholder back as if it were the value. The real data is gone and nothing+// in the change looks wrong.+//+// Every door change SQL reaches the pipeline through is probed, because one+// unguarded door is the whole hole: CreateSheet is where propose_database_change+// and a hand-rolled plan both land, BatchCreateSheets is the same door in bulk,+// CreateRelease turns inline file statements into sheets without SheetService+// being called at all, and Query and Export need no proposal at all: Query is+// READ class, so every ceiling that opens a session serves it, and both+// authorize a write under this fixture's READ_WRITE ceiling.+//+// The control at the end is the JC1 pin: the guard is not the toggle's, so+// turning the toggle off still refuses. A clean statement through the same door+// is what proves the door is genuinely open — otherwise "refused" and "not+// reachable" look alike.+//+// The RED state: remove the masked-write entries from mcpRequestShapeRefusals+// and no refusal here is the guard's any more — the sheet, release and query+// rows answer 200, and the export row answers 500, because validateQueryRequest+// returns a bare *queryError that carries no connect code. Which is why each+// assertion names the placeholder and not only the status.+func TestMCPMaskedWriteIsRefused(t *testing.T) {+ t.Parallel()+ a := require.New(t)+ f := setupMCPMaskingFixture(context.Background(), t)++ a.NoError(f.ctl.setIgnoreMaskingExemptions(f.ctx, true))++ // The console needs to see the real value, or "the write never ran" is+ // unprovable: a masked read shows the placeholder whether or not the UPDATE+ // landed. The exemption is suppressed for the agent by the toggle, which is+ // the other half of this fixture.+ f.exemptFromMasking(t, "user:[email protected]")+ a.Equal(maskedSecret, f.consoleReadsSecret(t))++ maskedWrite := fmt.Sprintf("UPDATE employee SET secret = '%s' WHERE id = 1", maskPlaceholder)+ const cleanWrite = "UPDATE employee SET secret = 'rotated-by-hand' WHERE id = 1"++ refused := callAPIOnSession(f.ctx, t, f.session, "SheetService/CreateSheet",+ sheetBody(f.ctl.project.Name, maskedWrite))+ a.Equal(http.StatusForbidden, refused.Status,+ "writing the placeholder back must be refused: %s", refused.Error)+ a.Contains(refused.Error, maskPlaceholder,+ "the refusal must name the literal, or the agent cannot tell what to remove")++ served := callAPIOnSession(f.ctx, t, f.session, "SheetService/CreateSheet",+ sheetBody(f.ctl.project.Name, cleanWrite))+ a.Equal(http.StatusOK, served.Status,+ "an ordinary change under the toggle is still served: %s", served.Error)++ // The batch door refuses on one offending sheet, matching the clamp, which+ // denies a batch holding any statement it will not serve.+ batch := callAPIOnSession(f.ctx, t, f.session, "SheetService/BatchCreateSheets", map[string]any{+ "parent": f.ctl.project.Name,+ "requests": []any{+ sheetBody(f.ctl.project.Name, cleanWrite),+ sheetBody(f.ctl.project.Name, maskedWrite),+ },+ })+ a.Equal(http.StatusForbidden, batch.Status,+ "one masked sheet must refuse the whole batch: %s", batch.Error)+ a.Contains(batch.Error, maskPlaceholder)++ // The execution door. No sheet, no plan, no rollout: the statement the agent+ // just composed from a masked read goes straight at the table.+ direct := callAPIOnSession(f.ctx, t, f.session, "SQLService/Query", map[string]any{+ "name": f.database,+ "statement": maskedWrite,+ })+ a.Equal(http.StatusForbidden, direct.Status,+ "a masked write must be refused on the execution door too: %s", direct.Error)+ a.Contains(direct.Error, maskPlaceholder)+ a.Equal(maskedSecret, f.consoleReadsSecret(t),+ "and the refusal must land before the statement runs")++ // Export takes a raw statement too, and on MySQL its handler skips the+ // read-only validation — which is why it is a write door there. On this+ // Postgres fixture the validation is what would refuse it instead, so the+ // assertion below is on the message rather than on the status alone.+ exported := callAPIOnSession(f.ctx, t, f.session, "SQLService/Export", map[string]any{+ "name": f.database,+ "statement": maskedWrite,+ "format": "CSV",+ })+ a.Equal(http.StatusForbidden, exported.Status,+ "the export door carries the same statement: %s", exported.Error)+ a.Contains(exported.Error, maskPlaceholder)++ release := callAPIOnSession(f.ctx, t, f.session, "ReleaseService/CreateRelease", map[string]any{+ "parent": f.ctl.project.Name,+ "release": map[string]any{+ "type": "VERSIONED",+ "files": []any{+ map[string]any{+ "path": "1.0/V0001_rotate.sql",+ "version": "0001",+ "statement": base64.StdEncoding.EncodeToString([]byte(maskedWrite)),+ },+ },+ },+ })+ a.Equal(http.StatusForbidden, release.Status,+ "a release carrying the placeholder inline must be refused too: %s", release.Error)+ a.Contains(release.Error, maskPlaceholder,+ "the refusal must be the mask guard's, not some other precondition of CreateRelease")++ // The tool an agent actually reaches for stops at its first step, sheet+ // creation, so nothing downstream — plan, issue, rollout — is left behind.+ // It has to carry the refusal's own wording: a coaching message the primary+ // tool rewrites into generic permission advice would send the agent at a+ // permission it already holds (checkAPIResponse, tool_change.go).+ change := proposeChangeOnSession(f.ctx, t, f.session, f.name, maskedWrite, "Rotate the secret")+ a.True(change.isError, "propose_database_change must fail rather than build a plan: %s", change.text)+ a.Contains(change.text, maskPlaceholder,+ "the tool an agent actually calls must name the literal too")++ // A person in the console writes whatever they like: the guard lives on the+ // MCP chain, and a human who reads the real value has no placeholder to+ // write back by accident.+ created, err := f.ctl.sheetServiceClient.CreateSheet(f.ctx, connect.NewRequest(&v1pb.CreateSheetRequest{+ Parent: f.ctl.project.Name,+ Sheet: &v1pb.Sheet{Content: []byte(maskedWrite)},+ }))+ a.NoError(err, "the console path must be untouched by the mask guard")+ a.NotEmpty(created.Msg.Name)++ // The control. Same session, same statement; only the toggle changed — and+ // the refusal does not, because masked reads happen without the toggle.+ a.NoError(f.ctl.setIgnoreMaskingExemptions(f.ctx, false))+ stillRefused := callAPIOnSession(f.ctx, t, f.session, "SheetService/CreateSheet",+ sheetBody(f.ctl.project.Name, maskedWrite))+ a.Equal(http.StatusForbidden, stillRefused.Status,+ "the guard is not the toggle's: %s", stillRefused.Error)+ stillRefusedQuery := callAPIOnSession(f.ctx, t, f.session, "SQLService/Query", map[string]any{+ "name": f.database,+ "statement": maskedWrite,+ })+ a.Equal(http.StatusForbidden, stillRefusedQuery.Status,+ "on the execution door too: %s", stillRefusedQuery.Error)++ // And the door really is open, which "refused" alone cannot show. A clean+ // write through SQLService/Query is the only place in this PR an MCP session+ // runs DML end to end, so it is asserted on the stored value, not the status.+ const agentWrite = "UPDATE employee SET secret = 'rotated-by-agent' WHERE id = 1"+ agentRan := callAPIOnSession(f.ctx, t, f.session, "SQLService/Query", map[string]any{+ "name": f.database,+ "statement": agentWrite,+ })+ a.Equal(http.StatusOK, agentRan.Status, "the execution door is open: %s", agentRan.Error)+ f.exemptFromMasking(t, "user:[email protected]")+ a.Equal("rotated-by-agent", f.consoleReadsSecret(t),+ "the agent's write landed, so the refusals above were the guard and not a closed door")+}++// TestMCPSessionCannotFlipTheMaskingToggle closes the obvious way around the+// toggle: the agent turns it off first. UpdateSetting is FORBIDDEN to MCP+// sessions, so the refusal comes from the class gate ahead of the handler+// rather than from the caller's RBAC — and the principal here is a workspace+// admin, who would otherwise be allowed to write exactly this setting.+//+// The stored value is the load-bearing half: a guard that refused after the+// write would leave the workspace unprotected while reporting a denial.+func TestMCPSessionCannotFlipTheMaskingToggle(t *testing.T) {+ t.Parallel()+ a := require.New(t)+ ctx := context.Background()+ ctl := &controller{}+ ctx, err := ctl.StartServerWithExternalPg(ctx)+ a.NoError(err)+ defer ctl.Close(ctx)++ workspace, err := ctl.workspaceServiceClient.GetWorkspace(ctx, connect.NewRequest(&v1pb.GetWorkspaceRequest{+ Name: "workspaces/-",+ }))+ a.NoError(err)++ a.NoError(ctl.setMCPCapability(ctx, v1pb.MCPSetting_READ_WRITE))+ a.NoError(ctl.setIgnoreMaskingExemptions(ctx, true))++ token, _ := mintMCPOAuthToken(t, ctl, ctl.authInterceptor.token)+ session := openMCPSession(ctx, t, ctl, token)+ defer session.Close()++ out := callAPIOnSession(ctx, t, session, "SettingService/UpdateSetting", map[string]any{+ "allowMissing": true,+ "setting": map[string]any{+ "name": "settings/" + v1pb.Setting_MCP.String(),+ "value": map[string]any{+ "mcp": map[string]any{"ignoreMaskingExemptions": false},+ },+ },+ // A FieldMask crossing as JSON carries lowerCamel path segments; the+ // snake_case spelling the Go clients use is rejected before any+ // interceptor sees the request.+ "updateMask": "value.mcp.ignoreMaskingExemptions",+ })+ t.Logf("MCP UpdateSetting{ignore_masking_exemptions} → status=%d error=%q", out.Status, out.Error)++ a.Equal(http.StatusForbidden, out.Status,+ "an MCP session must not be able to rewrite the workspace settings")+ a.Contains(out.Error, "not available to MCP sessions",+ "the refusal must come from the FORBIDDEN gate, not from a permission check")++ stored, err := ctl.getIgnoreMaskingExemptions(ctx)+ a.NoError(err)+ a.True(stored, "the refusal must land before the write: the toggle is still on")++ // The operator's view. A gate denial runs before ACL, so it carries no+ // resource and its row is parented to the caller's workspace.+ rows := deniedMCPRows(ctx, t, ctl, workspace.Msg.Name, "/bytebase.v1.SettingService/UpdateSetting")+ a.NotEmpty(rows, "a denied settings write must be visible to an operator with MCP provenance")+ a.Equal(int32(connect.CodePermissionDenied), rows[0].Status.GetCode(),+ "the row must record the denial, not a success")+ a.NotEmpty(rows[0].McpDelegation.GetCorrelationId(),+ "the denial must be correlatable back to the agent session that made it")+}diff --git a/backend/tests/mcp_migration_matrix_test.go b/backend/tests/mcp_migration_matrix_test.goindex 0465fcb7a1..ae8b279cce 100644--- a/backend/tests/mcp_migration_matrix_test.go+++ b/backend/tests/mcp_migration_matrix_test.go@@ -293,6 +293,11 @@ func TestMCPMigrationCeilingLookupFailureFailsClosed(t *testing.T) {a.NoError(err)workspaceID := strings.TrimPrefix(workspace.Msg.Name, "workspaces/")+ // Seeded so the row exists to corrupt: an absent MCP setting is the+ // never-configured state, which resolves READ_WRITE without a row to write+ // a wrong-typed value into.+ a.NoError(ctl.setMCPCapability(ctx, v1pb.MCPSetting_READ_WRITE))+mcpToken, _ := mintMCPOAuthToken(t, ctl, ctl.authInterceptor.token)status, body := postMCP(t, ctl, mcpToken)@@ -303,16 +308,15 @@ func TestMCPMigrationCeilingLookupFailureFailsClosed(t *testing.T) {a.NoError(err)defer db.Close()- // The stored ceiling is given a value the profile cannot be parsed with, so- // the read errors outright. That is a distinct arm from an unrecognized+ // The stored ceiling is given a value the MCP setting cannot be parsed with,+ // so the read errors outright. That is a distinct arm from an unrecognized// enum NAME, which the store's unmarshaler discards: a name it does not- // know is caught by the raw-key check in GetMCPCapabilityUncached and also+ // know is caught by the raw-key check in GetMCPSettingsUncached and also// fails closed, and TestMCPCeilingStoredValueFailsClosed// (backend/api/mcp) owns that case. This one is the unmarshal error itself.restore := func() {result, err := db.ExecContext(ctx, `- UPDATE setting SET value = value - 'mcpCapability'- WHERE workspace = $1 AND name = 'WORKSPACE_PROFILE';+ DELETE FROM setting WHERE workspace = $1 AND name = 'MCP';`, workspaceID)a.NoError(err)affected, err := result.RowsAffected()@@ -320,12 +324,12 @@ func TestMCPMigrationCeilingLookupFailureFailsClosed(t *testing.T) {a.Equal(int64(1), affected, "the corrupted policy row must be restored")}result, err := db.ExecContext(ctx, `- UPDATE setting SET value = jsonb_set(value, '{mcpCapability}', 'true')- WHERE workspace = $1 AND name = 'WORKSPACE_PROFILE';+ UPDATE setting SET value = jsonb_set(value, '{capability}', 'true')+ WHERE workspace = $1 AND name = 'MCP';`, workspaceID)a.NoError(err)// Registered before the assertions below so a failing one cannot leave the- // server running on an unreadable profile through teardown, burying the+ // server running on an unreadable MCP setting through teardown, burying the// real failure under unrelated errors.restored := falset.Cleanup(func() {@@ -382,7 +386,7 @@ func TestMCPMigrationTightenedCeilingBitesLiveSession(t *testing.T) {"the session is live under the default ceiling")// An admin tightens the ceiling while the session stays open.- a.NoError(ctl.setMCPCapability(ctx, v1pb.WorkspaceProfileSetting_DISABLED))+ a.NoError(ctl.setMCPCapability(ctx, v1pb.MCPSetting_DISABLED))status, body := postMCP(t, ctl, mcpToken)a.Equal(http.StatusForbidden, status,@@ -401,7 +405,7 @@ func TestMCPMigrationTightenedCeilingBitesLiveSession(t *testing.T) {// Widening again admits a new session, so the refusal was the ceiling// rather than damage to the session or the grant.- a.NoError(ctl.setMCPCapability(ctx, v1pb.WorkspaceProfileSetting_READ_WRITE))+ a.NoError(ctl.setMCPCapability(ctx, v1pb.MCPSetting_READ_WRITE))restored := openMCPSession(ctx, t, ctl, mcpToken)defer restored.Close()a.Equal(http.StatusOK, callAPIStatus(ctx, t, restored, "WorkspaceService/ListWorkspaces", nil))diff --git a/backend/tests/mcp_sql_clamp_test.go b/backend/tests/mcp_sql_clamp_test.goindex 38c63d63e3..86b74d3ae4 100644--- a/backend/tests/mcp_sql_clamp_test.go+++ b/backend/tests/mcp_sql_clamp_test.go@@ -116,7 +116,7 @@ func setupMCPClampFixture(ctx context.Context, t *testing.T) *mcpClampFixture {a.NoError(err)a.NoError(ctl.changeDatabase(ctx, ctl.project, databaseResp.Msg, setup.Msg, false))- a.NoError(ctl.setMCPCapability(ctx, v1pb.WorkspaceProfileSetting_READ_ONLY))+ a.NoError(ctl.setMCPCapability(ctx, v1pb.MCPSetting_READ_ONLY))token, _ := mintMCPOAuthToken(t, ctl, ctl.authInterceptor.token)session := openMCPSession(ctx, t, ctl, token)t.Cleanup(func() { session.Close() })@@ -224,7 +224,7 @@ func TestMCPReadOnlyCeilingRefusesAWrite(t *testing.T) {// after the widening, because a ceiling is read per request and this test// is about the ceiling rather than about session lifetime —// TestMCPReadOnlyTighteningBitesAnOpenSession covers the live-session half.- a.NoError(f.ctl.setMCPCapability(f.ctx, v1pb.WorkspaceProfileSetting_READ_WRITE))+ a.NoError(f.ctl.setMCPCapability(f.ctx, v1pb.MCPSetting_READ_WRITE))widened := openMCPSession(f.ctx, t, f.ctl, f.token)defer widened.Close()allowed := queryDatabaseOnSession(f.ctx, t, widened, f.name,@@ -359,7 +359,7 @@ func TestMCPReadOnlyTighteningBitesAnOpenSession(t *testing.T) {f := setupMCPClampFixture(context.Background(), t)// Start read-write, on a session opened under that ceiling.- a.NoError(f.ctl.setMCPCapability(f.ctx, v1pb.WorkspaceProfileSetting_READ_WRITE))+ a.NoError(f.ctl.setMCPCapability(f.ctx, v1pb.MCPSetting_READ_WRITE))session := openMCPSession(f.ctx, t, f.ctl, f.token)defer session.Close()wrote := queryDatabaseOnSession(f.ctx, t, session, f.name,@@ -368,7 +368,7 @@ func TestMCPReadOnlyTighteningBitesAnOpenSession(t *testing.T) {a.Equal(2, f.employeeCount(t))// An admin tightens the ceiling while the session stays open.- a.NoError(f.ctl.setMCPCapability(f.ctx, v1pb.WorkspaceProfileSetting_READ_ONLY))+ a.NoError(f.ctl.setMCPCapability(f.ctx, v1pb.MCPSetting_READ_ONLY))refused := queryDatabaseOnSession(f.ctx, t, session, f.name,"INSERT INTO employee VALUES (6, 'agent')")@@ -382,7 +382,7 @@ func TestMCPReadOnlyTighteningBitesAnOpenSession(t *testing.T) {a.False(read.isError, "a read must still be served on the tightened session: %s", read.text)// Widening bites the same way, on the same session.- a.NoError(f.ctl.setMCPCapability(f.ctx, v1pb.WorkspaceProfileSetting_READ_WRITE))+ a.NoError(f.ctl.setMCPCapability(f.ctx, v1pb.MCPSetting_READ_WRITE))again := queryDatabaseOnSession(f.ctx, t, session, f.name,"INSERT INTO employee VALUES (7, 'agent')")a.False(again.isError, "widening restores the write on the unchanged session: %s", again.text)@@ -445,7 +445,7 @@ func TestMCPCutoverAdmitsReadOnlyAndNothingElse(t *testing.T) {token, _ := mintMCPOAuthToken(t, ctl, ctl.authInterceptor.token)- a.NoError(ctl.setMCPCapability(ctx, v1pb.WorkspaceProfileSetting_READ_ONLY))+ a.NoError(ctl.setMCPCapability(ctx, v1pb.MCPSetting_READ_ONLY))status, body := postMCP(t, ctl, token)a.Equal(http.StatusOK, status, "READ_ONLY must admit a connection now that the clamp holds it to reads; %s", body)@@ -464,10 +464,16 @@ func TestMCPCutoverAdmitsReadOnlyAndNothingElse(t *testing.T) {a.Contains(sheet.Error, "raise the MCP ceiling")// DISABLED is still the ceiling that closes the door.- a.NoError(ctl.setMCPCapability(ctx, v1pb.WorkspaceProfileSetting_DISABLED))+ a.NoError(ctl.setMCPCapability(ctx, v1pb.MCPSetting_DISABLED))status, body = postMCP(t, ctl, token)a.Equal(http.StatusForbidden, status, "DISABLED must still refuse the connection; %s", body)+ // Back to a ceiling that admits, so each hand-written value below is what+ // refuses rather than the DISABLED left over from the assertion above.+ a.NoError(ctl.setMCPCapability(ctx, v1pb.MCPSetting_READ_ONLY))+ status, body = postMCP(t, ctl, token)+ a.Equal(http.StatusOK, status, "control: READ_ONLY admits again; %s", body)+// And so is every value this build cannot serve. The settings API refuses// to write these, so they are written the only way a workspace could// actually hold one: by hand.@@ -481,16 +487,16 @@ func TestMCPCutoverAdmitsReadOnlyAndNothingElse(t *testing.T) {{`2`, "the reserved number was METADATA_ONLY; no mode serves it"},{`99`, "a number no build ever wrote"},{`"READ_WRTIE"`, "a mistyped ceiling is not a ceiling that permits"},- {`"MCP_CAPABILITY_UNSPECIFIED"`, "the zero value was resolved by nobody"},+ {`"CAPABILITY_UNSPECIFIED"`, "the zero value was resolved by nobody"},} {result, err := db.ExecContext(ctx, `- UPDATE setting SET value = jsonb_set(value, '{mcpCapability}', $2::jsonb)- WHERE workspace = $1 AND name = 'WORKSPACE_PROFILE';+ UPDATE setting SET value = jsonb_set(value, '{capability}', $2::jsonb)+ WHERE workspace = $1 AND name = 'MCP';`, workspaceID, row.value)a.NoError(err)affected, err := result.RowsAffected()a.NoError(err)- a.Equal(int64(1), affected, "the workspace profile row must exist for %s to mean anything", row.value)+ a.Equal(int64(1), affected, "the MCP setting row must exist for %s to mean anything", row.value)status, body = postMCP(t, ctl, token)a.Equal(http.StatusForbidden, status, "%s: %s; %s", row.value, row.why, body)diff --git a/frontend/src/routes/workspace/general/MCPSection.test.ts b/frontend/src/routes/workspace/general/MCPSection.test.tsindex 2498e33d54..580fe3bd8e 100644--- a/frontend/src/routes/workspace/general/MCPSection.test.ts+++ b/frontend/src/routes/workspace/general/MCPSection.test.ts@@ -1,13 +1,13 @@import { describe, expect, test } from "vitest";-import { WorkspaceProfileSetting_MCPCapability } from "@/types/proto-es/v1/setting_service_pb";-import { normalizeCapability } from "./MCPSection";+import { MCPSetting_Capability } from "@/types/proto-es/v1/setting_service_pb";+import { hydrateWhilePristine, normalizeCapability } from "./MCPSection";-const { MCP_CAPABILITY_UNSPECIFIED, DISABLED, READ_ONLY, READ_WRITE } =- WorkspaceProfileSetting_MCPCapability;+const { CAPABILITY_UNSPECIFIED, DISABLED, READ_ONLY, READ_WRITE } =+ MCPSetting_Capability;describe("normalizeCapability", () => {test("unset renders as Read-write (server resolves absent to READ_WRITE)", () => {- expect(normalizeCapability(MCP_CAPABILITY_UNSPECIFIED)).toBe(READ_WRITE);+ expect(normalizeCapability(CAPABILITY_UNSPECIFIED)).toBe(READ_WRITE);});test("known values render as themselves", () => {@@ -18,11 +18,34 @@ describe("normalizeCapability", () => {test("unknown and reserved stored values render as Disabled (matching the /mcp fail-closed gate)", () => {// 2 is the reserved number (was METADATA_ONLY); 99 is any unknown value.- expect(- normalizeCapability(2 as WorkspaceProfileSetting_MCPCapability)- ).toBe(DISABLED);- expect(- normalizeCapability(99 as WorkspaceProfileSetting_MCPCapability)- ).toBe(DISABLED);+ expect(normalizeCapability(2 as MCPSetting_Capability)).toBe(DISABLED);+ expect(normalizeCapability(99 as MCPSetting_Capability)).toBe(DISABLED);+ });+});++describe("hydrateWhilePristine", () => {+ const readWrite = { mcpCapability: MCPSetting_Capability.READ_WRITE };+ const readOnly = { mcpCapability: MCPSetting_Capability.READ_ONLY };+ const disabled = { mcpCapability: MCPSetting_Capability.DISABLED };++ test("takes the fetched value when the admin has not touched the form", () => {+ expect(hydrateWhilePristine(readWrite, readWrite, disabled)).toEqual(+ disabled+ );+ });++ test("keeps an edit the admin made before the fetch landed", () => {+ // Rendered with the placeholder, admin picked READ_ONLY, then DISABLED+ // arrived from the server. Overwriting here loses the edit and clears the+ // dirty footer with it.+ expect(hydrateWhilePristine(readOnly, readWrite, disabled)).toEqual(+ readOnly+ );+ });++ test("is a no-op when the edit already matches what arrived", () => {+ expect(hydrateWhilePristine(disabled, readWrite, disabled)).toEqual(+ disabled+ );});});diff --git a/frontend/src/routes/workspace/general/MCPSection.tsx b/frontend/src/routes/workspace/general/MCPSection.tsxindex 536b82e746..ee8e6f3721 100644--- a/frontend/src/routes/workspace/general/MCPSection.tsx+++ b/frontend/src/routes/workspace/general/MCPSection.tsx@@ -6,6 +6,8 @@ import {useCallback,useEffect,useImperativeHandle,+ useMemo,+ useRef,useState,} from "react";import { useTranslation } from "react-i18next";@@ -16,7 +18,12 @@ import {import { FormField, FormFieldGroup, FormSection } from "@/components/ui/form";import { RadioGroup, RadioGroupItem } from "@/components/ui/radio-group";import { useAppStore } from "@/stores/app";-import { WorkspaceProfileSetting_MCPCapability } from "@/types/proto-es/v1/setting_service_pb";+import {+ MCPSetting_Capability,+ MCPSettingSchema,+ Setting_SettingName,+ SettingValueSchema,+} from "@/types/proto-es/v1/setting_service_pb";import type { SectionHandle } from "./useSettingSection";interface MCPSectionProps {@@ -24,46 +31,99 @@ interface MCPSectionProps {onDirtyChange: () => void;}-interface LocalState {- mcpCapability: WorkspaceProfileSetting_MCPCapability;+export interface LocalState {+ mcpCapability: MCPSetting_Capability;}// Unset resolves to READ_WRITE server-side, so it renders as Read-write.-// Unknown or reserved stored values fail closed at /mcp, so they render as+// Unknown or reserved capability numbers fail closed at /mcp, so they render as// Disabled — the option matching their actual behavior; selecting Read-only-// or Read-write then persists a valid value.+// or Read-write then persists a valid value. A stored capability name this+// build does not know never reaches that arm: protojson discards it, so it+// arrives as unset and renders Read-write while /mcp fails closed (BOT-100).export const normalizeCapability = (- capability: WorkspaceProfileSetting_MCPCapability-): WorkspaceProfileSetting_MCPCapability => {+ capability: MCPSetting_Capability+): MCPSetting_Capability => {switch (capability) {- case WorkspaceProfileSetting_MCPCapability.MCP_CAPABILITY_UNSPECIFIED:- case WorkspaceProfileSetting_MCPCapability.READ_WRITE:- return WorkspaceProfileSetting_MCPCapability.READ_WRITE;- case WorkspaceProfileSetting_MCPCapability.DISABLED:- case WorkspaceProfileSetting_MCPCapability.READ_ONLY:+ case MCPSetting_Capability.CAPABILITY_UNSPECIFIED:+ case MCPSetting_Capability.READ_WRITE:+ return MCPSetting_Capability.READ_WRITE;+ case MCPSetting_Capability.DISABLED:+ case MCPSetting_Capability.READ_ONLY:return capability;default:- return WorkspaceProfileSetting_MCPCapability.DISABLED;+ return MCPSetting_Capability.DISABLED;}};+/**+ * Re-hydration rule for the form. The store value arrives after the first+ * render, so hydrating unconditionally would replace a capability the admin+ * had already picked in between — and clear the dirty footer that is their+ * only way to save it. `hydratedFrom` is what the form was last hydrated to,+ * so "unedited" is a comparison against that rather than against the value+ * just fetched.+ */+export const hydrateWhilePristine = (+ current: LocalState,+ hydratedFrom: LocalState,+ next: LocalState+): LocalState => (isEqual(current, hydratedFrom) ? next : current);+export const MCPSection = forwardRef<SectionHandle, MCPSectionProps>(function MCPSection({ title, onDirtyChange }, ref) {const { t } = useTranslation();- const [canEdit] = usePermissionCheck(["bb.settings.setWorkspaceProfile"]);+ const [canEdit] = usePermissionCheck(["bb.settings.set"]);++ const settingsByName = useAppStore((s) => s.settingsByName);+ const mcpSetting = useMemo(() => {+ const setting = useAppStore+ .getState()+ .getSettingByName(Setting_SettingName.MCP);+ if (setting?.value?.value?.case === "mcp") {+ return setting.value.value.value;+ }+ return undefined;+ }, [settingsByName]);const getInitialState = useCallback((): LocalState => ({mcpCapability: normalizeCapability(- useAppStore.getState().getWorkspaceProfile().mcpCapability+ mcpSetting?.capability ?? MCPSetting_Capability.CAPABILITY_UNSPECIFIED),}),- []+ [mcpSetting]);const [state, setState] = useState<LocalState>(getInitialState);+ // Re-sync state when the store value changes (e.g. after the initial+ // fetch, or after a save). Only a pristine form is re-hydrated: the fetch+ // lands after the first render, so an admin who picks a capability in+ // between would otherwise have it replaced by the fetched value — and the+ // dirty footer that is their only way to save it would clear with it.+ const prevMcpSettingRef = useRef(mcpSetting);+ const hydratedRef = useRef<LocalState>(state);+ useEffect(() => {+ if (prevMcpSettingRef.current === mcpSetting) {+ return;+ }+ prevMcpSettingRef.current = mcpSetting;+ const hydrated = getInitialState();+ setState((current) =>+ hydrateWhilePristine(current, hydratedRef.current, hydrated)+ );+ hydratedRef.current = hydrated;+ }, [mcpSetting, getInitialState]);++ // Fetch setting on mount.+ useEffect(() => {+ useAppStore+ .getState()+ .getOrFetchSettingByName(Setting_SettingName.MCP, true);+ }, []);+const isDirty = useCallback(() => !isEqual(state, getInitialState()),[state, getInitialState]@@ -76,12 +136,20 @@ export const MCPSection = forwardRef<SectionHandle, MCPSectionProps>(const update = useCallback(async () => {const initState = getInitialState();if (state.mcpCapability !== initState.mcpCapability) {- await useAppStore.getState().updateWorkspaceProfile({- payload: {- mcpCapability: state.mcpCapability,- },+ // The server merges the named path onto the stored row, so+ // ignore_masking_exemptions survives a capability-only write.+ await useAppStore.getState().upsertSetting({+ name: Setting_SettingName.MCP,+ value: create(SettingValueSchema, {+ value: {+ case: "mcp",+ value: create(MCPSettingSchema, {+ capability: state.mcpCapability,+ }),+ },+ }),updateMask: create(FieldMaskSchema, {- paths: ["value.workspace_profile.mcp_capability"],+ paths: ["value.mcp.capability"],}),});}@@ -104,21 +172,21 @@ export const MCPSection = forwardRef<SectionHandle, MCPSectionProps>(const options = [{- capability: WorkspaceProfileSetting_MCPCapability.DISABLED,+ capability: MCPSetting_Capability.DISABLED,label: t("settings.general.workspace.mcp.capability.disabled.self"),description: t("settings.general.workspace.mcp.capability.disabled.description"),},{- capability: WorkspaceProfileSetting_MCPCapability.READ_ONLY,+ capability: MCPSetting_Capability.READ_ONLY,label: t("settings.general.workspace.mcp.capability.read-only.self"),description: t("settings.general.workspace.mcp.capability.read-only.description"),},{- capability: WorkspaceProfileSetting_MCPCapability.READ_WRITE,+ capability: MCPSetting_Capability.READ_WRITE,label: t("settings.general.workspace.mcp.capability.read-write.self"),description: t("settings.general.workspace.mcp.capability.read-write.description"@@ -128,10 +196,7 @@ export const MCPSection = forwardRef<SectionHandle, MCPSectionProps>(return (<FormSection id="mcp" title={title}>- <PermissionGuard- permissions={["bb.settings.setWorkspaceProfile"]}- display="block"- >+ <PermissionGuard permissions={["bb.settings.set"]} display="block"><FormFieldGroup><FormFieldtitle={t("settings.general.workspace.mcp.capability.self")}@@ -151,7 +216,7 @@ export const MCPSection = forwardRef<SectionHandle, MCPSectionProps>(<RadioGroupItemkey={option.capability}value={String(option.capability)}- disabled={!canEdit}+ disabled={!canEdit || mcpSetting === undefined}className="items-start gap-x-3"contentClassName="flex flex-col gap-1"radioClassName="mt-1"diff --git a/frontend/src/types/proto-es/v1/setting_service_pb.d.ts b/frontend/src/types/proto-es/v1/setting_service_pb.d.tsindex 0b17dd1f57..b9e127e931 100644--- a/frontend/src/types/proto-es/v1/setting_service_pb.d.ts+++ b/frontend/src/types/proto-es/v1/setting_service_pb.d.ts@@ -198,6 +198,11 @@ export enum Setting_SettingName {* @generated from enum value: EMAIL = 8;*/EMAIL = 8,++ /**+ * @generated from enum value: MCP = 9;+ */+ MCP = 9,}/**@@ -262,6 +267,12 @@ export declare type SettingValue = Message<"bytebase.v1.SettingValue"> & {*/value: EmailSetting;case: "email";+ } | {+ /**+ * @generated from field: bytebase.v1.MCPSetting mcp = 9;+ */+ value: MCPSetting;+ case: "mcp";} | { case: undefined; value?: undefined };};@@ -658,17 +669,6 @@ export declare type WorkspaceProfileSetting = Message<"bytebase.v1.WorkspaceProf*/maximumRoleExpiration?: Duration | undefined;- /**- * The maximum capability available to MCP (Model Context Protocol) sessions in- * this workspace, acting as an admin-set ceiling. Unset is treated as- * READ_WRITE for backward compatibility; DISABLED rejects all MCP- * connections. Writing MCP_CAPABILITY_UNSPECIFIED explicitly is rejected —- * omit the update mask path to leave the ceiling unset.- *- * @generated from field: bytebase.v1.WorkspaceProfileSetting.MCPCapability mcp_capability = 26;- */- mcpCapability: WorkspaceProfileSetting_MCPCapability;-/*** Whether a directory sync token has been generated for this workspace.* The token itself is never returned; this only lets the UI decide between@@ -746,18 +746,60 @@ export declare type WorkspaceProfileSetting_PasswordRestriction = Message<"bytebexport declare const WorkspaceProfileSetting_PasswordRestrictionSchema: GenMessage<WorkspaceProfileSetting_PasswordRestriction>;/**- * MCPCapability is the maximum capability an MCP (Model Context Protocol)- * session may have in the workspace. It is a ceiling: a session runs at this- * level or lower. Unset (UNSPECIFIED) is treated as READ_WRITE so existing- * workspaces are unaffected.+ * MCPSetting is what an MCP (Model Context Protocol) session may do in this+ * workspace.+ *+ * @generated from message bytebase.v1.MCPSetting+ */+export declare type MCPSetting = Message<"bytebase.v1.MCPSetting"> & {+ /**+ * The maximum capability available to MCP sessions in this workspace, acting+ * as an admin-set ceiling. Enforced server-side at three points: the /mcp+ * endpoint decides whether a connection is admitted at all, the ceiling gate+ * on the internal MCP chain decides, per request, which method classes are+ * served, and under READ_ONLY the SQL clamp decides, per statement, whether+ * it only reads.+ *+ * @generated from field: bytebase.v1.MCPSetting.Capability capability = 1;+ */+ capability: MCPSetting_Capability;++ /**+ * Whether a request that arrived over MCP stops applying the caller's own+ * unmasking provisioning. Two mechanisms let a user see a real value and this+ * suppresses both: the masking exemptions granted to them, and the unmask+ * carried by an access grant. The same user in the console is untouched.+ *+ * It cannot force masking where there is none. Masking substitutes values in+ * query results, so this does not reach data copied into a column carrying no+ * masking policy, and it does nothing on the engines Bytebase does not mask.+ * It narrows what an agent reads through the paths Bytebase masks; it is not+ * a confidentiality boundary.+ *+ * @generated from field: bool ignore_masking_exemptions = 2;+ */+ ignoreMaskingExemptions: boolean;+};++/**+ * Describes the message bytebase.v1.MCPSetting.+ * Use `create(MCPSettingSchema)` to create a new message.+ */+export declare const MCPSettingSchema: GenMessage<MCPSetting>;++/**+ * Capability is the ceiling: a session runs at this level or lower. An absent+ * MCP setting resolves to READ_WRITE, so a workspace that never configured+ * MCP is unaffected. Writing CAPABILITY_UNSPECIFIED explicitly is rejected —+ * omit the update mask path to leave the ceiling unset.*- * @generated from enum bytebase.v1.WorkspaceProfileSetting.MCPCapability+ * @generated from enum bytebase.v1.MCPSetting.Capability*/-export enum WorkspaceProfileSetting_MCPCapability {+export enum MCPSetting_Capability {/**- * @generated from enum value: MCP_CAPABILITY_UNSPECIFIED = 0;+ * @generated from enum value: CAPABILITY_UNSPECIFIED = 0;*/- MCP_CAPABILITY_UNSPECIFIED = 0,+ CAPABILITY_UNSPECIFIED = 0,/*** MCP connections are rejected.@@ -786,9 +828,9 @@ export enum WorkspaceProfileSetting_MCPCapability {}/**- * Describes the enum bytebase.v1.WorkspaceProfileSetting.MCPCapability.+ * Describes the enum bytebase.v1.MCPSetting.Capability.*/-export declare const WorkspaceProfileSetting_MCPCapabilitySchema: GenEnum<WorkspaceProfileSetting_MCPCapability>;+export declare const MCPSetting_CapabilitySchema: GenEnum<MCPSetting_Capability>;/*** @generated from message bytebase.v1.SQLEditorThemeSettingdiff --git a/frontend/src/types/proto-es/v1/setting_service_pb.js b/frontend/src/types/proto-es/v1/setting_service_pb.jsindex 9a2d052893..d9e6bbcd34 100644--- a/frontend/src/types/proto-es/v1/setting_service_pb.js+++ b/frontend/src/types/proto-es/v1/setting_service_pb.js@@ -18,7 +18,7 @@ import { file_v1_issue_service } from "./issue_service_pb";* Describes the file v1/setting_service.proto.*/export const file_v1_setting_service = /*@__PURE__*/- fileDesc("Chh2MS9zZXR0aW5nX3NlcnZpY2UucHJvdG8SC2J5dGViYXNlLnYxIhUKE0xpc3RTZXR0aW5nc1JlcXVlc3QiPgoUTGlzdFNldHRpbmdzUmVzcG9uc2USJgoIc2V0dGluZ3MYASADKAsyFC5ieXRlYmFzZS52MS5TZXR0aW5nIj8KEUdldFNldHRpbmdSZXF1ZXN0EioKBG5hbWUYASABKAlCHOBBAvpBFgoUYnl0ZWJhc2UuY29tL1NldHRpbmciOwoSR2V0U2V0dGluZ1Jlc3BvbnNlEiUKB3NldHRpbmcYASABKAsyFC5ieXRlYmFzZS52MS5TZXR0aW5nIqEBChRVcGRhdGVTZXR0aW5nUmVxdWVzdBIqCgdzZXR0aW5nGAEgASgLMhQuYnl0ZWJhc2UudjEuU2V0dGluZ0ID4EECEhUKDXZhbGlkYXRlX29ubHkYAiABKAgSFQoNYWxsb3dfbWlzc2luZxgDIAEoCBIvCgt1cGRhdGVfbWFzaxgEIAEoCzIaLmdvb2dsZS5wcm90b2J1Zi5GaWVsZE1hc2sitAIKB1NldHRpbmcSEQoEbmFtZRgBIAEoCUID4EEIEi0KBXZhbHVlGAIgASgLMhkuYnl0ZWJhc2UudjEuU2V0dGluZ1ZhbHVlQgPgQQIitwEKC1NldHRpbmdOYW1lEhwKGFNFVFRJTkdfTkFNRV9VTlNQRUNJRklFRBAAEhUKEVdPUktTUEFDRV9QUk9GSUxFEAESFgoSV09SS1NQQUNFX0FQUFJPVkFMEAISCgoGQVBQX0lNEAMSBgoCQUkQBBIXChNEQVRBX0NMQVNTSUZJQ0FUSU9OEAUSEgoOU0VNQU5USUNfVFlQRVMQBhIPCgtFTlZJUk9OTUVOVBAHEgkKBUVNQUlMEAg6LepBKgoUYnl0ZWJhc2UuY29tL1NldHRpbmcSEnNldHRpbmdzL3tzZXR0aW5nfSLYAwoMU2V0dGluZ1ZhbHVlEisKBmFwcF9pbRgBIAEoCzIZLmJ5dGViYXNlLnYxLkFwcElNU2V0dGluZ0gAEkEKEXdvcmtzcGFjZV9wcm9maWxlGAIgASgLMiQuYnl0ZWJhc2UudjEuV29ya3NwYWNlUHJvZmlsZVNldHRpbmdIABJDChJ3b3Jrc3BhY2VfYXBwcm92YWwYAyABKAsyJS5ieXRlYmFzZS52MS5Xb3Jrc3BhY2VBcHByb3ZhbFNldHRpbmdIABJFChNkYXRhX2NsYXNzaWZpY2F0aW9uGAQgASgLMiYuYnl0ZWJhc2UudjEuRGF0YUNsYXNzaWZpY2F0aW9uU2V0dGluZ0gAEjkKDXNlbWFudGljX3R5cGUYBSABKAsyIC5ieXRlYmFzZS52MS5TZW1hbnRpY1R5cGVTZXR0aW5nSAASJAoCYWkYBiABKAsyFi5ieXRlYmFzZS52MS5BSVNldHRpbmdIABI2CgtlbnZpcm9ubWVudBgHIAEoCzIfLmJ5dGViYXNlLnYxLkVudmlyb25tZW50U2V0dGluZ0gAEioKBWVtYWlsGAggASgLMhkuYnl0ZWJhc2UudjEuRW1haWxTZXR0aW5nSABCBwoFdmFsdWUivAYKDEFwcElNU2V0dGluZxI1CghzZXR0aW5ncxgBIAMoCzIjLmJ5dGViYXNlLnYxLkFwcElNU2V0dGluZy5JTVNldHRpbmcaGwoFU2xhY2sSEgoFdG9rZW4YASABKAlCA+BBBBo2CgZGZWlzaHUSEwoGYXBwX2lkGAEgASgJQgPgQQQSFwoKYXBwX3NlY3JldBgCIAEoCUID4EEEGkkKBVdlY29tEhQKB2NvcnBfaWQYASABKAlCA+BBBBIVCghhZ2VudF9pZBgCIAEoCUID4EEEEhMKBnNlY3JldBgDIAEoCUID4EEEGjQKBExhcmsSEwoGYXBwX2lkGAEgASgJQgPgQQQSFwoKYXBwX3NlY3JldBgCIAEoCUID4EEEGlcKCERpbmdUYWxrEhYKCWNsaWVudF9pZBgBIAEoCUID4EEEEhoKDWNsaWVudF9zZWNyZXQYAiABKAlCA+BBBBIXCgpyb2JvdF9jb2RlGAMgASgJQgPgQQQaUwoFVGVhbXMSFgoJdGVuYW50X2lkGAEgASgJQgPgQQQSFgoJY2xpZW50X2lkGAIgASgJQgPgQQQSGgoNY2xpZW50X3NlY3JldBgDIAEoCUID4EEEGvACCglJTVNldHRpbmcSJgoEdHlwZRgBIAEoDjIYLmJ5dGViYXNlLnYxLldlYmhvb2tUeXBlEjAKBXNsYWNrGAIgASgLMh8uYnl0ZWJhc2UudjEuQXBwSU1TZXR0aW5nLlNsYWNrSAASMgoGZmVpc2h1GAMgASgLMiAuYnl0ZWJhc2UudjEuQXBwSU1TZXR0aW5nLkZlaXNodUgAEjAKBXdlY29tGAQgASgLMh8uYnl0ZWJhc2UudjEuQXBwSU1TZXR0aW5nLldlY29tSAASLgoEbGFyaxgFIAEoCzIeLmJ5dGViYXNlLnYxLkFwcElNU2V0dGluZy5MYXJrSAASNgoIZGluZ3RhbGsYBiABKAsyIi5ieXRlYmFzZS52MS5BcHBJTVNldHRpbmcuRGluZ1RhbGtIABIwCgV0ZWFtcxgHIAEoCzIfLmJ5dGViYXNlLnYxLkFwcElNU2V0dGluZy5UZWFtc0gAQgkKB3BheWxvYWQi0QsKF1dvcmtzcGFjZVByb2ZpbGVTZXR0aW5nEhQKDGV4dGVybmFsX3VybBgBIAEoCRIXCg9kaXNhbGxvd19zaWdudXAYAiABKAgSEwoLcmVxdWlyZV9tZmEYAyABKAgSOQoWcmVmcmVzaF90b2tlbl9kdXJhdGlvbhgEIAEoCzIZLmdvb2dsZS5wcm90b2J1Zi5EdXJhdGlvbhIvCgxhbm5vdW5jZW1lbnQYBSABKAsyGS5ieXRlYmFzZS52MS5Bbm5vdW5jZW1lbnQSPQoabWF4aW11bV9yZXF1ZXN0X2V4cGlyYXRpb24YBiABKAsyGS5nb29nbGUucHJvdG9idWYuRHVyYXRpb24SDwoHZG9tYWlucxgHIAMoCRIfChdlbmZvcmNlX2lkZW50aXR5X2RvbWFpbhgIIAEoCBI9ChRkYXRhYmFzZV9jaGFuZ2VfbW9kZRgJIAEoDjIfLmJ5dGViYXNlLnYxLkRhdGFiYXNlQ2hhbmdlTW9kZRIgChhkaXNhbGxvd19wYXNzd29yZF9zaWduaW4YCiABKAgSIAoYZW5hYmxlX21ldHJpY19jb2xsZWN0aW9uGAsgASgIEjsKGGluYWN0aXZlX3Nlc3Npb25fdGltZW91dBgMIAEoCzIZLmdvb2dsZS5wcm90b2J1Zi5EdXJhdGlvbhIfChdlbmFibGVfYXVkaXRfbG9nX3N0ZG91dBgNIAEoCBIRCgl3YXRlcm1hcmsYDiABKAgSVgoUcGFzc3dvcmRfcmVzdHJpY3Rpb24YESABKAsyOC5ieXRlYmFzZS52MS5Xb3Jrc3BhY2VQcm9maWxlU2V0dGluZy5QYXNzd29yZFJlc3RyaWN0aW9uEjgKFWFjY2Vzc190b2tlbl9kdXJhdGlvbhgSIAEoCzIZLmdvb2dsZS5wcm90b2J1Zi5EdXJhdGlvbhIUCgxlbmFibGVfZGVidWcYEyABKAgSFwoPc3FsX3Jlc3VsdF9zaXplGBQgASgDEjAKDXF1ZXJ5X3RpbWVvdXQYFSABKAsyGS5nb29nbGUucHJvdG9idWYuRHVyYXRpb24SHwoXYWxsb3dfZW1haWxfY29kZV9zaWduaW4YFiABKAgSGwoTc3FsX2VkaXRvcl90aGVtZV9pZBgXIAEoCRJDChdzcWxfZWRpdG9yX2N1c3RvbV90aGVtZRgYIAEoCzIiLmJ5dGViYXNlLnYxLlNRTEVkaXRvclRoZW1lU2V0dGluZxI6ChdtYXhpbXVtX3JvbGVfZXhwaXJhdGlvbhgZIAEoCzIZLmdvb2dsZS5wcm90b2J1Zi5EdXJhdGlvbhJKCg5tY3BfY2FwYWJpbGl0eRgaIAEoDjIyLmJ5dGViYXNlLnYxLldvcmtzcGFjZVByb2ZpbGVTZXR0aW5nLk1DUENhcGFiaWxpdHkSLAofZGlyZWN0b3J5X3N5bmNfdG9rZW5fY29uZmlndXJlZBgbIAEoCEID4EEDGoQCChNQYXNzd29yZFJlc3RyaWN0aW9uEhIKCm1pbl9sZW5ndGgYASABKAUSFgoOcmVxdWlyZV9udW1iZXIYAiABKAgSFgoOcmVxdWlyZV9sZXR0ZXIYAyABKAgSIAoYcmVxdWlyZV91cHBlcmNhc2VfbGV0dGVyGAQgASgIEiEKGXJlcXVpcmVfc3BlY2lhbF9jaGFyYWN0ZXIYBSABKAgSLgomcmVxdWlyZV9yZXNldF9wYXNzd29yZF9mb3JfZmlyc3RfbG9naW4YBiABKAgSNAoRcGFzc3dvcmRfcm90YXRpb24YByABKAsyGS5nb29nbGUucHJvdG9idWYuRHVyYXRpb24iYgoNTUNQQ2FwYWJpbGl0eRIeChpNQ1BfQ0FQQUJJTElUWV9VTlNQRUNJRklFRBAAEgwKCERJU0FCTEVEEAESDQoJUkVBRF9PTkxZEAMSDgoKUkVBRF9XUklURRAEIgQIAhACSgQIDxAQSgQIEBARIskBChVTUUxFZGl0b3JUaGVtZVNldHRpbmcSCgoCaWQYASABKAkSDAoEbmFtZRgCIAEoCRITCgttb25hY29fYmFzZRgDIAEoCRI+CgZ0b2tlbnMYBCADKAsyLi5ieXRlYmFzZS52MS5TUUxFZGl0b3JUaGVtZVNldHRpbmcuVG9rZW5zRW50cnkaQQoLVG9rZW5zRW50cnkSCwoDa2V5GAEgASgJEiEKBXZhbHVlGAIgASgLMhIuZ29vZ2xlLnR5cGUuQ29sb3I6AjgBItIBCgxBbm5vdW5jZW1lbnQSDAoEdGV4dBgCIAEoCRIMCgRsaW5rGAMgASgJEjoKBXRoZW1lGAQgASgLMisuYnl0ZWJhc2UudjEuQW5ub3VuY2VtZW50LkFubm91bmNlbWVudFRoZW1lGl0KEUFubm91bmNlbWVudFRoZW1lEiYKCmJhY2tncm91bmQYASABKAsyEi5nb29nbGUudHlwZS5Db2xvchIgCgR0ZXh0GAIgASgLMhIuZ29vZ2xlLnR5cGUuQ29sb3JKBAgBEAJSBWxldmVsIv4CChhXb3Jrc3BhY2VBcHByb3ZhbFNldHRpbmcSOQoFcnVsZXMYASADKAsyKi5ieXRlYmFzZS52MS5Xb3Jrc3BhY2VBcHByb3ZhbFNldHRpbmcuUnVsZRqmAgoEUnVsZRIvCgh0ZW1wbGF0ZRgBIAEoCzIdLmJ5dGViYXNlLnYxLkFwcHJvdmFsVGVtcGxhdGUSJAoJY29uZGl0aW9uGAIgASgLMhEuZ29vZ2xlLnR5cGUuRXhwchJBCgZzb3VyY2UYAyABKA4yMS5ieXRlYmFzZS52MS5Xb3Jrc3BhY2VBcHByb3ZhbFNldHRpbmcuUnVsZS5Tb3VyY2UigwEKBlNvdXJjZRIWChJTT1VSQ0VfVU5TUEVDSUZJRUQQABITCg9DSEFOR0VfREFUQUJBU0UQARITCg9DUkVBVEVfREFUQUJBU0UQAhIQCgxSRVFVRVNUX1JPTEUQBBISCg5SRVFVRVNUX0FDQ0VTUxAFIgQIAxADKgtFWFBPUlRfREFUQSL9BAoZRGF0YUNsYXNzaWZpY2F0aW9uU2V0dGluZxJQCgdjb25maWdzGAEgAygLMj8uYnl0ZWJhc2UudjEuRGF0YUNsYXNzaWZpY2F0aW9uU2V0dGluZy5EYXRhQ2xhc3NpZmljYXRpb25Db25maWcajQQKGERhdGFDbGFzc2lmaWNhdGlvbkNvbmZpZxIKCgJpZBgBIAEoCRINCgV0aXRsZRgCIAEoCRJVCgZsZXZlbHMYAyADKAsyRS5ieXRlYmFzZS52MS5EYXRhQ2xhc3NpZmljYXRpb25TZXR0aW5nLkRhdGFDbGFzc2lmaWNhdGlvbkNvbmZpZy5MZXZlbBJrCg5jbGFzc2lmaWNhdGlvbhgEIAMoCzJTLmJ5dGViYXNlLnYxLkRhdGFDbGFzc2lmaWNhdGlvblNldHRpbmcuRGF0YUNsYXNzaWZpY2F0aW9uQ29uZmlnLkNsYXNzaWZpY2F0aW9uRW50cnkaMQoFTGV2ZWwSDQoFdGl0bGUYAiABKAkSDQoFbGV2ZWwYBCABKAVKBAgBEAJKBAgDEAQaUwoSRGF0YUNsYXNzaWZpY2F0aW9uEgoKAmlkGAEgASgJEg0KBXRpdGxlGAIgASgJEhIKBWxldmVsGAQgASgFSACIAQFCCAoGX2xldmVsSgQIAxAEGokBChNDbGFzc2lmaWNhdGlvbkVudHJ5EgsKA2tleRgBIAEoCRJhCgV2YWx1ZRgCIAEoCzJSLmJ5dGViYXNlLnYxLkRhdGFDbGFzc2lmaWNhdGlvblNldHRpbmcuRGF0YUNsYXNzaWZpY2F0aW9uQ29uZmlnLkRhdGFDbGFzc2lmaWNhdGlvbjoCOAEi0gEKE1NlbWFudGljVHlwZVNldHRpbmcSPAoFdHlwZXMYASADKAsyLS5ieXRlYmFzZS52MS5TZW1hbnRpY1R5cGVTZXR0aW5nLlNlbWFudGljVHlwZRp9CgxTZW1hbnRpY1R5cGUSCgoCaWQYASABKAkSDQoFdGl0bGUYAiABKAkSEwoLZGVzY3JpcHRpb24YAyABKAkSKQoJYWxnb3JpdGhtGAYgASgLMhYuYnl0ZWJhc2UudjEuQWxnb3JpdGhtEgwKBGljb24YByABKAlKBAgEEAYi/wQKCUFsZ29yaXRobRI0CglmdWxsX21hc2sYASABKAsyHy5ieXRlYmFzZS52MS5BbGdvcml0aG0uRnVsbE1hc2tIABI2CgpyYW5nZV9tYXNrGAIgASgLMiAuYnl0ZWJhc2UudjEuQWxnb3JpdGhtLlJhbmdlTWFza0gAEjIKCG1kNV9tYXNrGAMgASgLMh4uYnl0ZWJhc2UudjEuQWxnb3JpdGhtLk1ENU1hc2tIABJBChBpbm5lcl9vdXRlcl9tYXNrGAQgASgLMiUuYnl0ZWJhc2UudjEuQWxnb3JpdGhtLklubmVyT3V0ZXJNYXNrSAAaIAoIRnVsbE1hc2sSFAoMc3Vic3RpdHV0aW9uGAEgASgJGn4KCVJhbmdlTWFzaxI2CgZzbGljZXMYASADKAsyJi5ieXRlYmFzZS52MS5BbGdvcml0aG0uUmFuZ2VNYXNrLlNsaWNlGjkKBVNsaWNlEg0KBXN0YXJ0GAEgASgFEgsKA2VuZBgCIAEoBRIUCgxzdWJzdGl0dXRpb24YAyABKAkaFwoHTUQ1TWFzaxIMCgRzYWx0GAEgASgJGskBCg5Jbm5lck91dGVyTWFzaxISCgpwcmVmaXhfbGVuGAEgASgFEhIKCnN1ZmZpeF9sZW4YAiABKAUSPAoEdHlwZRgDIAEoDjIuLmJ5dGViYXNlLnYxLkFsZ29yaXRobS5Jbm5lck91dGVyTWFzay5NYXNrVHlwZRIUCgxzdWJzdGl0dXRpb24YBCABKAkiOwoITWFza1R5cGUSGQoVTUFTS19UWVBFX1VOU1BFQ0lGSUVEEAASCQoFSU5ORVIQARIJCgVPVVRFUhACQgYKBG1hc2si7wEKCUFJU2V0dGluZxIPCgdlbmFibGVkGAEgASgIEjEKCHByb3ZpZGVyGAIgASgOMh8uYnl0ZWJhc2UudjEuQUlTZXR0aW5nLlByb3ZpZGVyEhAKCGVuZHBvaW50GAMgASgJEg8KB2FwaV9rZXkYBCABKAkSDQoFbW9kZWwYBSABKAkSDwoHdmVyc2lvbhgGIAEoCSJbCghQcm92aWRlchIYChRQUk9WSURFUl9VTlNQRUNJRklFRBAAEgsKB09QRU5fQUkQARIKCgZDTEFVREUQAhIKCgZHRU1JTkkQAxIQCgxBWlVSRV9PUEVOQUkQBCKqAgoSRW52aXJvbm1lbnRTZXR0aW5nEkEKDGVudmlyb25tZW50cxgBIAMoCzIrLmJ5dGViYXNlLnYxLkVudmlyb25tZW50U2V0dGluZy5FbnZpcm9ubWVudBrQAQoLRW52aXJvbm1lbnQSEQoEbmFtZRgBIAEoCUID4EEDEgoKAmlkGAIgASgJEg0KBXRpdGxlGAMgASgJEkMKBHRhZ3MYBCADKAsyNS5ieXRlYmFzZS52MS5FbnZpcm9ubWVudFNldHRpbmcuRW52aXJvbm1lbnQuVGFnc0VudHJ5EiEKBWNvbG9yGAUgASgLMhIuZ29vZ2xlLnR5cGUuQ29sb3IaKwoJVGFnc0VudHJ5EgsKA2tleRgBIAEoCRINCgV2YWx1ZRgCIAEoCToCOAEi9AQKDEVtYWlsU2V0dGluZxIMCgRmcm9tGAEgASgJEhEKCWZyb21fbmFtZRgCIAEoCRIsCgR0eXBlGAMgASgOMh4uYnl0ZWJhc2UudjEuRW1haWxTZXR0aW5nLlR5cGUSNAoEc210cBgEIAEoCzIkLmJ5dGViYXNlLnYxLkVtYWlsU2V0dGluZy5TTVRQQ29uZmlnSAAarAMKClNNVFBDb25maWcSDAoEaG9zdBgBIAEoCRIMCgRwb3J0GAIgASgFEhAKCHVzZXJuYW1lGAMgASgJEhUKCHBhc3N3b3JkGAQgASgJQgPgQQQSQwoKZW5jcnlwdGlvbhgFIAEoDjIvLmJ5dGViYXNlLnYxLkVtYWlsU2V0dGluZy5TTVRQQ29uZmlnLkVuY3J5cHRpb24SSwoOYXV0aGVudGljYXRpb24YBiABKA4yMy5ieXRlYmFzZS52MS5FbWFpbFNldHRpbmcuU01UUENvbmZpZy5BdXRoZW50aWNhdGlvbiJYCgpFbmNyeXB0aW9uEhoKFkVOQ1JZUFRJT05fVU5TUEVDSUZJRUQQABITCg9FTkNSWVBUSU9OX05PTkUQARIMCghTVEFSVFRMUxACEgsKB1NTTF9UTFMQAyJtCg5BdXRoZW50aWNhdGlvbhIeChpBVVRIRU5USUNBVElPTl9VTlNQRUNJRklFRBAAEhcKE0FVVEhFTlRJQ0FUSU9OX05PTkUQARIJCgVQTEFJThACEgkKBUxPR0lOEAMSDAoIQ1JBTV9NRDUQBCImCgRUeXBlEhQKEFRZUEVfVU5TUEVDSUZJRUQQABIICgRTTVRQEAFCCAoGY29uZmlnInYKF1Rlc3RFbWFpbFNldHRpbmdSZXF1ZXN0EhMKBnBhcmVudBgBIAEoCUID4EECEjUKDWVtYWlsX3NldHRpbmcYAiABKAsyGS5ieXRlYmFzZS52MS5FbWFpbFNldHRpbmdCA+BBAhIPCgJ0bxgDIAEoCUID4EECIjoKGFRlc3RFbWFpbFNldHRpbmdSZXNwb25zZRIPCgdzdWNjZXNzGAEgASgIEg0KBWVycm9yGAIgASgJKlQKEkRhdGFiYXNlQ2hhbmdlTW9kZRIkCiBEQVRBQkFTRV9DSEFOR0VfTU9ERV9VTlNQRUNJRklFRBAAEgwKCFBJUEVMSU5FEAESCgoGRURJVE9SEAIyggUKDlNldHRpbmdTZXJ2aWNlEowBCgxMaXN0U2V0dGluZ3MSIC5ieXRlYmFzZS52MS5MaXN0U2V0dGluZ3NSZXF1ZXN0GiEuYnl0ZWJhc2UudjEuTGlzdFNldHRpbmdzUmVzcG9uc2UiN9pBAIrqMBBiYi5zZXR0aW5ncy5saXN0kOowAaDqMASo6jAJgtPkkwIOEgwvdjEvc2V0dGluZ3MShwEKCkdldFNldHRpbmcSHi5ieXRlYmFzZS52MS5HZXRTZXR0aW5nUmVxdWVzdBoULmJ5dGViYXNlLnYxLlNldHRpbmciQ9pBBG5hbWWK6jAPYmIuc2V0dGluZ3MuZ2V0kOowAqDqMASo6jAJgtPkkwIXEhUvdjEve25hbWU9c2V0dGluZ3MvKn0SmwEKDVVwZGF0ZVNldHRpbmcSIS5ieXRlYmFzZS52MS5VcGRhdGVTZXR0aW5nUmVxdWVzdBoULmJ5dGViYXNlLnYxLlNldHRpbmciUYrqMA9iYi5zZXR0aW5ncy5zZXSQ6jACmOowAaDqMAOo6jAHgtPkkwIoOgdzZXR0aW5nMh0vdjEve3NldHRpbmcubmFtZT1zZXR0aW5ncy8qfRK4AQoQVGVzdEVtYWlsU2V0dGluZxIkLmJ5dGViYXNlLnYxLlRlc3RFbWFpbFNldHRpbmdSZXF1ZXN0GiUuYnl0ZWJhc2UudjEuVGVzdEVtYWlsU2V0dGluZ1Jlc3BvbnNlIleK6jAPYmIuc2V0dGluZ3Muc2V0kOowAaDqMAOo6jAGgtPkkwIyOgEqIi0vdjEve3BhcmVudD13b3Jrc3BhY2VzLyp9L3NldHRpbmdzL0VNQUlMOnRlc3RCqQEKD2NvbS5ieXRlYmFzZS52MUITU2V0dGluZ1NlcnZpY2VQcm90b1ABWjRnaXRodWIuY29tL2J5dGViYXNlL2J5dGViYXNlL2JhY2tlbmQvZ2VuZXJhdGVkLWdvL3YxogIDQlhYqgILQnl0ZWJhc2UuVjHKAgtCeXRlYmFzZVxWMeICF0J5dGViYXNlXFYxXEdQQk1ldGFkYXRh6gIMQnl0ZWJhc2U6OlYxYgZwcm90bzM", [file_google_api_annotations, file_google_api_client, file_google_api_field_behavior, file_google_api_resource, file_google_protobuf_duration, file_google_protobuf_field_mask, file_google_type_color, file_google_type_expr, file_v1_annotation, file_v1_common, file_v1_issue_service]);+ fileDesc("Chh2MS9zZXR0aW5nX3NlcnZpY2UucHJvdG8SC2J5dGViYXNlLnYxIhUKE0xpc3RTZXR0aW5nc1JlcXVlc3QiPgoUTGlzdFNldHRpbmdzUmVzcG9uc2USJgoIc2V0dGluZ3MYASADKAsyFC5ieXRlYmFzZS52MS5TZXR0aW5nIj8KEUdldFNldHRpbmdSZXF1ZXN0EioKBG5hbWUYASABKAlCHOBBAvpBFgoUYnl0ZWJhc2UuY29tL1NldHRpbmciOwoSR2V0U2V0dGluZ1Jlc3BvbnNlEiUKB3NldHRpbmcYASABKAsyFC5ieXRlYmFzZS52MS5TZXR0aW5nIqEBChRVcGRhdGVTZXR0aW5nUmVxdWVzdBIqCgdzZXR0aW5nGAEgASgLMhQuYnl0ZWJhc2UudjEuU2V0dGluZ0ID4EECEhUKDXZhbGlkYXRlX29ubHkYAiABKAgSFQoNYWxsb3dfbWlzc2luZxgDIAEoCBIvCgt1cGRhdGVfbWFzaxgEIAEoCzIaLmdvb2dsZS5wcm90b2J1Zi5GaWVsZE1hc2sivQIKB1NldHRpbmcSEQoEbmFtZRgBIAEoCUID4EEIEi0KBXZhbHVlGAIgASgLMhkuYnl0ZWJhc2UudjEuU2V0dGluZ1ZhbHVlQgPgQQIiwAEKC1NldHRpbmdOYW1lEhwKGFNFVFRJTkdfTkFNRV9VTlNQRUNJRklFRBAAEhUKEVdPUktTUEFDRV9QUk9GSUxFEAESFgoSV09SS1NQQUNFX0FQUFJPVkFMEAISCgoGQVBQX0lNEAMSBgoCQUkQBBIXChNEQVRBX0NMQVNTSUZJQ0FUSU9OEAUSEgoOU0VNQU5USUNfVFlQRVMQBhIPCgtFTlZJUk9OTUVOVBAHEgkKBUVNQUlMEAgSBwoDTUNQEAk6LepBKgoUYnl0ZWJhc2UuY29tL1NldHRpbmcSEnNldHRpbmdzL3tzZXR0aW5nfSKABAoMU2V0dGluZ1ZhbHVlEisKBmFwcF9pbRgBIAEoCzIZLmJ5dGViYXNlLnYxLkFwcElNU2V0dGluZ0gAEkEKEXdvcmtzcGFjZV9wcm9maWxlGAIgASgLMiQuYnl0ZWJhc2UudjEuV29ya3NwYWNlUHJvZmlsZVNldHRpbmdIABJDChJ3b3Jrc3BhY2VfYXBwcm92YWwYAyABKAsyJS5ieXRlYmFzZS52MS5Xb3Jrc3BhY2VBcHByb3ZhbFNldHRpbmdIABJFChNkYXRhX2NsYXNzaWZpY2F0aW9uGAQgASgLMiYuYnl0ZWJhc2UudjEuRGF0YUNsYXNzaWZpY2F0aW9uU2V0dGluZ0gAEjkKDXNlbWFudGljX3R5cGUYBSABKAsyIC5ieXRlYmFzZS52MS5TZW1hbnRpY1R5cGVTZXR0aW5nSAASJAoCYWkYBiABKAsyFi5ieXRlYmFzZS52MS5BSVNldHRpbmdIABI2CgtlbnZpcm9ubWVudBgHIAEoCzIfLmJ5dGViYXNlLnYxLkVudmlyb25tZW50U2V0dGluZ0gAEioKBWVtYWlsGAggASgLMhkuYnl0ZWJhc2UudjEuRW1haWxTZXR0aW5nSAASJgoDbWNwGAkgASgLMhcuYnl0ZWJhc2UudjEuTUNQU2V0dGluZ0gAQgcKBXZhbHVlIrwGCgxBcHBJTVNldHRpbmcSNQoIc2V0dGluZ3MYASADKAsyIy5ieXRlYmFzZS52MS5BcHBJTVNldHRpbmcuSU1TZXR0aW5nGhsKBVNsYWNrEhIKBXRva2VuGAEgASgJQgPgQQQaNgoGRmVpc2h1EhMKBmFwcF9pZBgBIAEoCUID4EEEEhcKCmFwcF9zZWNyZXQYAiABKAlCA+BBBBpJCgVXZWNvbRIUCgdjb3JwX2lkGAEgASgJQgPgQQQSFQoIYWdlbnRfaWQYAiABKAlCA+BBBBITCgZzZWNyZXQYAyABKAlCA+BBBBo0CgRMYXJrEhMKBmFwcF9pZBgBIAEoCUID4EEEEhcKCmFwcF9zZWNyZXQYAiABKAlCA+BBBBpXCghEaW5nVGFsaxIWCgljbGllbnRfaWQYASABKAlCA+BBBBIaCg1jbGllbnRfc2VjcmV0GAIgASgJQgPgQQQSFwoKcm9ib3RfY29kZRgDIAEoCUID4EEEGlMKBVRlYW1zEhYKCXRlbmFudF9pZBgBIAEoCUID4EEEEhYKCWNsaWVudF9pZBgCIAEoCUID4EEEEhoKDWNsaWVudF9zZWNyZXQYAyABKAlCA+BBBBrwAgoJSU1TZXR0aW5nEiYKBHR5cGUYASABKA4yGC5ieXRlYmFzZS52MS5XZWJob29rVHlwZRIwCgVzbGFjaxgCIAEoCzIfLmJ5dGViYXNlLnYxLkFwcElNU2V0dGluZy5TbGFja0gAEjIKBmZlaXNodRgDIAEoCzIgLmJ5dGViYXNlLnYxLkFwcElNU2V0dGluZy5GZWlzaHVIABIwCgV3ZWNvbRgEIAEoCzIfLmJ5dGViYXNlLnYxLkFwcElNU2V0dGluZy5XZWNvbUgAEi4KBGxhcmsYBSABKAsyHi5ieXRlYmFzZS52MS5BcHBJTVNldHRpbmcuTGFya0gAEjYKCGRpbmd0YWxrGAYgASgLMiIuYnl0ZWJhc2UudjEuQXBwSU1TZXR0aW5nLkRpbmdUYWxrSAASMAoFdGVhbXMYByABKAsyHy5ieXRlYmFzZS52MS5BcHBJTVNldHRpbmcuVGVhbXNIAEIJCgdwYXlsb2FkIrcKChdXb3Jrc3BhY2VQcm9maWxlU2V0dGluZxIUCgxleHRlcm5hbF91cmwYASABKAkSFwoPZGlzYWxsb3dfc2lnbnVwGAIgASgIEhMKC3JlcXVpcmVfbWZhGAMgASgIEjkKFnJlZnJlc2hfdG9rZW5fZHVyYXRpb24YBCABKAsyGS5nb29nbGUucHJvdG9idWYuRHVyYXRpb24SLwoMYW5ub3VuY2VtZW50GAUgASgLMhkuYnl0ZWJhc2UudjEuQW5ub3VuY2VtZW50Ej0KGm1heGltdW1fcmVxdWVzdF9leHBpcmF0aW9uGAYgASgLMhkuZ29vZ2xlLnByb3RvYnVmLkR1cmF0aW9uEg8KB2RvbWFpbnMYByADKAkSHwoXZW5mb3JjZV9pZGVudGl0eV9kb21haW4YCCABKAgSPQoUZGF0YWJhc2VfY2hhbmdlX21vZGUYCSABKA4yHy5ieXRlYmFzZS52MS5EYXRhYmFzZUNoYW5nZU1vZGUSIAoYZGlzYWxsb3dfcGFzc3dvcmRfc2lnbmluGAogASgIEiAKGGVuYWJsZV9tZXRyaWNfY29sbGVjdGlvbhgLIAEoCBI7ChhpbmFjdGl2ZV9zZXNzaW9uX3RpbWVvdXQYDCABKAsyGS5nb29nbGUucHJvdG9idWYuRHVyYXRpb24SHwoXZW5hYmxlX2F1ZGl0X2xvZ19zdGRvdXQYDSABKAgSEQoJd2F0ZXJtYXJrGA4gASgIElYKFHBhc3N3b3JkX3Jlc3RyaWN0aW9uGBEgASgLMjguYnl0ZWJhc2UudjEuV29ya3NwYWNlUHJvZmlsZVNldHRpbmcuUGFzc3dvcmRSZXN0cmljdGlvbhI4ChVhY2Nlc3NfdG9rZW5fZHVyYXRpb24YEiABKAsyGS5nb29nbGUucHJvdG9idWYuRHVyYXRpb24SFAoMZW5hYmxlX2RlYnVnGBMgASgIEhcKD3NxbF9yZXN1bHRfc2l6ZRgUIAEoAxIwCg1xdWVyeV90aW1lb3V0GBUgASgLMhkuZ29vZ2xlLnByb3RvYnVmLkR1cmF0aW9uEh8KF2FsbG93X2VtYWlsX2NvZGVfc2lnbmluGBYgASgIEhsKE3NxbF9lZGl0b3JfdGhlbWVfaWQYFyABKAkSQwoXc3FsX2VkaXRvcl9jdXN0b21fdGhlbWUYGCABKAsyIi5ieXRlYmFzZS52MS5TUUxFZGl0b3JUaGVtZVNldHRpbmcSOgoXbWF4aW11bV9yb2xlX2V4cGlyYXRpb24YGSABKAsyGS5nb29nbGUucHJvdG9idWYuRHVyYXRpb24SLAofZGlyZWN0b3J5X3N5bmNfdG9rZW5fY29uZmlndXJlZBgbIAEoCEID4EEDGoQCChNQYXNzd29yZFJlc3RyaWN0aW9uEhIKCm1pbl9sZW5ndGgYASABKAUSFgoOcmVxdWlyZV9udW1iZXIYAiABKAgSFgoOcmVxdWlyZV9sZXR0ZXIYAyABKAgSIAoYcmVxdWlyZV91cHBlcmNhc2VfbGV0dGVyGAQgASgIEiEKGXJlcXVpcmVfc3BlY2lhbF9jaGFyYWN0ZXIYBSABKAgSLgomcmVxdWlyZV9yZXNldF9wYXNzd29yZF9mb3JfZmlyc3RfbG9naW4YBiABKAgSNAoRcGFzc3dvcmRfcm90YXRpb24YByABKAsyGS5nb29nbGUucHJvdG9idWYuRHVyYXRpb25KBAgPEBBKBAgaEBtKBAgQEBFSDm1jcF9jYXBhYmlsaXR5IsQBCgpNQ1BTZXR0aW5nEjYKCmNhcGFiaWxpdHkYASABKA4yIi5ieXRlYmFzZS52MS5NQ1BTZXR0aW5nLkNhcGFiaWxpdHkSIQoZaWdub3JlX21hc2tpbmdfZXhlbXB0aW9ucxgCIAEoCCJbCgpDYXBhYmlsaXR5EhoKFkNBUEFCSUxJVFlfVU5TUEVDSUZJRUQQABIMCghESVNBQkxFRBABEg0KCVJFQURfT05MWRADEg4KClJFQURfV1JJVEUQBCIECAIQAiLJAQoVU1FMRWRpdG9yVGhlbWVTZXR0aW5nEgoKAmlkGAEgASgJEgwKBG5hbWUYAiABKAkSEwoLbW9uYWNvX2Jhc2UYAyABKAkSPgoGdG9rZW5zGAQgAygLMi4uYnl0ZWJhc2UudjEuU1FMRWRpdG9yVGhlbWVTZXR0aW5nLlRva2Vuc0VudHJ5GkEKC1Rva2Vuc0VudHJ5EgsKA2tleRgBIAEoCRIhCgV2YWx1ZRgCIAEoCzISLmdvb2dsZS50eXBlLkNvbG9yOgI4ASLSAQoMQW5ub3VuY2VtZW50EgwKBHRleHQYAiABKAkSDAoEbGluaxgDIAEoCRI6CgV0aGVtZRgEIAEoCzIrLmJ5dGViYXNlLnYxLkFubm91bmNlbWVudC5Bbm5vdW5jZW1lbnRUaGVtZRpdChFBbm5vdW5jZW1lbnRUaGVtZRImCgpiYWNrZ3JvdW5kGAEgASgLMhIuZ29vZ2xlLnR5cGUuQ29sb3ISIAoEdGV4dBgCIAEoCzISLmdvb2dsZS50eXBlLkNvbG9ySgQIARACUgVsZXZlbCL+AgoYV29ya3NwYWNlQXBwcm92YWxTZXR0aW5nEjkKBXJ1bGVzGAEgAygLMiouYnl0ZWJhc2UudjEuV29ya3NwYWNlQXBwcm92YWxTZXR0aW5nLlJ1bGUapgIKBFJ1bGUSLwoIdGVtcGxhdGUYASABKAsyHS5ieXRlYmFzZS52MS5BcHByb3ZhbFRlbXBsYXRlEiQKCWNvbmRpdGlvbhgCIAEoCzIRLmdvb2dsZS50eXBlLkV4cHISQQoGc291cmNlGAMgASgOMjEuYnl0ZWJhc2UudjEuV29ya3NwYWNlQXBwcm92YWxTZXR0aW5nLlJ1bGUuU291cmNlIoMBCgZTb3VyY2USFgoSU09VUkNFX1VOU1BFQ0lGSUVEEAASEwoPQ0hBTkdFX0RBVEFCQVNFEAESEwoPQ1JFQVRFX0RBVEFCQVNFEAISEAoMUkVRVUVTVF9ST0xFEAQSEgoOUkVRVUVTVF9BQ0NFU1MQBSIECAMQAyoLRVhQT1JUX0RBVEEi/QQKGURhdGFDbGFzc2lmaWNhdGlvblNldHRpbmcSUAoHY29uZmlncxgBIAMoCzI/LmJ5dGViYXNlLnYxLkRhdGFDbGFzc2lmaWNhdGlvblNldHRpbmcuRGF0YUNsYXNzaWZpY2F0aW9uQ29uZmlnGo0EChhEYXRhQ2xhc3NpZmljYXRpb25Db25maWcSCgoCaWQYASABKAkSDQoFdGl0bGUYAiABKAkSVQoGbGV2ZWxzGAMgAygLMkUuYnl0ZWJhc2UudjEuRGF0YUNsYXNzaWZpY2F0aW9uU2V0dGluZy5EYXRhQ2xhc3NpZmljYXRpb25Db25maWcuTGV2ZWwSawoOY2xhc3NpZmljYXRpb24YBCADKAsyUy5ieXRlYmFzZS52MS5EYXRhQ2xhc3NpZmljYXRpb25TZXR0aW5nLkRhdGFDbGFzc2lmaWNhdGlvbkNvbmZpZy5DbGFzc2lmaWNhdGlvbkVudHJ5GjEKBUxldmVsEg0KBXRpdGxlGAIgASgJEg0KBWxldmVsGAQgASgFSgQIARACSgQIAxAEGlMKEkRhdGFDbGFzc2lmaWNhdGlvbhIKCgJpZBgBIAEoCRINCgV0aXRsZRgCIAEoCRISCgVsZXZlbBgEIAEoBUgAiAEBQggKBl9sZXZlbEoECAMQBBqJAQoTQ2xhc3NpZmljYXRpb25FbnRyeRILCgNrZXkYASABKAkSYQoFdmFsdWUYAiABKAsyUi5ieXRlYmFzZS52MS5EYXRhQ2xhc3NpZmljYXRpb25TZXR0aW5nLkRhdGFDbGFzc2lmaWNhdGlvbkNvbmZpZy5EYXRhQ2xhc3NpZmljYXRpb246AjgBItIBChNTZW1hbnRpY1R5cGVTZXR0aW5nEjwKBXR5cGVzGAEgAygLMi0uYnl0ZWJhc2UudjEuU2VtYW50aWNUeXBlU2V0dGluZy5TZW1hbnRpY1R5cGUafQoMU2VtYW50aWNUeXBlEgoKAmlkGAEgASgJEg0KBXRpdGxlGAIgASgJEhMKC2Rlc2NyaXB0aW9uGAMgASgJEikKCWFsZ29yaXRobRgGIAEoCzIWLmJ5dGViYXNlLnYxLkFsZ29yaXRobRIMCgRpY29uGAcgASgJSgQIBBAGIv8ECglBbGdvcml0aG0SNAoJZnVsbF9tYXNrGAEgASgLMh8uYnl0ZWJhc2UudjEuQWxnb3JpdGhtLkZ1bGxNYXNrSAASNgoKcmFuZ2VfbWFzaxgCIAEoCzIgLmJ5dGViYXNlLnYxLkFsZ29yaXRobS5SYW5nZU1hc2tIABIyCghtZDVfbWFzaxgDIAEoCzIeLmJ5dGViYXNlLnYxLkFsZ29yaXRobS5NRDVNYXNrSAASQQoQaW5uZXJfb3V0ZXJfbWFzaxgEIAEoCzIlLmJ5dGViYXNlLnYxLkFsZ29yaXRobS5Jbm5lck91dGVyTWFza0gAGiAKCEZ1bGxNYXNrEhQKDHN1YnN0aXR1dGlvbhgBIAEoCRp+CglSYW5nZU1hc2sSNgoGc2xpY2VzGAEgAygLMiYuYnl0ZWJhc2UudjEuQWxnb3JpdGhtLlJhbmdlTWFzay5TbGljZRo5CgVTbGljZRINCgVzdGFydBgBIAEoBRILCgNlbmQYAiABKAUSFAoMc3Vic3RpdHV0aW9uGAMgASgJGhcKB01ENU1hc2sSDAoEc2FsdBgBIAEoCRrJAQoOSW5uZXJPdXRlck1hc2sSEgoKcHJlZml4X2xlbhgBIAEoBRISCgpzdWZmaXhfbGVuGAIgASgFEjwKBHR5cGUYAyABKA4yLi5ieXRlYmFzZS52MS5BbGdvcml0aG0uSW5uZXJPdXRlck1hc2suTWFza1R5cGUSFAoMc3Vic3RpdHV0aW9uGAQgASgJIjsKCE1hc2tUeXBlEhkKFU1BU0tfVFlQRV9VTlNQRUNJRklFRBAAEgkKBUlOTkVSEAESCQoFT1VURVIQAkIGCgRtYXNrIu8BCglBSVNldHRpbmcSDwoHZW5hYmxlZBgBIAEoCBIxCghwcm92aWRlchgCIAEoDjIfLmJ5dGViYXNlLnYxLkFJU2V0dGluZy5Qcm92aWRlchIQCghlbmRwb2ludBgDIAEoCRIPCgdhcGlfa2V5GAQgASgJEg0KBW1vZGVsGAUgASgJEg8KB3ZlcnNpb24YBiABKAkiWwoIUHJvdmlkZXISGAoUUFJPVklERVJfVU5TUEVDSUZJRUQQABILCgdPUEVOX0FJEAESCgoGQ0xBVURFEAISCgoGR0VNSU5JEAMSEAoMQVpVUkVfT1BFTkFJEAQiqgIKEkVudmlyb25tZW50U2V0dGluZxJBCgxlbnZpcm9ubWVudHMYASADKAsyKy5ieXRlYmFzZS52MS5FbnZpcm9ubWVudFNldHRpbmcuRW52aXJvbm1lbnQa0AEKC0Vudmlyb25tZW50EhEKBG5hbWUYASABKAlCA+BBAxIKCgJpZBgCIAEoCRINCgV0aXRsZRgDIAEoCRJDCgR0YWdzGAQgAygLMjUuYnl0ZWJhc2UudjEuRW52aXJvbm1lbnRTZXR0aW5nLkVudmlyb25tZW50LlRhZ3NFbnRyeRIhCgVjb2xvchgFIAEoCzISLmdvb2dsZS50eXBlLkNvbG9yGisKCVRhZ3NFbnRyeRILCgNrZXkYASABKAkSDQoFdmFsdWUYAiABKAk6AjgBIvQECgxFbWFpbFNldHRpbmcSDAoEZnJvbRgBIAEoCRIRCglmcm9tX25hbWUYAiABKAkSLAoEdHlwZRgDIAEoDjIeLmJ5dGViYXNlLnYxLkVtYWlsU2V0dGluZy5UeXBlEjQKBHNtdHAYBCABKAsyJC5ieXRlYmFzZS52MS5FbWFpbFNldHRpbmcuU01UUENvbmZpZ0gAGqwDCgpTTVRQQ29uZmlnEgwKBGhvc3QYASABKAkSDAoEcG9ydBgCIAEoBRIQCgh1c2VybmFtZRgDIAEoCRIVCghwYXNzd29yZBgEIAEoCUID4EEEEkMKCmVuY3J5cHRpb24YBSABKA4yLy5ieXRlYmFzZS52MS5FbWFpbFNldHRpbmcuU01UUENvbmZpZy5FbmNyeXB0aW9uEksKDmF1dGhlbnRpY2F0aW9uGAYgASgOMjMuYnl0ZWJhc2UudjEuRW1haWxTZXR0aW5nLlNNVFBDb25maWcuQXV0aGVudGljYXRpb24iWAoKRW5jcnlwdGlvbhIaChZFTkNSWVBUSU9OX1VOU1BFQ0lGSUVEEAASEwoPRU5DUllQVElPTl9OT05FEAESDAoIU1RBUlRUTFMQAhILCgdTU0xfVExTEAMibQoOQXV0aGVudGljYXRpb24SHgoaQVVUSEVOVElDQVRJT05fVU5TUEVDSUZJRUQQABIXChNBVVRIRU5USUNBVElPTl9OT05FEAESCQoFUExBSU4QAhIJCgVMT0dJThADEgwKCENSQU1fTUQ1EAQiJgoEVHlwZRIUChBUWVBFX1VOU1BFQ0lGSUVEEAASCAoEU01UUBABQggKBmNvbmZpZyJ2ChdUZXN0RW1haWxTZXR0aW5nUmVxdWVzdBITCgZwYXJlbnQYASABKAlCA+BBAhI1Cg1lbWFpbF9zZXR0aW5nGAIgASgLMhkuYnl0ZWJhc2UudjEuRW1haWxTZXR0aW5nQgPgQQISDwoCdG8YAyABKAlCA+BBAiI6ChhUZXN0RW1haWxTZXR0aW5nUmVzcG9uc2USDwoHc3VjY2VzcxgBIAEoCBINCgVlcnJvchgCIAEoCSpUChJEYXRhYmFzZUNoYW5nZU1vZGUSJAogREFUQUJBU0VfQ0hBTkdFX01PREVfVU5TUEVDSUZJRUQQABIMCghQSVBFTElORRABEgoKBkVESVRPUhACMoIFCg5TZXR0aW5nU2VydmljZRKMAQoMTGlzdFNldHRpbmdzEiAuYnl0ZWJhc2UudjEuTGlzdFNldHRpbmdzUmVxdWVzdBohLmJ5dGViYXNlLnYxLkxpc3RTZXR0aW5nc1Jlc3BvbnNlIjfaQQCK6jAQYmIuc2V0dGluZ3MubGlzdJDqMAGg6jAEqOowCYLT5JMCDhIML3YxL3NldHRpbmdzEocBCgpHZXRTZXR0aW5nEh4uYnl0ZWJhc2UudjEuR2V0U2V0dGluZ1JlcXVlc3QaFC5ieXRlYmFzZS52MS5TZXR0aW5nIkPaQQRuYW1liuowD2JiLnNldHRpbmdzLmdldJDqMAKg6jAEqOowCYLT5JMCFxIVL3YxL3tuYW1lPXNldHRpbmdzLyp9EpsBCg1VcGRhdGVTZXR0aW5nEiEuYnl0ZWJhc2UudjEuVXBkYXRlU2V0dGluZ1JlcXVlc3QaFC5ieXRlYmFzZS52MS5TZXR0aW5nIlGK6jAPYmIuc2V0dGluZ3Muc2V0kOowApjqMAGg6jADqOowB4LT5JMCKDoHc2V0dGluZzIdL3YxL3tzZXR0aW5nLm5hbWU9c2V0dGluZ3MvKn0SuAEKEFRlc3RFbWFpbFNldHRpbmcSJC5ieXRlYmFzZS52MS5UZXN0RW1haWxTZXR0aW5nUmVxdWVzdBolLmJ5dGViYXNlLnYxLlRlc3RFbWFpbFNldHRpbmdSZXNwb25zZSJXiuowD2JiLnNldHRpbmdzLnNldJDqMAGg6jADqOowBoLT5JMCMjoBKiItL3YxL3twYXJlbnQ9d29ya3NwYWNlcy8qfS9zZXR0aW5ncy9FTUFJTDp0ZXN0QqkBCg9jb20uYnl0ZWJhc2UudjFCE1NldHRpbmdTZXJ2aWNlUHJvdG9QAVo0Z2l0aHViLmNvbS9ieXRlYmFzZS9ieXRlYmFzZS9iYWNrZW5kL2dlbmVyYXRlZC1nby92MaICA0JYWKoCC0J5dGViYXNlLlYxygILQnl0ZWJhc2VcVjHiAhdCeXRlYmFzZVxWMVxHUEJNZXRhZGF0YeoCDEJ5dGViYXNlOjpWMWIGcHJvdG8z", [file_google_api_annotations, file_google_api_client, file_google_api_field_behavior, file_google_api_resource, file_google_protobuf_duration, file_google_protobuf_field_mask, file_google_type_color, file_google_type_expr, file_v1_annotation, file_v1_common, file_v1_issue_service]);/*** Describes the message bytebase.v1.ListSettingsRequest.@@ -152,62 +152,69 @@ export const WorkspaceProfileSetting_PasswordRestrictionSchema = /*@__PURE__*/messageDesc(file_v1_setting_service, 8, 0);/**- * Describes the enum bytebase.v1.WorkspaceProfileSetting.MCPCapability.+ * Describes the message bytebase.v1.MCPSetting.+ * Use `create(MCPSettingSchema)` to create a new message.*/-export const WorkspaceProfileSetting_MCPCapabilitySchema = /*@__PURE__*/- enumDesc(file_v1_setting_service, 8, 0);+export const MCPSettingSchema = /*@__PURE__*/+ messageDesc(file_v1_setting_service, 9);/**- * MCPCapability is the maximum capability an MCP (Model Context Protocol)- * session may have in the workspace. It is a ceiling: a session runs at this- * level or lower. Unset (UNSPECIFIED) is treated as READ_WRITE so existing- * workspaces are unaffected.+ * Describes the enum bytebase.v1.MCPSetting.Capability.+ */+export const MCPSetting_CapabilitySchema = /*@__PURE__*/+ enumDesc(file_v1_setting_service, 9, 0);++/**+ * Capability is the ceiling: a session runs at this level or lower. An absent+ * MCP setting resolves to READ_WRITE, so a workspace that never configured+ * MCP is unaffected. Writing CAPABILITY_UNSPECIFIED explicitly is rejected —+ * omit the update mask path to leave the ceiling unset.*- * @generated from enum bytebase.v1.WorkspaceProfileSetting.MCPCapability+ * @generated from enum bytebase.v1.MCPSetting.Capability*/-export const WorkspaceProfileSetting_MCPCapability = /*@__PURE__*/- tsEnum(WorkspaceProfileSetting_MCPCapabilitySchema);+export const MCPSetting_Capability = /*@__PURE__*/+ tsEnum(MCPSetting_CapabilitySchema);/*** Describes the message bytebase.v1.SQLEditorThemeSetting.* Use `create(SQLEditorThemeSettingSchema)` to create a new message.*/export const SQLEditorThemeSettingSchema = /*@__PURE__*/- messageDesc(file_v1_setting_service, 9);+ messageDesc(file_v1_setting_service, 10);/*** Describes the message bytebase.v1.Announcement.* Use `create(AnnouncementSchema)` to create a new message.*/export const AnnouncementSchema = /*@__PURE__*/- messageDesc(file_v1_setting_service, 10);+ messageDesc(file_v1_setting_service, 11);/*** Describes the message bytebase.v1.Announcement.AnnouncementTheme.* Use `create(Announcement_AnnouncementThemeSchema)` to create a new message.*/export const Announcement_AnnouncementThemeSchema = /*@__PURE__*/- messageDesc(file_v1_setting_service, 10, 0);+ messageDesc(file_v1_setting_service, 11, 0);/*** Describes the message bytebase.v1.WorkspaceApprovalSetting.* Use `create(WorkspaceApprovalSettingSchema)` to create a new message.*/export const WorkspaceApprovalSettingSchema = /*@__PURE__*/- messageDesc(file_v1_setting_service, 11);+ messageDesc(file_v1_setting_service, 12);/*** Describes the message bytebase.v1.WorkspaceApprovalSetting.Rule.* Use `create(WorkspaceApprovalSetting_RuleSchema)` to create a new message.*/export const WorkspaceApprovalSetting_RuleSchema = /*@__PURE__*/- messageDesc(file_v1_setting_service, 11, 0);+ messageDesc(file_v1_setting_service, 12, 0);/*** Describes the enum bytebase.v1.WorkspaceApprovalSetting.Rule.Source.*/export const WorkspaceApprovalSetting_Rule_SourceSchema = /*@__PURE__*/- enumDesc(file_v1_setting_service, 11, 0, 0);+ enumDesc(file_v1_setting_service, 12, 0, 0);/*** @generated from enum bytebase.v1.WorkspaceApprovalSetting.Rule.Source@@ -220,90 +227,90 @@ export const WorkspaceApprovalSetting_Rule_Source = /*@__PURE__*/* Use `create(DataClassificationSettingSchema)` to create a new message.*/export const DataClassificationSettingSchema = /*@__PURE__*/- messageDesc(file_v1_setting_service, 12);+ messageDesc(file_v1_setting_service, 13);/*** Describes the message bytebase.v1.DataClassificationSetting.DataClassificationConfig.* Use `create(DataClassificationSetting_DataClassificationConfigSchema)` to create a new message.*/export const DataClassificationSetting_DataClassificationConfigSchema = /*@__PURE__*/- messageDesc(file_v1_setting_service, 12, 0);+ messageDesc(file_v1_setting_service, 13, 0);/*** Describes the message bytebase.v1.DataClassificationSetting.DataClassificationConfig.Level.* Use `create(DataClassificationSetting_DataClassificationConfig_LevelSchema)` to create a new message.*/export const DataClassificationSetting_DataClassificationConfig_LevelSchema = /*@__PURE__*/- messageDesc(file_v1_setting_service, 12, 0, 0);+ messageDesc(file_v1_setting_service, 13, 0, 0);/*** Describes the message bytebase.v1.DataClassificationSetting.DataClassificationConfig.DataClassification.* Use `create(DataClassificationSetting_DataClassificationConfig_DataClassificationSchema)` to create a new message.*/export const DataClassificationSetting_DataClassificationConfig_DataClassificationSchema = /*@__PURE__*/- messageDesc(file_v1_setting_service, 12, 0, 1);+ messageDesc(file_v1_setting_service, 13, 0, 1);/*** Describes the message bytebase.v1.SemanticTypeSetting.* Use `create(SemanticTypeSettingSchema)` to create a new message.*/export const SemanticTypeSettingSchema = /*@__PURE__*/- messageDesc(file_v1_setting_service, 13);+ messageDesc(file_v1_setting_service, 14);/*** Describes the message bytebase.v1.SemanticTypeSetting.SemanticType.* Use `create(SemanticTypeSetting_SemanticTypeSchema)` to create a new message.*/export const SemanticTypeSetting_SemanticTypeSchema = /*@__PURE__*/- messageDesc(file_v1_setting_service, 13, 0);+ messageDesc(file_v1_setting_service, 14, 0);/*** Describes the message bytebase.v1.Algorithm.* Use `create(AlgorithmSchema)` to create a new message.*/export const AlgorithmSchema = /*@__PURE__*/- messageDesc(file_v1_setting_service, 14);+ messageDesc(file_v1_setting_service, 15);/*** Describes the message bytebase.v1.Algorithm.FullMask.* Use `create(Algorithm_FullMaskSchema)` to create a new message.*/export const Algorithm_FullMaskSchema = /*@__PURE__*/- messageDesc(file_v1_setting_service, 14, 0);+ messageDesc(file_v1_setting_service, 15, 0);/*** Describes the message bytebase.v1.Algorithm.RangeMask.* Use `create(Algorithm_RangeMaskSchema)` to create a new message.*/export const Algorithm_RangeMaskSchema = /*@__PURE__*/- messageDesc(file_v1_setting_service, 14, 1);+ messageDesc(file_v1_setting_service, 15, 1);/*** Describes the message bytebase.v1.Algorithm.RangeMask.Slice.* Use `create(Algorithm_RangeMask_SliceSchema)` to create a new message.*/export const Algorithm_RangeMask_SliceSchema = /*@__PURE__*/- messageDesc(file_v1_setting_service, 14, 1, 0);+ messageDesc(file_v1_setting_service, 15, 1, 0);/*** Describes the message bytebase.v1.Algorithm.MD5Mask.* Use `create(Algorithm_MD5MaskSchema)` to create a new message.*/export const Algorithm_MD5MaskSchema = /*@__PURE__*/- messageDesc(file_v1_setting_service, 14, 2);+ messageDesc(file_v1_setting_service, 15, 2);/*** Describes the message bytebase.v1.Algorithm.InnerOuterMask.* Use `create(Algorithm_InnerOuterMaskSchema)` to create a new message.*/export const Algorithm_InnerOuterMaskSchema = /*@__PURE__*/- messageDesc(file_v1_setting_service, 14, 3);+ messageDesc(file_v1_setting_service, 15, 3);/*** Describes the enum bytebase.v1.Algorithm.InnerOuterMask.MaskType.*/export const Algorithm_InnerOuterMask_MaskTypeSchema = /*@__PURE__*/- enumDesc(file_v1_setting_service, 14, 3, 0);+ enumDesc(file_v1_setting_service, 15, 3, 0);/*** @generated from enum bytebase.v1.Algorithm.InnerOuterMask.MaskType@@ -316,13 +323,13 @@ export const Algorithm_InnerOuterMask_MaskType = /*@__PURE__*/* Use `create(AISettingSchema)` to create a new message.*/export const AISettingSchema = /*@__PURE__*/- messageDesc(file_v1_setting_service, 15);+ messageDesc(file_v1_setting_service, 16);/*** Describes the enum bytebase.v1.AISetting.Provider.*/export const AISetting_ProviderSchema = /*@__PURE__*/- enumDesc(file_v1_setting_service, 15, 0);+ enumDesc(file_v1_setting_service, 16, 0);/*** @generated from enum bytebase.v1.AISetting.Provider@@ -335,34 +342,34 @@ export const AISetting_Provider = /*@__PURE__*/* Use `create(EnvironmentSettingSchema)` to create a new message.*/export const EnvironmentSettingSchema = /*@__PURE__*/- messageDesc(file_v1_setting_service, 16);+ messageDesc(file_v1_setting_service, 17);/*** Describes the message bytebase.v1.EnvironmentSetting.Environment.* Use `create(EnvironmentSetting_EnvironmentSchema)` to create a new message.*/export const EnvironmentSetting_EnvironmentSchema = /*@__PURE__*/- messageDesc(file_v1_setting_service, 16, 0);+ messageDesc(file_v1_setting_service, 17, 0);/*** Describes the message bytebase.v1.EmailSetting.* Use `create(EmailSettingSchema)` to create a new message.*/export const EmailSettingSchema = /*@__PURE__*/- messageDesc(file_v1_setting_service, 17);+ messageDesc(file_v1_setting_service, 18);/*** Describes the message bytebase.v1.EmailSetting.SMTPConfig.* Use `create(EmailSetting_SMTPConfigSchema)` to create a new message.*/export const EmailSetting_SMTPConfigSchema = /*@__PURE__*/- messageDesc(file_v1_setting_service, 17, 0);+ messageDesc(file_v1_setting_service, 18, 0);/*** Describes the enum bytebase.v1.EmailSetting.SMTPConfig.Encryption.*/export const EmailSetting_SMTPConfig_EncryptionSchema = /*@__PURE__*/- enumDesc(file_v1_setting_service, 17, 0, 0);+ enumDesc(file_v1_setting_service, 18, 0, 0);/*** @generated from enum bytebase.v1.EmailSetting.SMTPConfig.Encryption@@ -374,7 +381,7 @@ export const EmailSetting_SMTPConfig_Encryption = /*@__PURE__*/* Describes the enum bytebase.v1.EmailSetting.SMTPConfig.Authentication.*/export const EmailSetting_SMTPConfig_AuthenticationSchema = /*@__PURE__*/- enumDesc(file_v1_setting_service, 17, 0, 1);+ enumDesc(file_v1_setting_service, 18, 0, 1);/*** @generated from enum bytebase.v1.EmailSetting.SMTPConfig.Authentication@@ -386,7 +393,7 @@ export const EmailSetting_SMTPConfig_Authentication = /*@__PURE__*/* Describes the enum bytebase.v1.EmailSetting.Type.*/export const EmailSetting_TypeSchema = /*@__PURE__*/- enumDesc(file_v1_setting_service, 17, 0);+ enumDesc(file_v1_setting_service, 18, 0);/*** @generated from enum bytebase.v1.EmailSetting.Type@@ -399,14 +406,14 @@ export const EmailSetting_Type = /*@__PURE__*/* Use `create(TestEmailSettingRequestSchema)` to create a new message.*/export const TestEmailSettingRequestSchema = /*@__PURE__*/- messageDesc(file_v1_setting_service, 18);+ messageDesc(file_v1_setting_service, 19);/*** Describes the message bytebase.v1.TestEmailSettingResponse.* Use `create(TestEmailSettingResponseSchema)` to create a new message.*/export const TestEmailSettingResponseSchema = /*@__PURE__*/- messageDesc(file_v1_setting_service, 19);+ messageDesc(file_v1_setting_service, 20);/*** Describes the enum bytebase.v1.DatabaseChangeMode.diff --git a/proto/gen/grpc-doc/openapi.yaml b/proto/gen/grpc-doc/openapi.yamlindex 6268f4dbb6..57c69a68c2 100644--- a/proto/gen/grpc-doc/openapi.yaml+++ b/proto/gen/grpc-doc/openapi.yaml@@ -26054,6 +26054,51 @@ components:between, EXCLUDED and FORBIDDEN are served by no ceiling, and an unclassifiedmethod is refused rather than served. Annotating a method is therefore achange to what an MCP session can reach, taking effect on the next request.+ bytebase.v1.MCPSetting:+ type: object+ properties:+ capability:+ title: capability+ description: |-+ The maximum capability available to MCP sessions in this workspace, acting+ as an admin-set ceiling. Enforced server-side at three points: the /mcp+ endpoint decides whether a connection is admitted at all, the ceiling gate+ on the internal MCP chain decides, per request, which method classes are+ served, and under READ_ONLY the SQL clamp decides, per statement, whether+ it only reads.+ $ref: '#/components/schemas/bytebase.v1.MCPSetting.Capability'+ ignoreMaskingExemptions:+ type: boolean+ title: ignore_masking_exemptions+ description: |-+ Whether a request that arrived over MCP stops applying the caller's own+ unmasking provisioning. Two mechanisms let a user see a real value and this+ suppresses both: the masking exemptions granted to them, and the unmask+ carried by an access grant. The same user in the console is untouched.++ It cannot force masking where there is none. Masking substitutes values in+ query results, so this does not reach data copied into a column carrying no+ masking policy, and it does nothing on the engines Bytebase does not mask.+ It narrows what an agent reads through the paths Bytebase masks; it is not+ a confidentiality boundary.+ title: MCPSetting+ additionalProperties: false+ description: |-+ MCPSetting is what an MCP (Model Context Protocol) session may do in this+ workspace.+ bytebase.v1.MCPSetting.Capability:+ type: string+ title: Capability+ enum:+ - CAPABILITY_UNSPECIFIED+ - DISABLED+ - READ_ONLY+ - READ_WRITE+ description: |-+ Capability is the ceiling: a session runs at this level or lower. An absent+ MCP setting resolves to READ_WRITE, so a workspace that never configured+ MCP is unaffected. Writing CAPABILITY_UNSPECIFIED explicitly is rejected —+ omit the update mask path to leave the ceiling unset.bytebase.v1.MaskingExemptionPolicy:type: objectproperties:@@ -29823,6 +29868,7 @@ components:- SEMANTIC_TYPES- ENVIRONMENT+ - MCPbytebase.v1.SettingValue:type: objectoneOf:@@ -29866,6 +29912,14 @@ components:title: environmentrequired:- environment+ - type: object+ properties:+ mcp:+ title: mcp+ $ref: '#/components/schemas/bytebase.v1.MCPSetting'+ title: mcp+ required:+ - mcp- type: objectproperties:semanticType:@@ -32739,15 +32793,6 @@ components:The max expiration duration for request role.Deprecated: use just-in-time access request flows instead.$ref: '#/components/schemas/google.protobuf.Duration'- mcpCapability:- title: mcp_capability- description: |-- The maximum capability available to MCP (Model Context Protocol) sessions in- this workspace, acting as an admin-set ceiling. Unset is treated as- READ_WRITE for backward compatibility; DISABLED rejects all MCP- connections. Writing MCP_CAPABILITY_UNSPECIFIED explicitly is rejected —- omit the update mask path to leave the ceiling unset.- $ref: '#/components/schemas/bytebase.v1.WorkspaceProfileSetting.MCPCapability'directorySyncTokenConfigured:type: booleantitle: directory_sync_token_configured@@ -32758,19 +32803,6 @@ components:readOnly: truetitle: WorkspaceProfileSettingadditionalProperties: false- bytebase.v1.WorkspaceProfileSetting.MCPCapability:- type: string- title: MCPCapability- enum:- - MCP_CAPABILITY_UNSPECIFIED- - DISABLED- - READ_ONLY- - READ_WRITE- description: |-- MCPCapability is the maximum capability an MCP (Model Context Protocol)- session may have in the workspace. It is a ceiling: a session runs at this- level or lower. Unset (UNSPECIFIED) is treated as READ_WRITE so existing- workspaces are unaffected.bytebase.v1.WorkspaceProfileSetting.PasswordRestriction:type: objectproperties:diff --git a/proto/gen/grpc-doc/store/README.md b/proto/gen/grpc-doc/store/README.mdindex 11d14aa7b2..b19b7d739c 100644--- a/proto/gen/grpc-doc/store/README.md+++ b/proto/gen/grpc-doc/store/README.md@@ -278,6 +278,7 @@- [EnvironmentSetting](#bytebase-store-EnvironmentSetting)- [EnvironmentSetting.Environment](#bytebase-store-EnvironmentSetting-Environment)- [EnvironmentSetting.Environment.TagsEntry](#bytebase-store-EnvironmentSetting-Environment-TagsEntry)+ - [MCPSetting](#bytebase-store-MCPSetting)- [SQLEditorThemeSetting](#bytebase-store-SQLEditorThemeSetting)- [SQLEditorThemeSetting.TokensEntry](#bytebase-store-SQLEditorThemeSetting-TokensEntry)- [SemanticTypeSetting](#bytebase-store-SemanticTypeSetting)@@ -295,10 +296,10 @@- [EmailSetting.SMTPConfig.Authentication](#bytebase-store-EmailSetting-SMTPConfig-Authentication)- [EmailSetting.SMTPConfig.Encryption](#bytebase-store-EmailSetting-SMTPConfig-Encryption)- [EmailSetting.Type](#bytebase-store-EmailSetting-Type)+ - [MCPSetting.Capability](#bytebase-store-MCPSetting-Capability)- [SettingName](#bytebase-store-SettingName)- [WorkspaceApprovalSetting.Rule.Source](#bytebase-store-WorkspaceApprovalSetting-Rule-Source)- [WorkspaceProfileSetting.DatabaseChangeMode](#bytebase-store-WorkspaceProfileSetting-DatabaseChangeMode)- - [WorkspaceProfileSetting.MCPCapability](#bytebase-store-WorkspaceProfileSetting-MCPCapability)- [store/signal.proto](#store_signal-proto)- [Signal](#bytebase-store-Signal)@@ -4664,6 +4665,28 @@ All other settings live in per-workspace WORKSPACE_PROFILE.+<a name="bytebase-store-MCPSetting"></a>++### MCPSetting+MCPSetting is what an MCP (Model Context Protocol) session may do in this+workspace. It is its own setting rather than a field of the workspace profile+because the set grows, and because the /mcp kill switch reads it on every+request and should not share a row — or a parse failure — with branding and+sign-in configuration.+++| Field | Type | Label | Description |+| ----- | ---- | ----- | ----------- |+| capability | [MCPSetting.Capability](#bytebase-store-MCPSetting-Capability) | | The maximum capability available to MCP sessions in this workspace, acting as an admin-set ceiling. Enforced server-side at three points: the /mcp endpoint decides whether a connection is admitted at all, the ceiling gate on the internal MCP chain decides, per request, which method classes are served, and under READ_ONLY the SQL clamp decides, per statement, whether it only reads. |+| ignore_masking_exemptions | [bool](#bool) | | Whether a request that arrived over MCP stops applying the caller's own unmasking provisioning. Two mechanisms let a user see a real value and this suppresses both: the masking exemptions granted to them, and the unmask carried by an access grant. The same user in the console is untouched.++It cannot force masking where there is none. Masking substitutes values in query results, so this does not reach data copied into a column carrying no masking policy, and it does nothing on the engines Bytebase does not mask. It narrows what an agent reads through the paths Bytebase masks; it is not a confidentiality boundary. |++++++<a name="bytebase-store-SQLEditorThemeSetting"></a>### SQLEditorThemeSetting@@ -4810,7 +4833,6 @@ All other settings live in per-workspace WORKSPACE_PROFILE.| sql_editor_theme_id | [string](#string) | | Enforced SQL Editor theme id: OPAQUE — a frontend-resolved built-in preset id OR a custom theme's uuid. Empty ⇒ default light. || sql_editor_custom_theme | [SQLEditorThemeSetting](#bytebase-store-SQLEditorThemeSetting) | | The enforced CUSTOM theme's full definition — present ONLY when sql_editor_theme_id is a custom uuid. tokens is always complete. || maximum_role_expiration | [google.protobuf.Duration](#google-protobuf-Duration) | | The max expiration duration for request role. Deprecated: use just-in-time access request flows instead. |-| mcp_capability | [WorkspaceProfileSetting.MCPCapability](#bytebase-store-WorkspaceProfileSetting-MCPCapability) | | The maximum capability available to MCP (Model Context Protocol) sessions in this workspace, acting as an admin-set ceiling. Unset is treated as READ_WRITE for backward compatibility; DISABLED rejects all MCP connections. Enforced server-side at two points: the /mcp endpoint decides whether a connection is admitted at all, and the ceiling gate on the internal MCP chain decides, per request, which method classes are served. || directory_sync_token_hash | [string](#string) | | Hex-encoded SHA-256 of the SCIM directory sync token. The plaintext is shown once at rotation and never stored. SHA-256 rather than a slow KDF because the token is 122 bits of crypto/rand, not a human-chosen secret. |@@ -4943,6 +4965,22 @@ All other settings live in per-workspace WORKSPACE_PROFILE.+<a name="bytebase-store-MCPSetting-Capability"></a>++### MCPSetting.Capability+Capability is the ceiling: a session runs at this level or lower. An absent+MCP setting resolves to READ_WRITE, so a workspace that never configured+MCP is unaffected.++| Name | Number | Description |+| ---- | ------ | ----------- |+| CAPABILITY_UNSPECIFIED | 0 | |+| DISABLED | 1 | MCP connections are rejected. |+| READ_ONLY | 3 | MCP may inspect metadata and run read-only queries. (Enforced from P1b.) |+| READ_WRITE | 4 | MCP may perform mutations, still bounded by the user's RBAC. |+++<a name="bytebase-store-SettingName"></a>### SettingName@@ -4960,6 +4998,7 @@ All other settings live in per-workspace WORKSPACE_PROFILE.| SEMANTIC_TYPES | 7 | || ENVIRONMENT | 8 | || EMAIL | 9 | |+| MCP | 10 | |@@ -4991,23 +5030,6 @@ All other settings live in per-workspace WORKSPACE_PROFILE.| EDITOR | 2 | A simple database change process in SQL editor. Users can execute SQL directly. |--<a name="bytebase-store-WorkspaceProfileSetting-MCPCapability"></a>--### WorkspaceProfileSetting.MCPCapability-MCPCapability is the maximum capability an MCP (Model Context Protocol)-session may have in the workspace. It is a ceiling: a session runs at this-level or lower. Unset (UNSPECIFIED) is treated as READ_WRITE so existing-workspaces are unaffected.--| Name | Number | Description |-| ---- | ------ | ----------- |-| MCP_CAPABILITY_UNSPECIFIED | 0 | |-| DISABLED | 1 | MCP connections are rejected. |-| READ_ONLY | 3 | MCP may inspect metadata and run read-only queries. (Enforced from P1b.) |-| READ_WRITE | 4 | MCP may perform mutations, still bounded by the user's RBAC. |--diff --git a/proto/gen/grpc-doc/store/index.html b/proto/gen/grpc-doc/store/index.htmlindex c0afa5a33c..b1d8463a1d 100644--- a/proto/gen/grpc-doc/store/index.html+++ b/proto/gen/grpc-doc/store/index.html@@ -1292,6 +1292,10 @@<a href="#bytebase.store.EnvironmentSetting.Environment.TagsEntry"><span class="badge">M</span>EnvironmentSetting.Environment.TagsEntry</a></li>+ <li>+ <a href="#bytebase.store.MCPSetting"><span class="badge">M</span>MCPSetting</a>+ </li>+<li><a href="#bytebase.store.SQLEditorThemeSetting"><span class="badge">M</span>SQLEditorThemeSetting</a></li>@@ -1358,19 +1362,19 @@</li><li>- <a href="#bytebase.store.SettingName"><span class="badge">E</span>SettingName</a>+ <a href="#bytebase.store.MCPSetting.Capability"><span class="badge">E</span>MCPSetting.Capability</a></li><li>- <a href="#bytebase.store.WorkspaceApprovalSetting.Rule.Source"><span class="badge">E</span>WorkspaceApprovalSetting.Rule.Source</a>+ <a href="#bytebase.store.SettingName"><span class="badge">E</span>SettingName</a></li><li>- <a href="#bytebase.store.WorkspaceProfileSetting.DatabaseChangeMode"><span class="badge">E</span>WorkspaceProfileSetting.DatabaseChangeMode</a>+ <a href="#bytebase.store.WorkspaceApprovalSetting.Rule.Source"><span class="badge">E</span>WorkspaceApprovalSetting.Rule.Source</a></li><li>- <a href="#bytebase.store.WorkspaceProfileSetting.MCPCapability"><span class="badge">E</span>WorkspaceProfileSetting.MCPCapability</a>+ <a href="#bytebase.store.WorkspaceProfileSetting.DatabaseChangeMode"><span class="badge">E</span>WorkspaceProfileSetting.DatabaseChangeMode</a></li>@@ -12794,6 +12798,51 @@ are /[a-z][0-9]-/. </p></td>+ <h3 id="bytebase.store.MCPSetting">MCPSetting</h3>+ <p>MCPSetting is what an MCP (Model Context Protocol) session may do in this</p><p>workspace. It is its own setting rather than a field of the workspace profile</p><p>because the set grows, and because the /mcp kill switch reads it on every</p><p>request and should not share a row — or a parse failure — with branding and</p><p>sign-in configuration.</p>+++ <table class="field-table">+ <thead>+ <tr><td>Field</td><td>Type</td><td>Label</td><td>Description</td></tr>+ </thead>+ <tbody>++ <tr>+ <td>capability</td>+ <td><a href="#bytebase.store.MCPSetting.Capability">MCPSetting.Capability</a></td>+ <td></td>+ <td><p>The maximum capability available to MCP sessions in this workspace, acting+as an admin-set ceiling. Enforced server-side at three points: the /mcp+endpoint decides whether a connection is admitted at all, the ceiling gate+on the internal MCP chain decides, per request, which method classes are+served, and under READ_ONLY the SQL clamp decides, per statement, whether+it only reads. </p></td>+ </tr>++ <tr>+ <td>ignore_masking_exemptions</td>+ <td><a href="#bool">bool</a></td>+ <td></td>+ <td><p>Whether a request that arrived over MCP stops applying the caller's own+unmasking provisioning. Two mechanisms let a user see a real value and this+suppresses both: the masking exemptions granted to them, and the unmask+carried by an access grant. The same user in the console is untouched.++It cannot force masking where there is none. Masking substitutes values in+query results, so this does not reach data copied into a column carrying no+masking policy, and it does nothing on the engines Bytebase does not mask.+It narrows what an agent reads through the paths Bytebase masks; it is not+a confidentiality boundary. </p></td>+ </tr>++ </tbody>+ </table>+++++<h3 id="bytebase.store.SQLEditorThemeSetting">SQLEditorThemeSetting</h3><p></p>@@ -13210,18 +13259,6 @@ sql_editor_theme_id is a custom uuid. tokens is always complete. </p></td>Deprecated: use just-in-time access request flows instead. </p></td></tr>- <tr>- <td>mcp_capability</td>- <td><a href="#bytebase.store.WorkspaceProfileSetting.MCPCapability">WorkspaceProfileSetting.MCPCapability</a></td>- <td></td>- <td><p>The maximum capability available to MCP (Model Context Protocol) sessions in-this workspace, acting as an admin-set ceiling. Unset is treated as-READ_WRITE for backward compatibility; DISABLED rejects all MCP-connections. Enforced server-side at two points: the /mcp endpoint decides-whether a connection is admitted at all, and the ceiling gate on the-internal MCP chain decides, per request, which method classes are served. </p></td>- </tr>-<tr><td>directory_sync_token_hash</td><td><a href="#string">string</a></td>@@ -13545,6 +13582,41 @@ frontend-only concept that seeds these colors; the store only holds them. </p></</tbody></table>+ <h3 id="bytebase.store.MCPSetting.Capability">MCPSetting.Capability</h3>+ <p>Capability is the ceiling: a session runs at this level or lower. An absent</p><p>MCP setting resolves to READ_WRITE, so a workspace that never configured</p><p>MCP is unaffected.</p>+ <table class="enum-table">+ <thead>+ <tr><td>Name</td><td>Number</td><td>Description</td></tr>+ </thead>+ <tbody>++ <tr>+ <td>CAPABILITY_UNSPECIFIED</td>+ <td>0</td>+ <td><p></p></td>+ </tr>++ <tr>+ <td>DISABLED</td>+ <td>1</td>+ <td><p>MCP connections are rejected.</p></td>+ </tr>++ <tr>+ <td>READ_ONLY</td>+ <td>3</td>+ <td><p>MCP may inspect metadata and run read-only queries. (Enforced from P1b.)</p></td>+ </tr>++ <tr>+ <td>READ_WRITE</td>+ <td>4</td>+ <td><p>MCP may perform mutations, still bounded by the user's RBAC.</p></td>+ </tr>++ </tbody>+ </table>+<h3 id="bytebase.store.SettingName">SettingName</h3><p></p><table class="enum-table">@@ -13613,6 +13685,12 @@ frontend-only concept that seeds these colors; the store only holds them. </p></<td><p></p></td></tr>+ <tr>+ <td>MCP</td>+ <td>10</td>+ <td><p></p></td>+ </tr>+</tbody></table>@@ -13693,41 +13771,6 @@ Default to this mode.</p></td></tbody></table>- <h3 id="bytebase.store.WorkspaceProfileSetting.MCPCapability">WorkspaceProfileSetting.MCPCapability</h3>- <p>MCPCapability is the maximum capability an MCP (Model Context Protocol)</p><p>session may have in the workspace. It is a ceiling: a session runs at this</p><p>level or lower. Unset (UNSPECIFIED) is treated as READ_WRITE so existing</p><p>workspaces are unaffected.</p>- <table class="enum-table">- <thead>- <tr><td>Name</td><td>Number</td><td>Description</td></tr>- </thead>- <tbody>-- <tr>- <td>MCP_CAPABILITY_UNSPECIFIED</td>- <td>0</td>- <td><p></p></td>- </tr>-- <tr>- <td>DISABLED</td>- <td>1</td>- <td><p>MCP connections are rejected.</p></td>- </tr>-- <tr>- <td>READ_ONLY</td>- <td>3</td>- <td><p>MCP may inspect metadata and run read-only queries. (Enforced from P1b.)</p></td>- </tr>-- <tr>- <td>READ_WRITE</td>- <td>4</td>- <td><p>MCP may perform mutations, still bounded by the user's RBAC.</p></td>- </tr>-- </tbody>- </table>-diff --git a/proto/gen/grpc-doc/v1/README.md b/proto/gen/grpc-doc/v1/README.mdindex cccf4538de..3dc4e7c621 100644--- a/proto/gen/grpc-doc/v1/README.md+++ b/proto/gen/grpc-doc/v1/README.md@@ -277,6 +277,7 @@- [GetSettingResponse](#bytebase-v1-GetSettingResponse)- [ListSettingsRequest](#bytebase-v1-ListSettingsRequest)- [ListSettingsResponse](#bytebase-v1-ListSettingsResponse)+ - [MCPSetting](#bytebase-v1-MCPSetting)- [SQLEditorThemeSetting](#bytebase-v1-SQLEditorThemeSetting)- [SQLEditorThemeSetting.TokensEntry](#bytebase-v1-SQLEditorThemeSetting-TokensEntry)- [SemanticTypeSetting](#bytebase-v1-SemanticTypeSetting)@@ -297,9 +298,9 @@- [EmailSetting.SMTPConfig.Authentication](#bytebase-v1-EmailSetting-SMTPConfig-Authentication)- [EmailSetting.SMTPConfig.Encryption](#bytebase-v1-EmailSetting-SMTPConfig-Encryption)- [EmailSetting.Type](#bytebase-v1-EmailSetting-Type)+ - [MCPSetting.Capability](#bytebase-v1-MCPSetting-Capability)- [Setting.SettingName](#bytebase-v1-Setting-SettingName)- [WorkspaceApprovalSetting.Rule.Source](#bytebase-v1-WorkspaceApprovalSetting-Rule-Source)- - [WorkspaceProfileSetting.MCPCapability](#bytebase-v1-WorkspaceProfileSetting-MCPCapability)- [SettingService](#bytebase-v1-SettingService)@@ -4901,6 +4902,25 @@ The response message for getting a setting.+<a name="bytebase-v1-MCPSetting"></a>++### MCPSetting+MCPSetting is what an MCP (Model Context Protocol) session may do in this+workspace.+++| Field | Type | Label | Description |+| ----- | ---- | ----- | ----------- |+| capability | [MCPSetting.Capability](#bytebase-v1-MCPSetting-Capability) | | The maximum capability available to MCP sessions in this workspace, acting as an admin-set ceiling. Enforced server-side at three points: the /mcp endpoint decides whether a connection is admitted at all, the ceiling gate on the internal MCP chain decides, per request, which method classes are served, and under READ_ONLY the SQL clamp decides, per statement, whether it only reads. |+| ignore_masking_exemptions | [bool](#bool) | | Whether a request that arrived over MCP stops applying the caller's own unmasking provisioning. Two mechanisms let a user see a real value and this suppresses both: the masking exemptions granted to them, and the unmask carried by an access grant. The same user in the console is untouched.++It cannot force masking where there is none. Masking substitutes values in query results, so this does not reach data copied into a column carrying no masking policy, and it does nothing on the engines Bytebase does not mask. It narrows what an agent reads through the paths Bytebase masks; it is not a confidentiality boundary. |++++++<a name="bytebase-v1-SQLEditorThemeSetting"></a>### SQLEditorThemeSetting@@ -5001,6 +5021,7 @@ The data in setting value.| ai | [AISetting](#bytebase-v1-AISetting) | | || environment | [EnvironmentSetting](#bytebase-v1-EnvironmentSetting) | | || email | [EmailSetting](#bytebase-v1-EmailSetting) | | |+| mcp | [MCPSetting](#bytebase-v1-MCPSetting) | | |@@ -5129,7 +5150,6 @@ For examples: resource.environment_id == "prod" && statement.aff| sql_editor_theme_id | [string](#string) | | Enforced SQL Editor theme id: OPAQUE — a frontend-resolved built-in preset id OR a custom theme's uuid. Empty ⇒ default light. || sql_editor_custom_theme | [SQLEditorThemeSetting](#bytebase-v1-SQLEditorThemeSetting) | | The enforced CUSTOM theme's full definition — present ONLY when sql_editor_theme_id is a custom uuid. tokens is always complete. || maximum_role_expiration | [google.protobuf.Duration](#google-protobuf-Duration) | | The max expiration duration for request role. Deprecated: use just-in-time access request flows instead. |-| mcp_capability | [WorkspaceProfileSetting.MCPCapability](#bytebase-v1-WorkspaceProfileSetting-MCPCapability) | | The maximum capability available to MCP (Model Context Protocol) sessions in this workspace, acting as an admin-set ceiling. Unset is treated as READ_WRITE for backward compatibility; DISABLED rejects all MCP connections. Writing MCP_CAPABILITY_UNSPECIFIED explicitly is rejected — omit the update mask path to leave the ceiling unset. || directory_sync_token_configured | [bool](#bool) | | Whether a directory sync token has been generated for this workspace. The token itself is never returned; this only lets the UI decide between offering "generate" and "regenerate". |@@ -5242,6 +5262,23 @@ For examples: resource.environment_id == "prod" && statement.aff+<a name="bytebase-v1-MCPSetting-Capability"></a>++### MCPSetting.Capability+Capability is the ceiling: a session runs at this level or lower. An absent+MCP setting resolves to READ_WRITE, so a workspace that never configured+MCP is unaffected. Writing CAPABILITY_UNSPECIFIED explicitly is rejected —+omit the update mask path to leave the ceiling unset.++| Name | Number | Description |+| ---- | ------ | ----------- |+| CAPABILITY_UNSPECIFIED | 0 | |+| DISABLED | 1 | MCP connections are rejected. |+| READ_ONLY | 3 | MCP may inspect metadata and run read-only queries. A session opens, and what it may do is decided per method by the capability gate and per statement by the SQL clamp: a request holding a statement that is not a read is refused whole, and where the engine's driver has one the database session is opened read-only as well. |+| READ_WRITE | 4 | MCP may perform mutations, still bounded by the user's RBAC. |+++<a name="bytebase-v1-Setting-SettingName"></a>### Setting.SettingName@@ -5258,6 +5295,7 @@ For examples: resource.environment_id == "prod" && statement.aff| SEMANTIC_TYPES | 6 | || ENVIRONMENT | 7 | || EMAIL | 8 | |+| MCP | 9 | |@@ -5275,23 +5313,6 @@ For examples: resource.environment_id == "prod" && statement.aff| REQUEST_ACCESS | 5 | |--<a name="bytebase-v1-WorkspaceProfileSetting-MCPCapability"></a>--### WorkspaceProfileSetting.MCPCapability-MCPCapability is the maximum capability an MCP (Model Context Protocol)-session may have in the workspace. It is a ceiling: a session runs at this-level or lower. Unset (UNSPECIFIED) is treated as READ_WRITE so existing-workspaces are unaffected.--| Name | Number | Description |-| ---- | ------ | ----------- |-| MCP_CAPABILITY_UNSPECIFIED | 0 | |-| DISABLED | 1 | MCP connections are rejected. |-| READ_ONLY | 3 | MCP may inspect metadata and run read-only queries. A session opens, and what it may do is decided per method by the capability gate and per statement by the SQL clamp: a request holding a statement that is not a read is refused whole, and where the engine's driver has one the database session is opened read-only as well. |-| READ_WRITE | 4 | MCP may perform mutations, still bounded by the user's RBAC. |--diff --git a/proto/gen/grpc-doc/v1/index.html b/proto/gen/grpc-doc/v1/index.htmlindex 9aa77f9ea8..a7b277625b 100644--- a/proto/gen/grpc-doc/v1/index.html+++ b/proto/gen/grpc-doc/v1/index.html@@ -1226,6 +1226,10 @@<a href="#bytebase.v1.ListSettingsResponse"><span class="badge">M</span>ListSettingsResponse</a></li>+ <li>+ <a href="#bytebase.v1.MCPSetting"><span class="badge">M</span>MCPSetting</a>+ </li>+<li><a href="#bytebase.v1.SQLEditorThemeSetting"><span class="badge">M</span>SQLEditorThemeSetting</a></li>@@ -1304,15 +1308,15 @@</li><li>- <a href="#bytebase.v1.Setting.SettingName"><span class="badge">E</span>Setting.SettingName</a>+ <a href="#bytebase.v1.MCPSetting.Capability"><span class="badge">E</span>MCPSetting.Capability</a></li><li>- <a href="#bytebase.v1.WorkspaceApprovalSetting.Rule.Source"><span class="badge">E</span>WorkspaceApprovalSetting.Rule.Source</a>+ <a href="#bytebase.v1.Setting.SettingName"><span class="badge">E</span>Setting.SettingName</a></li><li>- <a href="#bytebase.v1.WorkspaceProfileSetting.MCPCapability"><span class="badge">E</span>WorkspaceProfileSetting.MCPCapability</a>+ <a href="#bytebase.v1.WorkspaceApprovalSetting.Rule.Source"><span class="badge">E</span>WorkspaceApprovalSetting.Rule.Source</a></li>@@ -14123,6 +14127,51 @@ are /[a-z][0-9]-/. </p></td>+ <h3 id="bytebase.v1.MCPSetting">MCPSetting</h3>+ <p>MCPSetting is what an MCP (Model Context Protocol) session may do in this</p><p>workspace.</p>+++ <table class="field-table">+ <thead>+ <tr><td>Field</td><td>Type</td><td>Label</td><td>Description</td></tr>+ </thead>+ <tbody>++ <tr>+ <td>capability</td>+ <td><a href="#bytebase.v1.MCPSetting.Capability">MCPSetting.Capability</a></td>+ <td></td>+ <td><p>The maximum capability available to MCP sessions in this workspace, acting+as an admin-set ceiling. Enforced server-side at three points: the /mcp+endpoint decides whether a connection is admitted at all, the ceiling gate+on the internal MCP chain decides, per request, which method classes are+served, and under READ_ONLY the SQL clamp decides, per statement, whether+it only reads. </p></td>+ </tr>++ <tr>+ <td>ignore_masking_exemptions</td>+ <td><a href="#bool">bool</a></td>+ <td></td>+ <td><p>Whether a request that arrived over MCP stops applying the caller's own+unmasking provisioning. Two mechanisms let a user see a real value and this+suppresses both: the masking exemptions granted to them, and the unmask+carried by an access grant. The same user in the console is untouched.++It cannot force masking where there is none. Masking substitutes values in+query results, so this does not reach data copied into a column carrying no+masking policy, and it does nothing on the engines Bytebase does not mask.+It narrows what an agent reads through the paths Bytebase masks; it is not+a confidentiality boundary. </p></td>+ </tr>++ </tbody>+ </table>+++++<h3 id="bytebase.v1.SQLEditorThemeSetting">SQLEditorThemeSetting</h3><p></p>@@ -14374,6 +14423,13 @@ Example: "settings/SEMANTIC_TYPES" </p></td><td><p> </p></td></tr>+ <tr>+ <td>mcp</td>+ <td><a href="#bytebase.v1.MCPSetting">MCPSetting</a></td>+ <td></td>+ <td><p> </p></td>+ </tr>+</tbody></table>@@ -14762,17 +14818,6 @@ sql_editor_theme_id is a custom uuid. tokens is always complete. </p></td>Deprecated: use just-in-time access request flows instead. </p></td></tr>- <tr>- <td>mcp_capability</td>- <td><a href="#bytebase.v1.WorkspaceProfileSetting.MCPCapability">WorkspaceProfileSetting.MCPCapability</a></td>- <td></td>- <td><p>The maximum capability available to MCP (Model Context Protocol) sessions in-this workspace, acting as an admin-set ceiling. Unset is treated as-READ_WRITE for backward compatibility; DISABLED rejects all MCP-connections. Writing MCP_CAPABILITY_UNSPECIFIED explicitly is rejected —-omit the update mask path to leave the ceiling unset. </p></td>- </tr>-<tr><td>directory_sync_token_configured</td><td><a href="#bool">bool</a></td>@@ -15056,6 +15101,45 @@ Default to this mode.</p></td></tbody></table>+ <h3 id="bytebase.v1.MCPSetting.Capability">MCPSetting.Capability</h3>+ <p>Capability is the ceiling: a session runs at this level or lower. An absent</p><p>MCP setting resolves to READ_WRITE, so a workspace that never configured</p><p>MCP is unaffected. Writing CAPABILITY_UNSPECIFIED explicitly is rejected —</p><p>omit the update mask path to leave the ceiling unset.</p>+ <table class="enum-table">+ <thead>+ <tr><td>Name</td><td>Number</td><td>Description</td></tr>+ </thead>+ <tbody>++ <tr>+ <td>CAPABILITY_UNSPECIFIED</td>+ <td>0</td>+ <td><p></p></td>+ </tr>++ <tr>+ <td>DISABLED</td>+ <td>1</td>+ <td><p>MCP connections are rejected.</p></td>+ </tr>++ <tr>+ <td>READ_ONLY</td>+ <td>3</td>+ <td><p>MCP may inspect metadata and run read-only queries. A session opens, and+what it may do is decided per method by the capability gate and per+statement by the SQL clamp: a request holding a statement that is not a+read is refused whole, and where the engine's driver has one the+database session is opened read-only as well.</p></td>+ </tr>++ <tr>+ <td>READ_WRITE</td>+ <td>4</td>+ <td><p>MCP may perform mutations, still bounded by the user's RBAC.</p></td>+ </tr>++ </tbody>+ </table>+<h3 id="bytebase.v1.Setting.SettingName">Setting.SettingName</h3><p></p><table class="enum-table">@@ -15118,6 +15202,12 @@ Default to this mode.</p></td><td><p></p></td></tr>+ <tr>+ <td>MCP</td>+ <td>9</td>+ <td><p></p></td>+ </tr>+</tbody></table>@@ -15162,45 +15252,6 @@ Default to this mode.</p></td></tbody></table>- <h3 id="bytebase.v1.WorkspaceProfileSetting.MCPCapability">WorkspaceProfileSetting.MCPCapability</h3>- <p>MCPCapability is the maximum capability an MCP (Model Context Protocol)</p><p>session may have in the workspace. It is a ceiling: a session runs at this</p><p>level or lower. Unset (UNSPECIFIED) is treated as READ_WRITE so existing</p><p>workspaces are unaffected.</p>- <table class="enum-table">- <thead>- <tr><td>Name</td><td>Number</td><td>Description</td></tr>- </thead>- <tbody>-- <tr>- <td>MCP_CAPABILITY_UNSPECIFIED</td>- <td>0</td>- <td><p></p></td>- </tr>-- <tr>- <td>DISABLED</td>- <td>1</td>- <td><p>MCP connections are rejected.</p></td>- </tr>-- <tr>- <td>READ_ONLY</td>- <td>3</td>- <td><p>MCP may inspect metadata and run read-only queries. A session opens, and-what it may do is decided per method by the capability gate and per-statement by the SQL clamp: a request holding a statement that is not a-read is refused whole, and where the engine's driver has one the-database session is opened read-only as well.</p></td>- </tr>-- <tr>- <td>READ_WRITE</td>- <td>4</td>- <td><p>MCP may perform mutations, still bounded by the user's RBAC.</p></td>- </tr>-- </tbody>- </table>-diff --git a/proto/store/store/setting.proto b/proto/store/store/setting.protoindex d17a77ba1c..31edaff417 100644--- a/proto/store/store/setting.proto+++ b/proto/store/store/setting.proto@@ -22,6 +22,7 @@ enum SettingName {SEMANTIC_TYPES = 7;ENVIRONMENT = 8;EMAIL = 9;+ MCP = 10;}message SystemSetting {@@ -37,6 +38,11 @@ message SystemSetting {message WorkspaceProfileSetting {reserved 15;+ // 26 was mcp_capability, released in 3.21.0 and moved to the MCP setting.+ // A row still carrying the old key is inert: the shared unmarshaler discards+ // unknown fields, and nothing reads it. See store.GetMCPSettingsUncached.+ reserved 26;+ reserved "mcp_capability";message Announcement {reserved 1;reserved "level";@@ -66,22 +72,6 @@ message WorkspaceProfileSetting {EDITOR = 2;}- // MCPCapability is the maximum capability an MCP (Model Context Protocol)- // session may have in the workspace. It is a ceiling: a session runs at this- // level or lower. Unset (UNSPECIFIED) is treated as READ_WRITE so existing- // workspaces are unaffected.- enum MCPCapability {- MCP_CAPABILITY_UNSPECIFIED = 0;- // MCP connections are rejected.- DISABLED = 1;- // Was MCP_METADATA_ONLY; the Metadata-only tier is deferred out of the design.- reserved 2;- // MCP may inspect metadata and run read-only queries. (Enforced from P1b.)- READ_ONLY = 3;- // MCP may perform mutations, still bounded by the user's RBAC.- READ_WRITE = 4;- }-// The external URL is used for sso authentication callback.string external_url = 1;@@ -176,20 +166,54 @@ message WorkspaceProfileSetting {// Deprecated: use just-in-time access request flows instead.google.protobuf.Duration maximum_role_expiration = 25;- // The maximum capability available to MCP (Model Context Protocol) sessions in- // this workspace, acting as an admin-set ceiling. Unset is treated as- // READ_WRITE for backward compatibility; DISABLED rejects all MCP- // connections. Enforced server-side at two points: the /mcp endpoint decides- // whether a connection is admitted at all, and the ceiling gate on the- // internal MCP chain decides, per request, which method classes are served.- MCPCapability mcp_capability = 26;-// Hex-encoded SHA-256 of the SCIM directory sync token. The plaintext is shown// once at rotation and never stored. SHA-256 rather than a slow KDF because the// token is 122 bits of crypto/rand, not a human-chosen secret.string directory_sync_token_hash = 27;}+// MCPSetting is what an MCP (Model Context Protocol) session may do in this+// workspace. It is its own setting rather than a field of the workspace profile+// because the set grows, and because the /mcp kill switch reads it on every+// request and should not share a row — or a parse failure — with branding and+// sign-in configuration.+message MCPSetting {+ // Capability is the ceiling: a session runs at this level or lower. An absent+ // MCP setting resolves to READ_WRITE, so a workspace that never configured+ // MCP is unaffected.+ enum Capability {+ CAPABILITY_UNSPECIFIED = 0;+ // MCP connections are rejected.+ DISABLED = 1;+ // Was MCP_METADATA_ONLY; the Metadata-only tier is deferred out of the design.+ reserved 2;+ // MCP may inspect metadata and run read-only queries. (Enforced from P1b.)+ READ_ONLY = 3;+ // MCP may perform mutations, still bounded by the user's RBAC.+ READ_WRITE = 4;+ }++ // The maximum capability available to MCP sessions in this workspace, acting+ // as an admin-set ceiling. Enforced server-side at three points: the /mcp+ // endpoint decides whether a connection is admitted at all, the ceiling gate+ // on the internal MCP chain decides, per request, which method classes are+ // served, and under READ_ONLY the SQL clamp decides, per statement, whether+ // it only reads.+ Capability capability = 1;++ // Whether a request that arrived over MCP stops applying the caller's own+ // unmasking provisioning. Two mechanisms let a user see a real value and this+ // suppresses both: the masking exemptions granted to them, and the unmask+ // carried by an access grant. The same user in the console is untouched.+ //+ // It cannot force masking where there is none. Masking substitutes values in+ // query results, so this does not reach data copied into a column carrying no+ // masking policy, and it does nothing on the engines Bytebase does not mask.+ // It narrows what an agent reads through the paths Bytebase masks; it is not+ // a confidentiality boundary.+ bool ignore_masking_exemptions = 2;+}+message SQLEditorThemeSetting {string id = 1;string name = 2;diff --git a/proto/v1/v1/setting_service.proto b/proto/v1/v1/setting_service.protoindex 513504a8a4..93c95a15ff 100644--- a/proto/v1/v1/setting_service.proto+++ b/proto/v1/v1/setting_service.proto@@ -120,6 +120,7 @@ message Setting {SEMANTIC_TYPES = 6;ENVIRONMENT = 7;EMAIL = 8;+ MCP = 9;}// The resource name of the setting.@@ -142,6 +143,7 @@ message SettingValue {AISetting ai = 6;EnvironmentSetting environment = 7;EmailSetting email = 8;+ MCPSetting mcp = 9;}}@@ -193,6 +195,9 @@ message AppIMSetting {message WorkspaceProfileSetting {reserved 15;+ // 26 was mcp_capability, released in 3.21.0 and moved to the MCP setting.+ reserved 26;+ reserved "mcp_capability";// The external URL is used for sso authentication callback.string external_url = 1;@@ -287,12 +292,21 @@ message WorkspaceProfileSetting {// Deprecated: use just-in-time access request flows instead.google.protobuf.Duration maximum_role_expiration = 25;- // MCPCapability is the maximum capability an MCP (Model Context Protocol)- // session may have in the workspace. It is a ceiling: a session runs at this- // level or lower. Unset (UNSPECIFIED) is treated as READ_WRITE so existing- // workspaces are unaffected.- enum MCPCapability {- MCP_CAPABILITY_UNSPECIFIED = 0;+ // Whether a directory sync token has been generated for this workspace.+ // The token itself is never returned; this only lets the UI decide between+ // offering "generate" and "regenerate".+ bool directory_sync_token_configured = 27 [(google.api.field_behavior) = OUTPUT_ONLY];+}++// MCPSetting is what an MCP (Model Context Protocol) session may do in this+// workspace.+message MCPSetting {+ // Capability is the ceiling: a session runs at this level or lower. An absent+ // MCP setting resolves to READ_WRITE, so a workspace that never configured+ // MCP is unaffected. Writing CAPABILITY_UNSPECIFIED explicitly is rejected —+ // omit the update mask path to leave the ceiling unset.+ enum Capability {+ CAPABILITY_UNSPECIFIED = 0;// MCP connections are rejected.DISABLED = 1;// Was MCP_METADATA_ONLY; the Metadata-only tier is deferred out of the design.@@ -307,17 +321,25 @@ message WorkspaceProfileSetting {READ_WRITE = 4;}- // The maximum capability available to MCP (Model Context Protocol) sessions in- // this workspace, acting as an admin-set ceiling. Unset is treated as- // READ_WRITE for backward compatibility; DISABLED rejects all MCP- // connections. Writing MCP_CAPABILITY_UNSPECIFIED explicitly is rejected —- // omit the update mask path to leave the ceiling unset.- MCPCapability mcp_capability = 26;-- // Whether a directory sync token has been generated for this workspace.- // The token itself is never returned; this only lets the UI decide between- // offering "generate" and "regenerate".- bool directory_sync_token_configured = 27 [(google.api.field_behavior) = OUTPUT_ONLY];+ // The maximum capability available to MCP sessions in this workspace, acting+ // as an admin-set ceiling. Enforced server-side at three points: the /mcp+ // endpoint decides whether a connection is admitted at all, the ceiling gate+ // on the internal MCP chain decides, per request, which method classes are+ // served, and under READ_ONLY the SQL clamp decides, per statement, whether+ // it only reads.+ Capability capability = 1;++ // Whether a request that arrived over MCP stops applying the caller's own+ // unmasking provisioning. Two mechanisms let a user see a real value and this+ // suppresses both: the masking exemptions granted to them, and the unmask+ // carried by an access grant. The same user in the console is untouched.+ //+ // It cannot force masking where there is none. Masking substitutes values in+ // query results, so this does not reach data copied into a column carrying no+ // masking policy, and it does nothing on the engines Bytebase does not mask.+ // It narrows what an agent reads through the paths Bytebase masks; it is not+ // a confidentiality boundary.+ bool ignore_masking_exemptions = 2;}message SQLEditorThemeSetting {