Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

fix(mcp): enforce the FORBIDDEN method class on the internal chain (#21152)

Vincent Huang59b11f6a9500
diff --git a/backend/api/auth/auth.go b/backend/api/auth/auth.go
index fd39f59c35..4e9d8b8c06 100644
--- a/backend/api/auth/auth.go
+++ b/backend/api/auth/auth.go
@@ -484,11 +484,50 @@ func getAuthContext(fullMethod string) (*common.AuthContext, error) {
if !ok {
return nil, errs.Errorf("invalid audit extension, full method name %q", fullMethod)
}
+ mcpMethodClassAny := proto.GetExtension(md, v1pb.E_McpMethodClass)
+ mcpMethodClass, ok := mcpMethodClassAny.(v1pb.MCPMethodClass)
+ if !ok {
+ return nil, errs.Errorf("invalid MCP method class extension, full method name %q", fullMethod)
+ }
return &common.AuthContext{
AllowWithoutCredential: allowWithoutCredential,
Permission: permission,
AuthMethod: authMethod,
Audit: audit,
+ MCPMethodClass: mcpMethodClass,
}, nil
}
+
+// MCPMethodClassOfProcedure resolves the MCP classification for a connect
+// procedure path such as "/bytebase.v1.AuthService/Login". Callers that only
+// decide what to ADVERTISE may treat an error as "not classified"; the
+// enforcement path must not — it reads the class off the AuthContext, which
+// fails the request outright when the annotation cannot be resolved.
+func MCPMethodClassOfProcedure(procedure string) (v1pb.MCPMethodClass, error) {
+ tokens := strings.Split(procedure, "/")
+ if len(tokens) != 3 {
+ return v1pb.MCPMethodClass_MCP_METHOD_CLASS_UNSPECIFIED, errs.Errorf("invalid procedure name %q", procedure)
+ }
+ rd, err := protoregistry.GlobalFiles.FindDescriptorByName(protoreflect.FullName(tokens[1]))
+ if err != nil {
+ return v1pb.MCPMethodClass_MCP_METHOD_CLASS_UNSPECIFIED, errs.Wrapf(err, "invalid service descriptor for procedure %q", procedure)
+ }
+ sd, ok := rd.(protoreflect.ServiceDescriptor)
+ if !ok {
+ return v1pb.MCPMethodClass_MCP_METHOD_CLASS_UNSPECIFIED, errs.Errorf("invalid service descriptor for procedure %q", procedure)
+ }
+ method := sd.Methods().ByName(protoreflect.Name(tokens[2]))
+ if method == nil {
+ return v1pb.MCPMethodClass_MCP_METHOD_CLASS_UNSPECIFIED, errs.Errorf("unknown method for procedure %q", procedure)
+ }
+ md, ok := method.Options().(*descriptorpb.MethodOptions)
+ if !ok {
+ return v1pb.MCPMethodClass_MCP_METHOD_CLASS_UNSPECIFIED, errs.Errorf("invalid method options for procedure %q", procedure)
+ }
+ class, ok := proto.GetExtension(md, v1pb.E_McpMethodClass).(v1pb.MCPMethodClass)
+ if !ok {
+ return v1pb.MCPMethodClass_MCP_METHOD_CLASS_UNSPECIFIED, errs.Errorf("invalid MCP method class extension for procedure %q", procedure)
+ }
+ return class, nil
+}
diff --git a/backend/api/auth/auth_test.go b/backend/api/auth/auth_test.go
index 95ccb683a0..207a0deef5 100644
--- a/backend/api/auth/auth_test.go
+++ b/backend/api/auth/auth_test.go
@@ -5,6 +5,8 @@ import (
"github.com/golang-jwt/jwt/v5"
"github.com/stretchr/testify/require"
+
+ v1pb "github.com/bytebase/bytebase/backend/generated-go/v1"
)
// TestCheckTokenAudience pins the general-API audience policy for P1a PR 5:
@@ -58,3 +60,34 @@ func TestCheckTokenAudience(t *testing.T) {
require.Contains(t, err.Error(), "audience mismatch")
})
}
+
+// TestMCPMethodClassOfProcedure pins that the classification the gate enforces
+// is read from the annotation on the RPC, and that an unresolvable procedure
+// is an error rather than a quiet "unclassified".
+func TestMCPMethodClassOfProcedure(t *testing.T) {
+ for _, tc := range []struct {
+ procedure string
+ want v1pb.MCPMethodClass
+ }{
+ {"/bytebase.v1.AuthService/Login", v1pb.MCPMethodClass_FORBIDDEN},
+ {"/bytebase.v1.UserService/UpdateUser", v1pb.MCPMethodClass_FORBIDDEN},
+ {"/bytebase.v1.WorkspaceService/LeaveWorkspace", v1pb.MCPMethodClass_FORBIDDEN},
+ // Not yet classified — the rollout is method by method, and an
+ // unannotated RPC keeps serving exactly as before.
+ {"/bytebase.v1.UserService/GetUser", v1pb.MCPMethodClass_MCP_METHOD_CLASS_UNSPECIFIED},
+ {"/bytebase.v1.ProjectService/ListProjects", v1pb.MCPMethodClass_MCP_METHOD_CLASS_UNSPECIFIED},
+ } {
+ got, err := MCPMethodClassOfProcedure(tc.procedure)
+ require.NoError(t, err, tc.procedure)
+ require.Equal(t, tc.want, got, tc.procedure)
+ }
+
+ for _, procedure := range []string{
+ "not-a-procedure",
+ "/bytebase.v1.NoSuchService/Login",
+ "/bytebase.v1.AuthService/NoSuchMethod",
+ } {
+ _, err := MCPMethodClassOfProcedure(procedure)
+ require.Error(t, err, "%q must not resolve to a classification", procedure)
+ }
+}
diff --git a/backend/api/mcp/gen/openapi.yaml b/backend/api/mcp/gen/openapi.yaml
index e798973617..4956141a3b 100644
--- a/backend/api/mcp/gen/openapi.yaml
+++ b/backend/api/mcp/gen/openapi.yaml
@@ -14930,6 +14930,19 @@ components:
Protocol) server's delegated credential. The values are copied verbatim from
the verified credential's grant state; empty fields record that the grant
stored nothing (legacy sessions), never a resolved or synthesized value.
+ bytebase.v1.MCPMethodClass:
+ type: string
+ title: MCPMethodClass
+ enum:
+ - MCP_METHOD_CLASS_UNSPECIFIED
+ - READ
+ - WRITE
+ - FORBIDDEN
+ description: |-
+ Classification of an RPC for MCP (AI agent) sessions. The effective
+ authorization of an MCP session is this classification intersected with the
+ caller's own RBAC: it can only ever narrow what the human could do, never
+ widen it.
bytebase.v1.MaskingExemptionPolicy:
type: object
properties:
diff --git a/backend/api/mcp/openapi_index.go b/backend/api/mcp/openapi_index.go
index ca4b0f6249..06cf119d1f 100644
--- a/backend/api/mcp/openapi_index.go
+++ b/backend/api/mcp/openapi_index.go
@@ -11,6 +11,9 @@ import (
"github.com/pb33f/libopenapi"
v3base "github.com/pb33f/libopenapi/datamodel/high/base"
v3high "github.com/pb33f/libopenapi/datamodel/high/v3"
+
+ "github.com/bytebase/bytebase/backend/api/auth"
+ v1pb "github.com/bytebase/bytebase/backend/generated-go/v1"
)
//go:embed gen/openapi.yaml
@@ -66,12 +69,18 @@ type PropertyInfo struct {
// OpenAPIIndex is an indexed representation of the OpenAPI spec for fast lookup.
type OpenAPIIndex struct {
- doc *libopenapi.DocumentModel[v3high.Document]
- endpoints []EndpointInfo
- byOperation map[string]*EndpointInfo
- byService map[string][]*EndpointInfo
- services []string
- keywords map[string][]*EndpointInfo
+ doc *libopenapi.DocumentModel[v3high.Document]
+ // endpoints holds every endpoint an MCP session may be offered. Discovery
+ // walks this slice, so anything in it is advertisable by construction.
+ endpoints []EndpointInfo
+ // hiddenEndpoints holds the FORBIDDEN ones: resolvable through byOperation
+ // so a direct call still gets the gate's actionable denial, but reachable
+ // by no discovery path.
+ hiddenEndpoints []EndpointInfo
+ byOperation map[string]*EndpointInfo
+ byService map[string][]*EndpointInfo
+ services []string
+ keywords map[string][]*EndpointInfo
}
// NewOpenAPIIndex creates a new OpenAPI index from the embedded spec.
@@ -158,9 +167,25 @@ func (idx *OpenAPIIndex) parseSpec() {
}
}
+ // An endpoint an MCP session can never call is not advertised: it stays
+ // out of search results, service listings and the keyword index, so the
+ // agent is not offered work that will only ever come back refused. It
+ // lands in hiddenEndpoints rather than endpoints — every discovery path
+ // walks the latter, so keeping it out of that slice is what makes this
+ // hold for search paths added later, not just today's.
+ //
+ // It stays resolvable by operation ID on purpose: an agent that calls it
+ // anyway (from memory, or from a skill written before the
+ // classification) should meet the gate's actionable denial rather than
+ // "unknown operation".
+ if forbiddenToMCP(path) {
+ idx.hiddenEndpoints = append(idx.hiddenEndpoints, endpoint)
+ idx.byOperation[endpoint.OperationID] = &idx.hiddenEndpoints[len(idx.hiddenEndpoints)-1]
+ continue
+ }
+
idx.endpoints = append(idx.endpoints, endpoint)
ptr := &idx.endpoints[len(idx.endpoints)-1]
-
idx.byOperation[endpoint.OperationID] = ptr
idx.byService[service] = append(idx.byService[service], ptr)
serviceSet[service] = true
@@ -176,6 +201,19 @@ func (idx *OpenAPIIndex) parseSpec() {
slices.Sort(idx.services)
}
+// forbiddenToMCP reports whether the RPC behind a connect path is annotated
+// mcp_method_class = FORBIDDEN. A path whose descriptor cannot be resolved is
+// treated as not forbidden: this decides only what to advertise, and hiding a
+// legitimate endpoint because a lookup failed would be the worse failure —
+// enforcement is the interceptor's job and reads the annotation itself.
+func forbiddenToMCP(path string) bool {
+ class, err := auth.MCPMethodClassOfProcedure(path)
+ if err != nil {
+ return false
+ }
+ return class == v1pb.MCPMethodClass_FORBIDDEN
+}
+
func extractPermissions(description string) []string {
matches := permissionRegex.FindStringSubmatch(description)
if len(matches) < 2 {
diff --git a/backend/api/mcp/openapi_index_forbidden_test.go b/backend/api/mcp/openapi_index_forbidden_test.go
new file mode 100644
index 0000000000..661928e747
--- /dev/null
+++ b/backend/api/mcp/openapi_index_forbidden_test.go
@@ -0,0 +1,48 @@
+package mcp
+
+import (
+ "testing"
+
+ "github.com/stretchr/testify/require"
+)
+
+// TestForbiddenEndpointsAreNotAdvertised pins the two halves of how the index
+// treats a FORBIDDEN RPC: invisible to every discovery path an agent has, and
+// still resolvable by operation ID so a call that arrives anyway meets the
+// gate's actionable denial rather than "unknown operation, use search_api".
+func TestForbiddenEndpointsAreNotAdvertised(t *testing.T) {
+ idx, err := NewOpenAPIIndex()
+ require.NoError(t, err)
+
+ const forbidden = "bytebase.v1.AuthService.Login"
+ const forbiddenPath = "/bytebase.v1.AuthService/Login"
+ require.True(t, forbiddenToMCP(forbiddenPath), "precondition: Login is annotated FORBIDDEN")
+
+ t.Run("still resolvable by operation ID", func(t *testing.T) {
+ ep, ok := idx.GetEndpoint(forbidden)
+ require.True(t, ok, "call_api must still resolve it, so the denial can explain itself")
+ require.Equal(t, forbiddenPath, ep.Path)
+ })
+
+ t.Run("absent from service listings", func(t *testing.T) {
+ require.NotContains(t, idx.Services(), "AuthService",
+ "every AuthService RPC is FORBIDDEN, so the service itself has nothing to offer an agent")
+ require.Empty(t, idx.GetServiceEndpoints("AuthService"))
+ })
+
+ t.Run("absent from search", func(t *testing.T) {
+ for _, query := range []string{"login", "password", "workspace"} {
+ for _, hit := range idx.Search(query) {
+ require.False(t, forbiddenToMCP(hit.Path),
+ "search %q offered %s, which an MCP session can never call", query, hit.Path)
+ }
+ }
+ })
+
+ t.Run("reachable endpoints are unaffected", func(t *testing.T) {
+ _, ok := idx.GetEndpoint("bytebase.v1.ProjectService.ListProjects")
+ require.True(t, ok)
+ require.Contains(t, idx.Services(), "ProjectService")
+ require.NotEmpty(t, idx.Search("project"))
+ })
+}
diff --git a/backend/api/v1/mcp_forbidden.go b/backend/api/v1/mcp_forbidden.go
new file mode 100644
index 0000000000..41bf23fd3f
--- /dev/null
+++ b/backend/api/v1/mcp_forbidden.go
@@ -0,0 +1,125 @@
+package v1
+
+import (
+ "context"
+
+ "connectrpc.com/connect"
+ "github.com/pkg/errors"
+
+ "github.com/bytebase/bytebase/backend/common"
+ v1pb "github.com/bytebase/bytebase/backend/generated-go/v1"
+ "github.com/bytebase/bytebase/backend/generated-go/v1/v1connect"
+)
+
+// The reasons a method is forbidden to an MCP session. Each denial names one,
+// so the agent — and the operator reading the audit row — learns why rather
+// than just that it was refused. Each reason states what its methods actually
+// do: a denial whose stated reason has drifted from the mechanism is worse
+// than a bare refusal, because it is the thing the next reader trusts.
+const (
+ // reasonMintsCredential: the method hands a token back to the caller. For
+ // a non-web caller — and an MCP session is always one — finalizeLogin and
+ // switchWorkspaceInternal put a plain bb.user.access token in the response
+ // body. That token is not audience-bound to the MCP resource, survives
+ // revocation of the OAuth grant, and ignores the workspace MCP kill
+ // switch, so obtaining one ends the MCP boundary for good.
+ reasonMintsCredential = "it hands back a login token that would outlive the MCP grant"
+ // reasonResetsCredential: the method drives the out-of-band reset flow —
+ // mailing a reset or login code, or consuming one — that sets or delivers
+ // the very secret Login accepts. Denying Login alone would leave the
+ // agent holding the credential for the next human login.
+ reasonResetsCredential = "it drives the credential-reset flow that sets or delivers the secret a login accepts"
+ // reasonTakesOverAccount: UpdateUser's password and MFA branches authorize
+ // on caller == subject alone, with no permission check and no proof of the
+ // old password, so an MCP session can rewrite its own user's credentials
+ // and then log in with them. The whole method is refused, not just those
+ // branches — the classification is per method.
+ reasonTakesOverAccount = "it can rewrite the account's own credentials, which would let the session take the account over"
+ // reasonEndsSession: Logout deletes the web refresh token and expires the
+ // session cookies. It mints nothing; it destroys the human's own login
+ // session, which an agent acting on their behalf has no business doing.
+ reasonEndsSession = "it ends the human's own login session"
+ // reasonEndsMembership: the workspace-lifecycle pair. Both end in
+ // AuthService.switchWorkspaceInternal, which mints a plain workspace token
+ // whenever the caller has no refresh cookie — and an MCP session never has
+ // one — after having already destroyed the caller's membership.
+ reasonEndsMembership = "it destroys the caller's own workspace membership and mints a plain workspace token"
+ // reasonForbiddenClass is the fallback for a method annotated FORBIDDEN
+ // that has no entry below. Adding the annotation is what denies the
+ // method; the table only supplies better wording.
+ reasonForbiddenClass = "it is not reachable by an AI agent session"
+)
+
+// mcpForbiddenReasons is UX copy, NOT the classification. What a method is
+// classified as lives on the RPC itself, as the bytebase.v1.mcp_method_class
+// annotation, beside permission / audit / auth_method — one source of truth,
+// visible where the RPC is defined, and read here off the AuthContext the auth
+// interceptor already resolves. This table only turns that classification into
+// a sentence the agent can act on, and a missing row costs wording, never
+// enforcement.
+var mcpForbiddenReasons = map[string]string{
+ // Methods that put a token in the response body.
+ v1connect.AuthServiceLoginProcedure: reasonMintsCredential,
+ v1connect.AuthServiceSignupProcedure: reasonMintsCredential,
+ v1connect.AuthServiceExchangeTokenProcedure: reasonMintsCredential,
+ v1connect.AuthServiceRefreshProcedure: reasonMintsCredential,
+ v1connect.AuthServiceSwitchWorkspaceProcedure: reasonMintsCredential,
+
+ // Methods that set or deliver the secret those tokens are issued against.
+ v1connect.AuthServiceRequestPasswordResetProcedure: reasonResetsCredential,
+ v1connect.AuthServiceResetPasswordProcedure: reasonResetsCredential,
+ v1connect.AuthServiceSendEmailLoginCodeProcedure: reasonResetsCredential,
+
+ // Self-service account mutation.
+ v1connect.UserServiceUpdateUserProcedure: reasonTakesOverAccount,
+
+ // Session teardown.
+ v1connect.AuthServiceLogoutProcedure: reasonEndsSession,
+
+ // Workspace lifecycle.
+ v1connect.WorkspaceServiceLeaveWorkspaceProcedure: reasonEndsMembership,
+ v1connect.WorkspaceServiceDeleteWorkspaceProcedure: reasonEndsMembership,
+}
+
+// NewInternalMCPForbiddenInterceptor denies every method annotated
+// mcp_method_class = FORBIDDEN before dispatch. It belongs to the internal MCP
+// chain only — every request there originates at /mcp — and sits inside the
+// audit interceptor, outside ACL: the class is refused regardless of what RBAC
+// would have said.
+//
+// Only FORBIDDEN is enforced. READ and WRITE are the serving classes P1b's
+// ceiling modes select between, and until every RPC carries a classification
+// an unannotated method is served exactly as before — the rollout is method by
+// method, and this interceptor grows with the annotations rather than with a
+// list kept here.
+//
+// Sitting inside audit gets the denial a row for the methods that carry the
+// audit annotation, which is all twelve currently annotated FORBIDDEN bar
+// SwitchWorkspace, Refresh, RequestPasswordReset and ResetPassword: needAudit
+// reads that annotation and nothing else, so those four are denied silently
+// until 1b-2 lands the typed policy-denial record that bypasses it.
+func NewInternalMCPForbiddenInterceptor() connect.Interceptor {
+ return connect.UnaryInterceptorFunc(func(next connect.UnaryFunc) connect.UnaryFunc {
+ return func(ctx context.Context, req connect.AnyRequest) (connect.AnyResponse, error) {
+ authCtx, ok := common.GetAuthContextFromContext(ctx)
+ if !ok {
+ // The auth interceptor runs first and always sets this. Its
+ // absence means the chain was reordered, and guessing which
+ // class a method is in is exactly the wrong response.
+ return nil, connect.NewError(connect.CodeInternal,
+ errors.New("MCP method classification unavailable: no auth context"))
+ }
+ if authCtx.MCPMethodClass != v1pb.MCPMethodClass_FORBIDDEN {
+ return next(ctx, req)
+ }
+ procedure := req.Spec().Procedure
+ reason, ok := mcpForbiddenReasons[procedure]
+ if !ok {
+ reason = reasonForbiddenClass
+ }
+ return nil, connect.NewError(connect.CodePermissionDenied, errors.Errorf(
+ "%s is not available to MCP sessions because %s. Perform this action signed in to the Bytebase console instead",
+ procedure, reason))
+ }
+ })
+}
diff --git a/backend/api/v1/mcp_forbidden_test.go b/backend/api/v1/mcp_forbidden_test.go
new file mode 100644
index 0000000000..a71c96b928
--- /dev/null
+++ b/backend/api/v1/mcp_forbidden_test.go
@@ -0,0 +1,150 @@
+package v1
+
+import (
+ "context"
+ "fmt"
+ "testing"
+
+ "connectrpc.com/connect"
+ "github.com/stretchr/testify/require"
+ "google.golang.org/protobuf/proto"
+ "google.golang.org/protobuf/reflect/protoreflect"
+ "google.golang.org/protobuf/reflect/protoregistry"
+
+ "github.com/bytebase/bytebase/backend/common"
+ v1pb "github.com/bytebase/bytebase/backend/generated-go/v1"
+ "github.com/bytebase/bytebase/backend/generated-go/v1/v1connect"
+)
+
+// forbiddenProceduresFromDescriptors reads the FORBIDDEN class straight off
+// the compiled descriptors — the same place getAuthContext reads it — so the
+// assertions below are against the annotations themselves, not against a Go
+// copy of them that could agree with itself while the protos say otherwise.
+func forbiddenProceduresFromDescriptors(t *testing.T) map[string]bool {
+ t.Helper()
+ found := map[string]bool{}
+ protoregistry.GlobalFiles.RangeFiles(func(fd protoreflect.FileDescriptor) bool {
+ if fd.Package() != "bytebase.v1" {
+ return true
+ }
+ services := fd.Services()
+ for i := range services.Len() {
+ sd := services.Get(i)
+ methods := sd.Methods()
+ for j := range methods.Len() {
+ md := methods.Get(j)
+ class, ok := proto.GetExtension(md.Options(), v1pb.E_McpMethodClass).(v1pb.MCPMethodClass)
+ require.True(t, ok, "method %s carries a malformed mcp_method_class", md.FullName())
+ if class == v1pb.MCPMethodClass_FORBIDDEN {
+ found[fmt.Sprintf("/%s/%s", sd.FullName(), md.Name())] = true
+ }
+ }
+ }
+ return true
+ })
+ return found
+}
+
+// TestForbiddenClassMembership pins which RPCs are annotated FORBIDDEN.
+// Membership is a security decision, so adding or removing one has to be
+// deliberate: this list is the second signature on that decision.
+func TestForbiddenClassMembership(t *testing.T) {
+ want := []string{
+ v1connect.AuthServiceLoginProcedure,
+ v1connect.AuthServiceSignupProcedure,
+ v1connect.AuthServiceExchangeTokenProcedure,
+ v1connect.AuthServiceRefreshProcedure,
+ v1connect.AuthServiceLogoutProcedure,
+ v1connect.AuthServiceRequestPasswordResetProcedure,
+ v1connect.AuthServiceResetPasswordProcedure,
+ v1connect.AuthServiceSendEmailLoginCodeProcedure,
+ v1connect.AuthServiceSwitchWorkspaceProcedure,
+ v1connect.UserServiceUpdateUserProcedure,
+ v1connect.WorkspaceServiceLeaveWorkspaceProcedure,
+ v1connect.WorkspaceServiceDeleteWorkspaceProcedure,
+ }
+ got := forbiddenProceduresFromDescriptors(t)
+
+ for _, procedure := range want {
+ require.True(t, got[procedure], "%s must be annotated mcp_method_class = FORBIDDEN", procedure)
+ }
+ require.Len(t, got, len(want),
+ "an RPC was annotated FORBIDDEN without being added here; membership must be an explicit decision")
+
+ // Every member should also carry wording an agent can act on. A missing
+ // row is a UX regression, not a security one — the annotation is what
+ // denies — so this is asserted separately from membership.
+ for _, procedure := range want {
+ require.Contains(t, mcpForbiddenReasons, procedure,
+ "%s has no actionable denial reason", procedure)
+ }
+ require.Len(t, mcpForbiddenReasons, len(want), "a reason row outlived its method")
+
+ // The reason has to describe what the method does, not merely be present:
+ // Logout destroys a session rather than issuing a credential, and a denial
+ // that says otherwise teaches the next reader something false.
+ require.Equal(t, reasonEndsSession, mcpForbiddenReasons[v1connect.AuthServiceLogoutProcedure],
+ "Logout mints nothing — it deletes the refresh token and expires the cookies")
+ require.Equal(t, reasonMintsCredential, mcpForbiddenReasons[v1connect.AuthServiceLoginProcedure])
+ require.Equal(t, reasonResetsCredential, mcpForbiddenReasons[v1connect.AuthServiceResetPasswordProcedure])
+ require.Equal(t, reasonTakesOverAccount, mcpForbiddenReasons[v1connect.UserServiceUpdateUserProcedure])
+ require.Equal(t, reasonEndsMembership, mcpForbiddenReasons[v1connect.WorkspaceServiceDeleteWorkspaceProcedure])
+}
+
+// TestInternalMCPForbiddenInterceptor pins what the interceptor does with a
+// classification once the auth interceptor has resolved one.
+func TestInternalMCPForbiddenInterceptor(t *testing.T) {
+ interceptor := NewInternalMCPForbiddenInterceptor()
+
+ invoke := func(ctx context.Context, procedure string) (bool, error) {
+ dispatched := false
+ next := func(_ context.Context, _ connect.AnyRequest) (connect.AnyResponse, error) {
+ dispatched = true
+ return connect.NewResponse(&v1pb.User{}), nil
+ }
+ req := &specRequest{
+ AnyRequest: connect.NewRequest(&v1pb.GetUserRequest{}),
+ procedure: procedure,
+ }
+ _, err := interceptor.WrapUnary(next)(ctx, req)
+ return dispatched, err
+ }
+ withClass := func(class v1pb.MCPMethodClass) context.Context {
+ return context.WithValue(context.Background(), common.AuthContextKey,
+ &common.AuthContext{MCPMethodClass: class})
+ }
+
+ for procedure := range forbiddenProceduresFromDescriptors(t) {
+ t.Run(procedure, func(t *testing.T) {
+ dispatched, err := invoke(withClass(v1pb.MCPMethodClass_FORBIDDEN), procedure)
+ require.Error(t, err, "a FORBIDDEN method must never reach its handler")
+ require.False(t, dispatched, "the denial must happen before dispatch, so no handler side effect can land")
+ require.Equal(t, connect.CodePermissionDenied, connect.CodeOf(err))
+ require.Contains(t, err.Error(), procedure, "the message must name the method the agent called")
+ require.Contains(t, err.Error(), mcpForbiddenReasons[procedure],
+ "the message must name why, so the agent can act on it")
+ })
+ }
+
+ // Only FORBIDDEN is enforced in this phase: an unclassified method is
+ // served exactly as before, and the serving classes 1b-2 will select
+ // between are not gated here yet.
+ for name, class := range map[string]v1pb.MCPMethodClass{
+ "unclassified": v1pb.MCPMethodClass_MCP_METHOD_CLASS_UNSPECIFIED,
+ "read": v1pb.MCPMethodClass_READ,
+ "write": v1pb.MCPMethodClass_WRITE,
+ } {
+ t.Run("dispatched: "+name, func(t *testing.T) {
+ dispatched, err := invoke(withClass(class), v1connect.UserServiceGetUserProcedure)
+ require.NoError(t, err)
+ require.True(t, dispatched)
+ })
+ }
+
+ t.Run("no auth context fails closed", func(t *testing.T) {
+ dispatched, err := invoke(context.Background(), v1connect.AuthServiceLoginProcedure)
+ require.Error(t, err, "without a resolved classification the interceptor must not guess")
+ require.False(t, dispatched)
+ require.Equal(t, connect.CodeInternal, connect.CodeOf(err))
+ })
+}
diff --git a/backend/api/v1/workspace_service_mcp_test.go b/backend/api/v1/workspace_service_mcp_test.go
new file mode 100644
index 0000000000..42d2d66a27
--- /dev/null
+++ b/backend/api/v1/workspace_service_mcp_test.go
@@ -0,0 +1,56 @@
+package v1
+
+import (
+ "context"
+ "testing"
+
+ "connectrpc.com/connect"
+ "github.com/stretchr/testify/require"
+
+ "github.com/bytebase/bytebase/backend/common"
+ v1pb "github.com/bytebase/bytebase/backend/generated-go/v1"
+ "github.com/bytebase/bytebase/backend/store"
+)
+
+// TestLeaveAndDeleteWorkspaceRefuseMCPCaller pins the BOT-49 handler guards
+// where the FORBIDDEN interceptor can no longer reach them. The e2e tests used
+// to discriminate on the refusal message, so deleting a handler guard turned
+// them red; now the interceptor answers first and those tests stay green
+// either way. What still depends on the handler guard is ORDERING: it runs
+// ahead of the IAM mutation, so a refused caller is not left stranded outside
+// the workspace it was just removed from.
+//
+// Both services carry a nil store and a nil profile on purpose. The guard has
+// to return before either is touched, so a regression panics or answers a
+// different code rather than quietly mutating.
+func TestLeaveAndDeleteWorkspaceRefuseMCPCaller(t *testing.T) {
+ s := &WorkspaceService{authService: &AuthService{secret: "test-secret"}}
+
+ // The internal transport's marker: the AuthContext carries the delegated
+ // grant, and its presence alone — no header, no field value — makes the
+ // request MCP-originated.
+ ctx := context.WithValue(context.Background(), common.AuthContextKey,
+ &common.AuthContext{DelegatedGrant: &common.DelegatedGrant{}})
+ // A resolved caller, so a regressed guard runs on into the store rather
+ // than stopping at the unauthenticated check and returning a code that
+ // happens to differ.
+ ctx = context.WithValue(ctx, common.UserContextKey, &store.UserMessage{Email: "[email protected]"})
+
+ t.Run("LeaveWorkspace", func(t *testing.T) {
+ resp, err := s.LeaveWorkspace(ctx, connect.NewRequest(&v1pb.LeaveWorkspaceRequest{
+ Name: "workspaces/ws-test",
+ }))
+ require.Nil(t, resp)
+ require.Equal(t, connect.CodePermissionDenied, connect.CodeOf(err),
+ "the guard must refuse before the IAM bindings are touched")
+ })
+
+ t.Run("DeleteWorkspace", func(t *testing.T) {
+ resp, err := s.DeleteWorkspace(ctx, connect.NewRequest(&v1pb.DeleteWorkspaceRequest{
+ Name: "workspaces/ws-test",
+ }))
+ require.Nil(t, resp)
+ require.Equal(t, connect.CodePermissionDenied, connect.CodeOf(err),
+ "the guard must refuse ahead of every other check in the handler")
+ })
+}
diff --git a/backend/common/context.go b/backend/common/context.go
index e9f4043884..662237dc7b 100644
--- a/backend/common/context.go
+++ b/backend/common/context.go
@@ -5,6 +5,8 @@ import (
"context"
"google.golang.org/protobuf/types/known/anypb"
+
+ v1pb "github.com/bytebase/bytebase/backend/generated-go/v1"
)
// ContextKey is the key type of context value.
@@ -128,7 +130,14 @@ type AuthContext struct {
AllowWithoutCredential bool
Permission string
AuthMethod AuthMethod
- Resources []*Resource
+ // MCPMethodClass is the method's bytebase.v1.mcp_method_class annotation.
+ // The effective authorization of an MCP session is this classification
+ // intersected with the caller's own RBAC — it only ever narrows. Only
+ // FORBIDDEN is enforced today; READ and WRITE are the serving classes
+ // P1b's ceiling modes select between, and UNSPECIFIED means "not yet
+ // classified" rather than "safe".
+ MCPMethodClass v1pb.MCPMethodClass
+ Resources []*Resource
// DelegatedGrant carries the grant state of the delegated MCP credential
// on internal-chain requests; nil on the public chain. Presence, not any
// field value, marks a request as MCP-originated.
diff --git a/backend/generated-go/v1/annotation.pb.go b/backend/generated-go/v1/annotation.pb.go
index 658a58c865..be45b30359 100644
--- a/backend/generated-go/v1/annotation.pb.go
+++ b/backend/generated-go/v1/annotation.pb.go
@@ -1,6 +1,6 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
-// protoc-gen-go v1.36.11
+// protoc-gen-go v1.36.12
// protoc (unknown)
// source: v1/annotation.proto
@@ -75,6 +75,71 @@ func (AuthMethod) EnumDescriptor() ([]byte, []int) {
return file_v1_annotation_proto_rawDescGZIP(), []int{0}
}
+// Classification of an RPC for MCP (AI agent) sessions. The effective
+// authorization of an MCP session is this classification intersected with the
+// caller's own RBAC: it can only ever narrow what the human could do, never
+// widen it.
+type MCPMethodClass int32
+
+const (
+ // Not yet classified. Reaches its handler, subject to RBAC as usual —
+ // the classification is being rolled out method by method, and only
+ // FORBIDDEN is enforced today.
+ MCPMethodClass_MCP_METHOD_CLASS_UNSPECIFIED MCPMethodClass = 0
+ // Served to a read-only MCP session and above.
+ MCPMethodClass_READ MCPMethodClass = 1
+ // Served to a read-write MCP session only.
+ MCPMethodClass_WRITE MCPMethodClass = 2
+ // Never reachable by an MCP session, whatever the caller's own
+ // permissions are. These methods escape the MCP boundary rather than
+ // merely exercising a permission: a human with the permission uses the
+ // console; an agent acting for them does not get to.
+ MCPMethodClass_FORBIDDEN MCPMethodClass = 3
+)
+
+// Enum value maps for MCPMethodClass.
+var (
+ MCPMethodClass_name = map[int32]string{
+ 0: "MCP_METHOD_CLASS_UNSPECIFIED",
+ 1: "READ",
+ 2: "WRITE",
+ 3: "FORBIDDEN",
+ }
+ MCPMethodClass_value = map[string]int32{
+ "MCP_METHOD_CLASS_UNSPECIFIED": 0,
+ "READ": 1,
+ "WRITE": 2,
+ "FORBIDDEN": 3,
+ }
+)
+
+func (x MCPMethodClass) Enum() *MCPMethodClass {
+ p := new(MCPMethodClass)
+ *p = x
+ return p
+}
+
+func (x MCPMethodClass) String() string {
+ return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
+}
+
+func (MCPMethodClass) Descriptor() protoreflect.EnumDescriptor {
+ return file_v1_annotation_proto_enumTypes[1].Descriptor()
+}
+
+func (MCPMethodClass) Type() protoreflect.EnumType {
+ return &file_v1_annotation_proto_enumTypes[1]
+}
+
+func (x MCPMethodClass) Number() protoreflect.EnumNumber {
+ return protoreflect.EnumNumber(x)
+}
+
+// Deprecated: Use MCPMethodClass.Descriptor instead.
+func (MCPMethodClass) EnumDescriptor() ([]byte, []int) {
+ return file_v1_annotation_proto_rawDescGZIP(), []int{1}
+}
+
var file_v1_annotation_proto_extTypes = []protoimpl.ExtensionInfo{
{
ExtendedType: (*descriptorpb.MethodOptions)(nil),
@@ -108,6 +173,14 @@ var file_v1_annotation_proto_extTypes = []protoimpl.ExtensionInfo{
Tag: "varint,100003,opt,name=audit",
Filename: "v1/annotation.proto",
},
+ {
+ ExtendedType: (*descriptorpb.MethodOptions)(nil),
+ ExtensionType: (*MCPMethodClass)(nil),
+ Field: 100004,
+ Name: "bytebase.v1.mcp_method_class",
+ Tag: "varint,100004,opt,name=mcp_method_class,enum=bytebase.v1.MCPMethodClass",
+ Filename: "v1/annotation.proto",
+ },
}
// Extension fields to descriptorpb.MethodOptions.
@@ -128,6 +201,10 @@ var (
//
// optional bool audit = 100003;
E_Audit = &file_v1_annotation_proto_extTypes[3]
+ // How the method is classified for MCP (AI agent) sessions.
+ //
+ // optional bytebase.v1.MCPMethodClass mcp_method_class = 100004;
+ E_McpMethodClass = &file_v1_annotation_proto_extTypes[4]
)
var File_v1_annotation_proto protoreflect.FileDescriptor
@@ -140,14 +217,20 @@ const file_v1_annotation_proto_rawDesc = "" +
"\x17AUTH_METHOD_UNSPECIFIED\x10\x00\x12\a\n" +
"\x03IAM\x10\x01\x12\n" +
"\n" +
- "\x06CUSTOM\x10\x02:Z\n" +
+ "\x06CUSTOM\x10\x02*V\n" +
+ "\x0eMCPMethodClass\x12 \n" +
+ "\x1cMCP_METHOD_CLASS_UNSPECIFIED\x10\x00\x12\b\n" +
+ "\x04READ\x10\x01\x12\t\n" +
+ "\x05WRITE\x10\x02\x12\r\n" +
+ "\tFORBIDDEN\x10\x03:Z\n" +
"\x18allow_without_credential\x12\x1e.google.protobuf.MethodOptions\x18\xa0\x8d\x06 \x01(\bR\x16allowWithoutCredential:@\n" +
"\n" +
"permission\x12\x1e.google.protobuf.MethodOptions\x18\xa1\x8d\x06 \x01(\tR\n" +
"permission:Z\n" +
"\vauth_method\x12\x1e.google.protobuf.MethodOptions\x18\xa2\x8d\x06 \x01(\x0e2\x17.bytebase.v1.AuthMethodR\n" +
"authMethod:6\n" +
- "\x05audit\x12\x1e.google.protobuf.MethodOptions\x18\xa3\x8d\x06 \x01(\bR\x05auditB\xa5\x01\n" +
+ "\x05audit\x12\x1e.google.protobuf.MethodOptions\x18\xa3\x8d\x06 \x01(\bR\x05audit:g\n" +
+ "\x10mcp_method_class\x12\x1e.google.protobuf.MethodOptions\x18\xa4\x8d\x06 \x01(\x0e2\x1b.bytebase.v1.MCPMethodClassR\x0emcpMethodClassB\xa5\x01\n" +
"\x0fcom.bytebase.v1B\x0fAnnotationProtoP\x01Z4github.com/bytebase/bytebase/backend/generated-go/v1\xa2\x02\x03BXX\xaa\x02\vBytebase.V1\xca\x02\vBytebase\\V1\xe2\x02\x17Bytebase\\V1\\GPBMetadata\xea\x02\fBytebase::V1b\x06proto3"
var (
@@ -162,21 +245,24 @@ func file_v1_annotation_proto_rawDescGZIP() []byte {
return file_v1_annotation_proto_rawDescData
}
-var file_v1_annotation_proto_enumTypes = make([]protoimpl.EnumInfo, 1)
+var file_v1_annotation_proto_enumTypes = make([]protoimpl.EnumInfo, 2)
var file_v1_annotation_proto_goTypes = []any{
(AuthMethod)(0), // 0: bytebase.v1.AuthMethod
- (*descriptorpb.MethodOptions)(nil), // 1: google.protobuf.MethodOptions
+ (MCPMethodClass)(0), // 1: bytebase.v1.MCPMethodClass
+ (*descriptorpb.MethodOptions)(nil), // 2: google.protobuf.MethodOptions
}
var file_v1_annotation_proto_depIdxs = []int32{
- 1, // 0: bytebase.v1.allow_without_credential:extendee -> google.protobuf.MethodOptions
- 1, // 1: bytebase.v1.permission:extendee -> google.protobuf.MethodOptions
- 1, // 2: bytebase.v1.auth_method:extendee -> google.protobuf.MethodOptions
- 1, // 3: bytebase.v1.audit:extendee -> google.protobuf.MethodOptions
- 0, // 4: bytebase.v1.auth_method:type_name -> bytebase.v1.AuthMethod
- 5, // [5:5] is the sub-list for method output_type
- 5, // [5:5] is the sub-list for method input_type
- 4, // [4:5] is the sub-list for extension type_name
- 0, // [0:4] is the sub-list for extension extendee
+ 2, // 0: bytebase.v1.allow_without_credential:extendee -> google.protobuf.MethodOptions
+ 2, // 1: bytebase.v1.permission:extendee -> google.protobuf.MethodOptions
+ 2, // 2: bytebase.v1.auth_method:extendee -> google.protobuf.MethodOptions
+ 2, // 3: bytebase.v1.audit:extendee -> google.protobuf.MethodOptions
+ 2, // 4: bytebase.v1.mcp_method_class:extendee -> google.protobuf.MethodOptions
+ 0, // 5: bytebase.v1.auth_method:type_name -> bytebase.v1.AuthMethod
+ 1, // 6: bytebase.v1.mcp_method_class:type_name -> bytebase.v1.MCPMethodClass
+ 7, // [7:7] is the sub-list for method output_type
+ 7, // [7:7] is the sub-list for method input_type
+ 5, // [5:7] is the sub-list for extension type_name
+ 0, // [0:5] is the sub-list for extension extendee
0, // [0:0] is the sub-list for field type_name
}
@@ -190,9 +276,9 @@ func file_v1_annotation_proto_init() {
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: unsafe.Slice(unsafe.StringData(file_v1_annotation_proto_rawDesc), len(file_v1_annotation_proto_rawDesc)),
- NumEnums: 1,
+ NumEnums: 2,
NumMessages: 0,
- NumExtensions: 4,
+ NumExtensions: 5,
NumServices: 0,
},
GoTypes: file_v1_annotation_proto_goTypes,
diff --git a/backend/generated-go/v1/auth_service.pb.go b/backend/generated-go/v1/auth_service.pb.go
index 44f1461439..579b5947e5 100644
--- a/backend/generated-go/v1/auth_service.pb.go
+++ b/backend/generated-go/v1/auth_service.pb.go
@@ -1,6 +1,6 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
-// protoc-gen-go v1.36.11
+// protoc-gen-go v1.36.12
// protoc (unknown)
// source: v1/auth_service.proto
@@ -1012,17 +1012,17 @@ const file_v1_auth_service_proto_rawDesc = "" +
"\x0emfa_temp_token\x18\x05 \x01(\tH\x02R\fmfaTempToken\x88\x01\x01B\v\n" +
"\t_otp_codeB\x10\n" +
"\x0e_recovery_codeB\x11\n" +
- "\x0f_mfa_temp_token2\xa3\b\n" +
- "\vAuthService\x12a\n" +
- "\x05Login\x12\x19.bytebase.v1.LoginRequest\x1a\x1a.bytebase.v1.LoginResponse\"!\x80\xea0\x01\x98\xea0\x01\x82\xd3\xe4\x93\x02\x13:\x01*\"\x0e/v1/auth/login\x12`\n" +
- "\x06Logout\x12\x1a.bytebase.v1.LogoutRequest\x1a\x16.google.protobuf.Empty\"\"\x80\xea0\x01\x98\xea0\x01\x82\xd3\xe4\x93\x02\x14:\x01*\"\x0f/v1/auth/logout\x12\x81\x01\n" +
- "\rExchangeToken\x12!.bytebase.v1.ExchangeTokenRequest\x1a\".bytebase.v1.ExchangeTokenResponse\")\x80\xea0\x01\x98\xea0\x01\x82\xd3\xe4\x93\x02\x1b:\x01*\"\x16/v1/auth:exchangeToken\x12d\n" +
- "\x06Signup\x12\x1a.bytebase.v1.SignupRequest\x1a\x1a.bytebase.v1.LoginResponse\"\"\x80\xea0\x01\x98\xea0\x01\x82\xd3\xe4\x93\x02\x14:\x01*\"\x0f/v1/auth/signup\x12e\n" +
- "\aRefresh\x12\x1b.bytebase.v1.RefreshRequest\x1a\x1c.bytebase.v1.RefreshResponse\"\x1f\x80\xea0\x01\x82\xd3\xe4\x93\x02\x15:\x01*\"\x10/v1/auth/refresh\x12{\n" +
- "\x0fSwitchWorkspace\x12#.bytebase.v1.SwitchWorkspaceRequest\x1a\x1a.bytebase.v1.LoginResponse\"'\x90\xea0\x02\x82\xd3\xe4\x93\x02\x1d:\x01*\"\x18/v1/auth:switchWorkspace\x12\x86\x01\n" +
- "\x14RequestPasswordReset\x12(.bytebase.v1.RequestPasswordResetRequest\x1a\x16.google.protobuf.Empty\",\x80\xea0\x01\x82\xd3\xe4\x93\x02\":\x01*\"\x1d/v1/auth:requestPasswordReset\x12q\n" +
- "\rResetPassword\x12!.bytebase.v1.ResetPasswordRequest\x1a\x16.google.protobuf.Empty\"%\x80\xea0\x01\x82\xd3\xe4\x93\x02\x1b:\x01*\"\x16/v1/auth:resetPassword\x12\x84\x01\n" +
- "\x12SendEmailLoginCode\x12&.bytebase.v1.SendEmailLoginCodeRequest\x1a\x16.google.protobuf.Empty\".\x80\xea0\x01\x98\xea0\x01\x82\xd3\xe4\x93\x02 :\x01*\"\x1b/v1/auth:sendEmailLoginCodeB\xa6\x01\n" +
+ "\x0f_mfa_temp_token2\xc7\b\n" +
+ "\vAuthService\x12e\n" +
+ "\x05Login\x12\x19.bytebase.v1.LoginRequest\x1a\x1a.bytebase.v1.LoginResponse\"%\x80\xea0\x01\x98\xea0\x01\xa0\xea0\x03\x82\xd3\xe4\x93\x02\x13:\x01*\"\x0e/v1/auth/login\x12d\n" +
+ "\x06Logout\x12\x1a.bytebase.v1.LogoutRequest\x1a\x16.google.protobuf.Empty\"&\x80\xea0\x01\x98\xea0\x01\xa0\xea0\x03\x82\xd3\xe4\x93\x02\x14:\x01*\"\x0f/v1/auth/logout\x12\x85\x01\n" +
+ "\rExchangeToken\x12!.bytebase.v1.ExchangeTokenRequest\x1a\".bytebase.v1.ExchangeTokenResponse\"-\x80\xea0\x01\x98\xea0\x01\xa0\xea0\x03\x82\xd3\xe4\x93\x02\x1b:\x01*\"\x16/v1/auth:exchangeToken\x12h\n" +
+ "\x06Signup\x12\x1a.bytebase.v1.SignupRequest\x1a\x1a.bytebase.v1.LoginResponse\"&\x80\xea0\x01\x98\xea0\x01\xa0\xea0\x03\x82\xd3\xe4\x93\x02\x14:\x01*\"\x0f/v1/auth/signup\x12i\n" +
+ "\aRefresh\x12\x1b.bytebase.v1.RefreshRequest\x1a\x1c.bytebase.v1.RefreshResponse\"#\x80\xea0\x01\xa0\xea0\x03\x82\xd3\xe4\x93\x02\x15:\x01*\"\x10/v1/auth/refresh\x12\x7f\n" +
+ "\x0fSwitchWorkspace\x12#.bytebase.v1.SwitchWorkspaceRequest\x1a\x1a.bytebase.v1.LoginResponse\"+\x90\xea0\x02\xa0\xea0\x03\x82\xd3\xe4\x93\x02\x1d:\x01*\"\x18/v1/auth:switchWorkspace\x12\x8a\x01\n" +
+ "\x14RequestPasswordReset\x12(.bytebase.v1.RequestPasswordResetRequest\x1a\x16.google.protobuf.Empty\"0\x80\xea0\x01\xa0\xea0\x03\x82\xd3\xe4\x93\x02\":\x01*\"\x1d/v1/auth:requestPasswordReset\x12u\n" +
+ "\rResetPassword\x12!.bytebase.v1.ResetPasswordRequest\x1a\x16.google.protobuf.Empty\")\x80\xea0\x01\xa0\xea0\x03\x82\xd3\xe4\x93\x02\x1b:\x01*\"\x16/v1/auth:resetPassword\x12\x88\x01\n" +
+ "\x12SendEmailLoginCode\x12&.bytebase.v1.SendEmailLoginCodeRequest\x1a\x16.google.protobuf.Empty\"2\x80\xea0\x01\x98\xea0\x01\xa0\xea0\x03\x82\xd3\xe4\x93\x02 :\x01*\"\x1b/v1/auth:sendEmailLoginCodeB\xa6\x01\n" +
"\x0fcom.bytebase.v1B\x10AuthServiceProtoP\x01Z4github.com/bytebase/bytebase/backend/generated-go/v1\xa2\x02\x03BXX\xaa\x02\vBytebase.V1\xca\x02\vBytebase\\V1\xe2\x02\x17Bytebase\\V1\\GPBMetadata\xea\x02\fBytebase::V1b\x06proto3"
var (
diff --git a/backend/generated-go/v1/user_service.pb.go b/backend/generated-go/v1/user_service.pb.go
index adf7a224cf..b3e18ca3af 100644
--- a/backend/generated-go/v1/user_service.pb.go
+++ b/backend/generated-go/v1/user_service.pb.go
@@ -1,6 +1,6 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
-// protoc-gen-go v1.36.11
+// protoc-gen-go v1.36.12
// protoc (unknown)
// source: v1/user_service.proto
@@ -897,16 +897,16 @@ const file_v1_user_service_proto_rawDesc = "" +
"\x0flast_login_time\x18\x01 \x01(\v2\x1a.google.protobuf.TimestampR\rlastLoginTime\x12U\n" +
"\x19last_change_password_time\x18\x02 \x01(\v2\x1a.google.protobuf.TimestampR\x16lastChangePasswordTime\x12\x16\n" +
"\x06source\x18\x03 \x01(\tR\x06source:%\xeaA\"\n" +
- "\x11bytebase.com/User\x12\rusers/{email}J\x04\b\x05\x10\x06J\x04\b\x0f\x10\x102\xe2\b\n" +
+ "\x11bytebase.com/User\x12\rusers/{email}J\x04\b\x05\x10\x06J\x04\b\x0f\x10\x102\xe6\b\n" +
"\vUserService\x12p\n" +
"\aGetUser\x12\x1b.bytebase.v1.GetUserRequest\x1a\x11.bytebase.v1.User\"5\xdaA\x04name\x8a\xea0\fbb.users.get\x90\xea0\x01\x82\xd3\xe4\x93\x02\x14\x12\x12/v1/{name=users/*}\x12\x86\x01\n" +
"\rBatchGetUsers\x12!.bytebase.v1.BatchGetUsersRequest\x1a\".bytebase.v1.BatchGetUsersResponse\".\x8a\xea0\fbb.users.get\x90\xea0\x01\x82\xd3\xe4\x93\x02\x14\x12\x12/v1/users:batchGet\x12Y\n" +
"\x0eGetCurrentUser\x12\x16.google.protobuf.Empty\x1a\x11.bytebase.v1.User\"\x1c\x80\xea0\x01\x90\xea0\x02\x82\xd3\xe4\x93\x02\x0e\x12\f/v1/users/me\x12{\n" +
"\tListUsers\x12\x1d.bytebase.v1.ListUsersRequest\x1a\x1e.bytebase.v1.ListUsersResponse\"/\xdaA\x06parent\x8a\xea0\rbb.users.list\x90\xea0\x01\x82\xd3\xe4\x93\x02\v\x12\t/v1/users\x12z\n" +
"\n" +
- "CreateUser\x12\x1e.bytebase.v1.CreateUserRequest\x1a\x11.bytebase.v1.User\"9\xdaA\x04user\x8a\xea0\x0fbb.users.create\x90\xea0\x01\x98\xea0\x01\x82\xd3\xe4\x93\x02\x11:\x04user\"\t/v1/users\x12\x81\x01\n" +
+ "CreateUser\x12\x1e.bytebase.v1.CreateUserRequest\x1a\x11.bytebase.v1.User\"9\xdaA\x04user\x8a\xea0\x0fbb.users.create\x90\xea0\x01\x98\xea0\x01\x82\xd3\xe4\x93\x02\x11:\x04user\"\t/v1/users\x12\x85\x01\n" +
"\n" +
- "UpdateUser\x12\x1e.bytebase.v1.UpdateUserRequest\x1a\x11.bytebase.v1.User\"@\xdaA\x10user,update_mask\x90\xea0\x02\x98\xea0\x01\x82\xd3\xe4\x93\x02\x1f:\x04user2\x17/v1/{user.name=users/*}\x12o\n" +
+ "UpdateUser\x12\x1e.bytebase.v1.UpdateUserRequest\x1a\x11.bytebase.v1.User\"D\xdaA\x10user,update_mask\x90\xea0\x02\x98\xea0\x01\xa0\xea0\x03\x82\xd3\xe4\x93\x02\x1f:\x04user2\x17/v1/{user.name=users/*}\x12o\n" +
"\n" +
"DeleteUser\x12\x1e.bytebase.v1.DeleteUserRequest\x1a\x16.google.protobuf.Empty\")\xdaA\x04name\x90\xea0\x02\x98\xea0\x01\x82\xd3\xe4\x93\x02\x14*\x12/v1/{name=users/*}\x12s\n" +
"\fUndeleteUser\x12 .bytebase.v1.UndeleteUserRequest\x1a\x11.bytebase.v1.User\".\x90\xea0\x02\x98\xea0\x01\x82\xd3\xe4\x93\x02 :\x01*\"\x1b/v1/{name=users/*}:undelete\x12\x99\x01\n" +
diff --git a/backend/generated-go/v1/workspace_service.pb.go b/backend/generated-go/v1/workspace_service.pb.go
index 585bc95bca..ed5fc5ccad 100644
--- a/backend/generated-go/v1/workspace_service.pb.go
+++ b/backend/generated-go/v1/workspace_service.pb.go
@@ -1,6 +1,6 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
-// protoc-gen-go v1.36.11
+// protoc-gen-go v1.36.12
// protoc (unknown)
// source: v1/workspace_service.proto
@@ -472,14 +472,14 @@ const file_v1_workspace_service_proto_rawDesc = "" +
"\vupdate_mask\x18\x02 \x01(\v2\x1a.google.protobuf.FieldMaskR\n" +
"updateMask\"0\n" +
"\x15LeaveWorkspaceRequest\x12\x17\n" +
- "\x04name\x18\x01 \x01(\tB\x03\xe0A\x02R\x04name2\xe7\t\n" +
+ "\x04name\x18\x01 \x01(\tB\x03\xe0A\x02R\x04name2\xef\t\n" +
"\x10WorkspaceService\x12m\n" +
"\fGetWorkspace\x12 .bytebase.v1.GetWorkspaceRequest\x1a\x16.bytebase.v1.Workspace\"#\x80\xea0\x01\x82\xd3\xe4\x93\x02\x19\x12\x17/v1/{name=workspaces/*}\x12u\n" +
"\x0eListWorkspaces\x12\".bytebase.v1.ListWorkspacesRequest\x1a#.bytebase.v1.ListWorkspacesResponse\"\x1a\x90\xea0\x02\x82\xd3\xe4\x93\x02\x10\x12\x0e/v1/workspaces\x12\x9c\x01\n" +
"\x0fUpdateWorkspace\x12#.bytebase.v1.UpdateWorkspaceRequest\x1a\x16.bytebase.v1.Workspace\"L\x8a\xea0\x14bb.workspaces.update\x90\xea0\x01\x98\xea0\x01\x82\xd3\xe4\x93\x02&:\x01*2!/v1/{workspace.name=workspaces/*}\x12\x9c\x01\n" +
- "\fGetIamPolicy\x12 .bytebase.v1.GetIamPolicyRequest\x1a\x16.bytebase.v1.IamPolicy\"R\x8a\xea0\x1abb.workspaces.getIamPolicy\x90\xea0\x01\x82\xd3\xe4\x93\x02*\x12(/v1/{resource=workspaces/*}:getIamPolicy\x12\x93\x01\n" +
- "\x0fDeleteWorkspace\x12#.bytebase.v1.DeleteWorkspaceRequest\x1a\x1a.bytebase.v1.LoginResponse\"?\x8a\xea0\x14bb.workspaces.delete\x90\xea0\x01\x98\xea0\x01\x82\xd3\xe4\x93\x02\x19*\x17/v1/{name=workspaces/*}\x12\x82\x01\n" +
- "\x0eLeaveWorkspace\x12\".bytebase.v1.LeaveWorkspaceRequest\x1a\x1a.bytebase.v1.LoginResponse\"0\x90\xea0\x02\x98\xea0\x01\x82\xd3\xe4\x93\x02\":\x01*\"\x1d/v1/{name=workspaces/*}:leave\x12\xa3\x01\n" +
+ "\fGetIamPolicy\x12 .bytebase.v1.GetIamPolicyRequest\x1a\x16.bytebase.v1.IamPolicy\"R\x8a\xea0\x1abb.workspaces.getIamPolicy\x90\xea0\x01\x82\xd3\xe4\x93\x02*\x12(/v1/{resource=workspaces/*}:getIamPolicy\x12\x97\x01\n" +
+ "\x0fDeleteWorkspace\x12#.bytebase.v1.DeleteWorkspaceRequest\x1a\x1a.bytebase.v1.LoginResponse\"C\x8a\xea0\x14bb.workspaces.delete\x90\xea0\x01\x98\xea0\x01\xa0\xea0\x03\x82\xd3\xe4\x93\x02\x19*\x17/v1/{name=workspaces/*}\x12\x86\x01\n" +
+ "\x0eLeaveWorkspace\x12\".bytebase.v1.LeaveWorkspaceRequest\x1a\x1a.bytebase.v1.LoginResponse\"4\x90\xea0\x02\x98\xea0\x01\xa0\xea0\x03\x82\xd3\xe4\x93\x02\":\x01*\"\x1d/v1/{name=workspaces/*}:leave\x12\xa3\x01\n" +
"\fSetIamPolicy\x12 .bytebase.v1.SetIamPolicyRequest\x1a\x16.bytebase.v1.IamPolicy\"Y\x8a\xea0\x1abb.workspaces.setIamPolicy\x90\xea0\x01\x98\xea0\x01\x82\xd3\xe4\x93\x02-:\x01*\"(/v1/{resource=workspaces/*}:setIamPolicy\x12\xed\x01\n" +
"\x18RotateDirectorySyncToken\x12,.bytebase.v1.RotateDirectorySyncTokenRequest\x1a-.bytebase.v1.RotateDirectorySyncTokenResponse\"t\xdaA\x04name\x8a\xea0&bb.workspaces.rotateDirectorySyncToken\x90\xea0\x01\x98\xea0\x01\x82\xd3\xe4\x93\x025:\x01*\"0/v1/{name=workspaces/*}:rotateDirectorySyncTokenB\xab\x01\n" +
"\x0fcom.bytebase.v1B\x15WorkspaceServiceProtoP\x01Z4github.com/bytebase/bytebase/backend/generated-go/v1\xa2\x02\x03BXX\xaa\x02\vBytebase.V1\xca\x02\vBytebase\\V1\xe2\x02\x17Bytebase\\V1\\GPBMetadata\xea\x02\fBytebase::V1b\x06proto3"
diff --git a/backend/server/grpc_routes.go b/backend/server/grpc_routes.go
index ebb92ab204..a2fba1894b 100644
--- a/backend/server/grpc_routes.go
+++ b/backend/server/grpc_routes.go
@@ -204,12 +204,19 @@ func configureGrpcRouters(
// event an operator investigating an agent needs to see. Methods whose
// annotation opts out of auditing stay unaudited for permitted and denied
// calls alike (needAudit gates both).
+ //
+ // The FORBIDDEN gate sits between them — inside audit, so a denial is
+ // recorded wherever the method's annotation asks for auditing at all, and
+ // outside ACL, because the class is refused whatever the caller's RBAC
+ // would have allowed. P1b's full ceiling gate takes this same slot, and
+ // brings the typed denial record for the unannotated methods with it.
internalHandlerOpts := connect.WithHandlerOptions(
connect.WithRecover(onPanic),
connect.WithInterceptors(
validateInterceptor,
auth.NewInternalMCPAuthInterceptor(stores, secret, profile),
apiv1.NewAuditInterceptor(stores, secret, profile),
+ apiv1.NewInternalMCPForbiddenInterceptor(),
apiv1.NewACLInterceptor(stores, secret, iamManager, profile),
),
)
diff --git a/backend/tests/mcp_audit_provenance_test.go b/backend/tests/mcp_audit_provenance_test.go
index 230fc97f8a..6151e610af 100644
--- a/backend/tests/mcp_audit_provenance_test.go
+++ b/backend/tests/mcp_audit_provenance_test.go
@@ -82,10 +82,13 @@ func TestMCPAuditProvenance(t *testing.T) {
return out.Status
}
- // Permitted audited call: the member updates their own title.
- a.Equal(http.StatusOK, callAPI("UserService/UpdateUser", map[string]any{
- "user": map[string]any{"name": "users/" + memberEmail, "title": "agent driver (updated)"},
- "updateMask": "title",
+ // Permitted audited call: creating a group needs bb.groups.create, which a
+ // workspace member does hold. (Self-updating the member's own title would
+ // read more naturally, but UpdateUser is FORBIDDEN to MCP sessions as a
+ // whole method — see backend/api/v1/mcp_forbidden.go.)
+ a.Equal(http.StatusOK, callAPI("GroupService/CreateGroup", map[string]any{
+ "group": map[string]any{"title": "agent driver group"},
+ "groupEmail": "[email protected]",
}))
// Denied audited call: creating a user needs bb.users.create, which a
@@ -112,7 +115,7 @@ func TestMCPAuditProvenance(t *testing.T) {
return rows
}
- permittedRows := searchMemberRows("/bytebase.v1.UserService/UpdateUser")
+ permittedRows := searchMemberRows("/bytebase.v1.GroupService/CreateGroup")
a.Len(permittedRows, 1, "the permitted MCP call must produce exactly one audit row")
permitted := permittedRows[0]
a.Nil(permitted.Status, "the permitted call's row keeps its success status")
diff --git a/backend/tests/mcp_forbidden_class_test.go b/backend/tests/mcp_forbidden_class_test.go
new file mode 100644
index 0000000000..0b263384d4
--- /dev/null
+++ b/backend/tests/mcp_forbidden_class_test.go
@@ -0,0 +1,215 @@
+package tests
+
+import (
+ "context"
+ "net/http"
+ "testing"
+
+ "connectrpc.com/connect"
+ "github.com/stretchr/testify/require"
+ "google.golang.org/protobuf/types/known/fieldmaskpb"
+
+ v1pb "github.com/bytebase/bytebase/backend/generated-go/v1"
+)
+
+// TestMCPCannotChangeOwnPasswordAndLogIn runs the escape end to end. The chain
+// is two ordinary call_api invocations:
+//
+// 1. UserService/UpdateUser{password}. The self-update branch authorizes on
+// caller == subject alone — no permission check, no proof of the old
+// password — so an MCP session could rewrite its own user's password.
+// 2. AuthService/Login{web:false}. Login is allow_without_credential and the
+// non-web branch returns the token in the response body.
+//
+// The result is a plain bb.user.access token: not audience-bound to the MCP
+// resource, alive after the OAuth grant is revoked, unaffected by the workspace
+// MCP kill switch — plus a hijacked account, since the human's password is now
+// the agent's. Both steps are FORBIDDEN on the internal chain.
+//
+// The RED state is the whole point of the assertions below. With the
+// interceptor unregistered, step 1 answers 200, step 2 hands back a token, and
+// the old-password login fails because the password really did change.
+func TestMCPCannotChangeOwnPasswordAndLogIn(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 dedicated end user drives the session: the escape is about an MCP
+ // session rewriting its OWN credentials, and using the fixture's admin
+ // would leave the rest of the suite's login helpers holding a stale
+ // password if a regression let the change through.
+ const agentEmail = "[email protected]"
+ const oldPassword = "1024bytebase"
+ const hijackPassword = "2048bytebase"
+ created, err := ctl.userServiceClient.CreateUser(ctx, connect.NewRequest(&v1pb.CreateUserRequest{
+ User: &v1pb.User{
+ Title: "mcp agent",
+ Email: agentEmail,
+ Password: oldPassword,
+ },
+ }))
+ a.NoError(err)
+ workspace := created.Msg.Workspace
+ a.NotEmpty(workspace)
+ _, err = ctl.addMemberToWorkspaceIAM(ctx, workspace, "user:"+agentEmail, "roles/workspaceMember")
+ a.NoError(err)
+
+ login, err := ctl.authServiceClient.Login(ctx, connect.NewRequest(&v1pb.LoginRequest{
+ Email: agentEmail,
+ Password: oldPassword,
+ }))
+ a.NoError(err)
+ agentToken := login.Msg.Token
+ a.NotEmpty(agentToken)
+
+ // One session for both steps, the way an agent would run the chain.
+ session := openMCPSession(ctx, t, ctl, agentToken)
+ defer session.Close()
+
+ changed := callAPIOnSession(ctx, t, session, "UserService/UpdateUser", map[string]any{
+ "user": map[string]any{"name": "users/" + agentEmail, "password": hijackPassword},
+ "updateMask": "password",
+ })
+ // Step 2 runs whatever step 1 answered: it is the half that actually
+ // escapes the token boundary, and it must be refused on its own. Running it
+ // unconditionally — and logging both steps before asserting either — is
+ // what makes an unguarded build report the whole escape (200, then a token)
+ // instead of stopping at the first assertion.
+ minted := callAPIOnSession(ctx, t, session, "AuthService/Login", map[string]any{
+ "email": agentEmail,
+ "password": hijackPassword,
+ "web": false,
+ })
+ t.Logf("MCP UpdateUser{password} → status=%d error=%q", changed.Status, changed.Error)
+ t.Logf("MCP Login{web:false} → status=%d error=%q token=%q", minted.Status, minted.Error, minted.Response.Token)
+
+ a.Equal(http.StatusForbidden, changed.Status,
+ "an MCP session must not be able to rewrite its own user's password")
+ a.Contains(changed.Error, "not available to MCP sessions",
+ "the refusal must come from the FORBIDDEN gate, not from password-complexity validation")
+ a.Equal(http.StatusForbidden, minted.Status, "Login must be refused on the internal chain")
+ a.Contains(minted.Error, "not available to MCP sessions")
+ a.Empty(minted.Response.Token, "an MCP session must never receive a plain user access token")
+
+ // Login with the credentials the session tried to set must also fail, so
+ // the refusal is not the only thing standing between the agent and the
+ // account.
+ loggedInAsAgent := callAPIOnSession(ctx, t, session, "AuthService/Login", map[string]any{
+ "email": agentEmail,
+ "password": oldPassword,
+ "web": false,
+ })
+ a.Equal(http.StatusForbidden, loggedInAsAgent.Status,
+ "Login is refused whatever credentials it names")
+ a.Empty(loggedInAsAgent.Response.Token)
+
+ // The account is untouched: the old password still works and the one the
+ // session tried to install does not. This is what discriminates a gate that
+ // refuses before dispatch from one that refuses after the store write.
+ _, err = ctl.authServiceClient.Login(ctx, connect.NewRequest(&v1pb.LoginRequest{
+ Email: agentEmail,
+ Password: hijackPassword,
+ }))
+ a.Error(err, "the password the MCP session tried to install must not work")
+ a.Equal(connect.CodeUnauthenticated, connect.CodeOf(err))
+
+ stillOld, err := ctl.authServiceClient.Login(ctx, connect.NewRequest(&v1pb.LoginRequest{
+ Email: agentEmail,
+ Password: oldPassword,
+ }))
+ a.NoError(err, "the user's real password must still be their real password")
+ a.NotEmpty(stillOld.Msg.Token)
+
+ // The operator's view: a denied MCP call is exactly the event worth
+ // investigating, so both denials must be on the audit page — including
+ // Login, which the handler never reached.
+ deniedRows := func(method string) []*v1pb.AuditLog {
+ resp, err := ctl.auditLogServiceClient.SearchAuditLogs(ctx, connect.NewRequest(&v1pb.SearchAuditLogsRequest{
+ Parent: workspace,
+ Filter: `method == "` + method + `"`,
+ OrderBy: "create_time desc",
+ }))
+ a.NoError(err)
+ var rows []*v1pb.AuditLog
+ for _, row := range resp.Msg.AuditLogs {
+ if row.User == "users/"+agentEmail && row.McpDelegation != nil {
+ rows = append(rows, row)
+ }
+ }
+ return rows
+ }
+
+ updateRows := deniedRows("/bytebase.v1.UserService/UpdateUser")
+ a.Len(updateRows, 1, "the denied password change must produce exactly one audit row")
+ a.Equal(int32(connect.CodePermissionDenied), updateRows[0].Status.GetCode(),
+ "the row must record the denial, not a success")
+ a.NotEmpty(updateRows[0].McpDelegation.GetCorrelationId(),
+ "the denial must be correlatable back to the agent session that made it")
+
+ loginRows := deniedRows("/bytebase.v1.AuthService/Login")
+ a.Len(loginRows, 2, "both refused Login attempts must be audited")
+ for _, row := range loginRows {
+ a.Equal(int32(connect.CodePermissionDenied), row.Status.GetCode())
+ }
+ a.Equal(updateRows[0].McpDelegation.GetCorrelationId(), loginRows[0].McpDelegation.GetCorrelationId(),
+ "one session, one correlation ID across the whole chain")
+}
+
+// TestWebUserStillChangesPasswordAndLogsIn is the regression half: the gate
+// lives on the internal MCP chain only, so the ordinary self-service flow — a
+// signed-in user changing their own password in the console, then logging in
+// with it — must be untouched. The same two methods, the same principal, the
+// public chain.
+func TestWebUserStillChangesPasswordAndLogsIn(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)
+
+ const webEmail = "[email protected]"
+ const oldPassword = "1024bytebase"
+ const newPassword = "2048bytebase"
+ created, err := ctl.userServiceClient.CreateUser(ctx, connect.NewRequest(&v1pb.CreateUserRequest{
+ User: &v1pb.User{
+ Title: "web user",
+ Email: webEmail,
+ Password: oldPassword,
+ },
+ }))
+ a.NoError(err)
+ _, err = ctl.addMemberToWorkspaceIAM(ctx, created.Msg.Workspace, "user:"+webEmail, "roles/workspaceMember")
+ a.NoError(err)
+
+ login, err := ctl.authServiceClient.Login(ctx, connect.NewRequest(&v1pb.LoginRequest{
+ Email: webEmail,
+ Password: oldPassword,
+ }))
+ a.NoError(err)
+
+ // The user's own session changes their own password, exactly as the
+ // console does.
+ admin := ctl.authInterceptor.token
+ ctl.authInterceptor.token = login.Msg.Token
+ _, err = ctl.userServiceClient.UpdateUser(ctx, connect.NewRequest(&v1pb.UpdateUserRequest{
+ User: &v1pb.User{Name: "users/" + webEmail, Password: newPassword},
+ UpdateMask: &fieldmaskpb.FieldMask{Paths: []string{"password"}},
+ }))
+ ctl.authInterceptor.token = admin
+ a.NoError(err, "a normal session must still be able to change its own password")
+
+ relogin, err := ctl.authServiceClient.Login(ctx, connect.NewRequest(&v1pb.LoginRequest{
+ Email: webEmail,
+ Password: newPassword,
+ }))
+ a.NoError(err, "the new password must work on the public login path")
+ a.NotEmpty(relogin.Msg.Token)
+}
diff --git a/backend/tests/mcp_migration_matrix_test.go b/backend/tests/mcp_migration_matrix_test.go
index 6bc76a805a..8c27838c86 100644
--- a/backend/tests/mcp_migration_matrix_test.go
+++ b/backend/tests/mcp_migration_matrix_test.go
@@ -182,11 +182,13 @@ func TestMCPMigrationGrantStateMatrix(t *testing.T) {
a.NoError(err)
// Row 3: the legacy admission — a plain web-session token driving MCP.
+ // The call is an audited mutation, so each session leaves exactly one
+ // provenance-carrying row to sort out below.
plainSession := openMCPSession(ctx, t, ctl, ctl.authInterceptor.token)
defer plainSession.Close()
- a.Equal(http.StatusOK, callAPIStatus(ctx, t, plainSession, "UserService/UpdateUser", map[string]any{
- "user": map[string]any{"name": ctl.principalName, "title": "driven by a pre-grant session"},
- "updateMask": "title",
+ a.Equal(http.StatusOK, callAPIStatus(ctx, t, plainSession, "GroupService/CreateGroup", map[string]any{
+ "group": map[string]any{"title": "driven by a pre-grant session"},
+ "groupEmail": "[email protected]",
}), "a plain web-session token must keep working through tools")
// Row 4: a real consent that never names a scope.
@@ -209,15 +211,15 @@ func TestMCPMigrationGrantStateMatrix(t *testing.T) {
scopelessSession := openMCPSession(ctx, t, ctl, scopelessToken)
defer scopelessSession.Close()
- a.Equal(http.StatusOK, callAPIStatus(ctx, t, scopelessSession, "UserService/UpdateUser", map[string]any{
- "user": map[string]any{"name": ctl.principalName, "title": "driven by a scope-less grant"},
- "updateMask": "title",
+ a.Equal(http.StatusOK, callAPIStatus(ctx, t, scopelessSession, "GroupService/CreateGroup", map[string]any{
+ "group": map[string]any{"title": "driven by a scope-less grant"},
+ "groupEmail": "[email protected]",
}), "a grant that recorded no scope must still work end to end")
// What an operator investigating these sessions sees.
rows, err := ctl.auditLogServiceClient.SearchAuditLogs(ctx, connect.NewRequest(&v1pb.SearchAuditLogsRequest{
Parent: workspace.Msg.Name,
- Filter: `method == "/bytebase.v1.UserService/UpdateUser"`,
+ Filter: `method == "/bytebase.v1.GroupService/CreateGroup"`,
OrderBy: "create_time desc",
}))
a.NoError(err)
diff --git a/backend/tests/mcp_tool_parity_test.go b/backend/tests/mcp_tool_parity_test.go
index 5d7506d134..5040e050d4 100644
--- a/backend/tests/mcp_tool_parity_test.go
+++ b/backend/tests/mcp_tool_parity_test.go
@@ -99,6 +99,11 @@ func TestMCPToolCallParity(t *testing.T) {
// bearer; the delegated credential is signed with a derived key and cannot be
// extracted that way, so the guard has to recognize it explicitly or fail open
// for every MCP session.
+//
+// SwitchWorkspace is now also in the FORBIDDEN class, so the interceptor
+// refuses it before the handler runs; this test asserts the outcome an agent
+// sees, which both layers must deliver. The handler guard's own recognition
+// logic is pinned directly by TestSwitchWorkspaceMCPRecognition.
func TestMCPCannotMintPlainUserToken(t *testing.T) {
t.Parallel()
a := require.New(t)
diff --git a/backend/tests/mcp_workspace_token_escape_test.go b/backend/tests/mcp_workspace_token_escape_test.go
index 20d382d271..39cfa054d8 100644
--- a/backend/tests/mcp_workspace_token_escape_test.go
+++ b/backend/tests/mcp_workspace_token_escape_test.go
@@ -29,10 +29,17 @@ type mcpCallResult struct {
// bearer, exactly as an agent would, and decodes what that agent gets back.
func callAPIViaMCP(ctx context.Context, t *testing.T, ctl *controller, bearer, operationID string, body map[string]any) mcpCallResult {
t.Helper()
- a := require.New(t)
-
session := openMCPSession(ctx, t, ctl, bearer)
defer session.Close()
+ return callAPIOnSession(ctx, t, session, operationID, body)
+}
+
+// callAPIOnSession is callAPIViaMCP against an already-open session, for the
+// tests whose subject is a multi-call chain: one agent session, several tool
+// calls, one correlation ID.
+func callAPIOnSession(ctx context.Context, t *testing.T, session *mcp.ClientSession, operationID string, body map[string]any) mcpCallResult {
+ t.Helper()
+ a := require.New(t)
result, err := session.CallTool(ctx, &mcp.CallToolParams{
Name: "call_api",
@@ -93,6 +100,14 @@ func workspaceHasMember(ctx context.Context, t *testing.T, ctl *controller, bear
// ordering is what the membership assertion below pins — with the guard
// removed this test fails twice over, on the status and on the destroyed
// membership.
+//
+// Since the FORBIDDEN gate landed, the refusal an MCP session actually meets
+// comes from the interceptor, ahead of the handler — so this test no longer
+// discriminates on WHICH layer refused, only that the session is refused and
+// the membership survives. The handler guard keeps its own coverage in
+// backend/api/v1: TestLeaveAndDeleteWorkspaceRefuseMCPCaller pins that each
+// handler refuses before it touches the store, and
+// TestSwitchWorkspaceInternalRefusesMCPCaller pins the shared mint point.
func TestMCPCannotLeaveWorkspace(t *testing.T) {
t.Parallel()
a := require.New(t)
@@ -147,7 +162,7 @@ func TestMCPCannotLeaveWorkspace(t *testing.T) {
a.Equal(http.StatusForbidden, out.Status,
"an MCP session must be refused before it can leave a workspace")
- a.Contains(out.Error, "MCP sessions cannot leave workspaces",
+ a.Contains(out.Error, "not available to MCP sessions",
"the refusal must come from the MCP guard, not from some other precondition")
// This fixture has a single workspace, so switchWorkspaceInternal's nextWS
// is always nil and the mint is out of reach even unguarded: the assertion
@@ -172,10 +187,11 @@ func TestMCPCannotLeaveWorkspace(t *testing.T) {
// TestMCPCannotDeleteWorkspace is the DeleteWorkspace half of the same escape.
// DeleteWorkspace ends in the same switchWorkspaceInternal token mint, and the
-// guard sits ahead of every check in the handler — including the SaaS-only
+// refusal sits ahead of every check in the handler — including the SaaS-only
// precondition. That placement is what the assertion pins: this build is
-// self-hosted, so with the guard removed the MCP call reaches the SaaS check
-// and comes back FailedPrecondition rather than PermissionDenied.
+// self-hosted, so with both the gate and the handler guard removed the MCP call
+// reaches the SaaS check and comes back FailedPrecondition rather than
+// PermissionDenied.
func TestMCPCannotDeleteWorkspace(t *testing.T) {
t.Parallel()
a := require.New(t)
@@ -199,7 +215,7 @@ func TestMCPCannotDeleteWorkspace(t *testing.T) {
a.Equal(http.StatusForbidden, out.Status,
"an MCP session must be refused before any deletion work happens")
- a.Contains(out.Error, "MCP sessions cannot delete workspaces",
+ a.Contains(out.Error, "not available to MCP sessions",
"the refusal must come from the MCP guard, ahead of the SaaS precondition")
// As in the leave test, the mint is unreachable on a self-hosted fixture,
// so this states the invariant rather than discriminating on it.
@@ -243,20 +259,17 @@ func TestMCPOAuthSessionCannotLeaveOrDeleteWorkspace(t *testing.T) {
oauthToken, _ := mintMCPOAuthToken(t, ctl, ctl.authInterceptor.token)
- for _, tc := range []struct {
- operation string
- refusal string
- }{
- {"WorkspaceService/LeaveWorkspace", "MCP sessions cannot leave workspaces"},
- {"WorkspaceService/DeleteWorkspace", "MCP sessions cannot delete workspaces"},
+ for _, operation := range []string{
+ "WorkspaceService/LeaveWorkspace",
+ "WorkspaceService/DeleteWorkspace",
} {
- out := callAPIViaMCP(ctx, t, ctl, oauthToken, tc.operation,
+ out := callAPIViaMCP(ctx, t, ctl, oauthToken, operation,
map[string]any{"name": workspace.Msg.Name})
- t.Logf("MCP OAuth %s → status=%d error=%q", tc.operation, out.Status, out.Error)
+ t.Logf("MCP OAuth %s → status=%d error=%q", operation, out.Status, out.Error)
a.Equal(http.StatusForbidden, out.Status,
- "a real MCP OAuth session must be refused by %s", tc.operation)
- a.Contains(out.Error, tc.refusal,
+ "a real MCP OAuth session must be refused by %s", operation)
+ a.Contains(out.Error, "not available to MCP sessions",
"the refusal must come from the MCP guard")
a.Empty(out.Response.Token,
"an MCP session must never receive a plain user access token")
diff --git a/frontend/src/types/proto-es/v1/annotation_pb.d.ts b/frontend/src/types/proto-es/v1/annotation_pb.d.ts
index f8c475a529..acc2849fcc 100644
--- a/frontend/src/types/proto-es/v1/annotation_pb.d.ts
+++ b/frontend/src/types/proto-es/v1/annotation_pb.d.ts
@@ -43,6 +43,54 @@ export enum AuthMethod {
*/
export declare const AuthMethodSchema: GenEnum<AuthMethod>;
+/**
+ * Classification of an RPC for MCP (AI agent) sessions. The effective
+ * authorization of an MCP session is this classification intersected with the
+ * caller's own RBAC: it can only ever narrow what the human could do, never
+ * widen it.
+ *
+ * @generated from enum bytebase.v1.MCPMethodClass
+ */
+export enum MCPMethodClass {
+ /**
+ * Not yet classified. Reaches its handler, subject to RBAC as usual —
+ * the classification is being rolled out method by method, and only
+ * FORBIDDEN is enforced today.
+ *
+ * @generated from enum value: MCP_METHOD_CLASS_UNSPECIFIED = 0;
+ */
+ MCP_METHOD_CLASS_UNSPECIFIED = 0,
+
+ /**
+ * Served to a read-only MCP session and above.
+ *
+ * @generated from enum value: READ = 1;
+ */
+ READ = 1,
+
+ /**
+ * Served to a read-write MCP session only.
+ *
+ * @generated from enum value: WRITE = 2;
+ */
+ WRITE = 2,
+
+ /**
+ * Never reachable by an MCP session, whatever the caller's own
+ * permissions are. These methods escape the MCP boundary rather than
+ * merely exercising a permission: a human with the permission uses the
+ * console; an agent acting for them does not get to.
+ *
+ * @generated from enum value: FORBIDDEN = 3;
+ */
+ FORBIDDEN = 3,
+}
+
+/**
+ * Describes the enum bytebase.v1.MCPMethodClass.
+ */
+export declare const MCPMethodClassSchema: GenEnum<MCPMethodClass>;
+
/**
* Whether the method allows access without authentication credentials.
*
@@ -71,3 +119,10 @@ export declare const auth_method: GenExtension<MethodOptions, AuthMethod>;
*/
export declare const audit: GenExtension<MethodOptions, boolean>;
+/**
+ * How the method is classified for MCP (AI agent) sessions.
+ *
+ * @generated from extension: bytebase.v1.MCPMethodClass mcp_method_class = 100004;
+ */
+export declare const mcp_method_class: GenExtension<MethodOptions, MCPMethodClass>;
+
diff --git a/frontend/src/types/proto-es/v1/annotation_pb.js b/frontend/src/types/proto-es/v1/annotation_pb.js
index 8639d96277..67fdb7ecbc 100644
--- a/frontend/src/types/proto-es/v1/annotation_pb.js
+++ b/frontend/src/types/proto-es/v1/annotation_pb.js
@@ -9,7 +9,7 @@ import { file_google_protobuf_descriptor } from "@bufbuild/protobuf/wkt";
* Describes the file v1/annotation.proto.
*/
export const file_v1_annotation = /*@__PURE__*/
- fileDesc("ChN2MS9hbm5vdGF0aW9uLnByb3RvEgtieXRlYmFzZS52MSo+CgpBdXRoTWV0aG9kEhsKF0FVVEhfTUVUSE9EX1VOU1BFQ0lGSUVEEAASBwoDSUFNEAESCgoGQ1VTVE9NEAI6WgoYYWxsb3dfd2l0aG91dF9jcmVkZW50aWFsEh4uZ29vZ2xl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SCnBlcm1pc3Npb246WgoLYXV0aF9tZXRob2QSHi5nb29nbGUucHJvdG9idWYuTWV0aG9kT3B0aW9ucxiijQYgASgOMhcuYnl0ZWJhc2UudjEuQXV0aE1ldGhvZFIKYXV0aE1ldGhvZDo2CgVhdWRpdBIeLmdvb2dsZS5wcm90b2J1Zi5NZXRob2RPcHRpb25zGKONBiABKAhSBWF1ZGl0OmcKEG1jcF9tZXRob2RfY2xhc3MSHi5nb29nbGUucHJvdG9idWYuTWV0aG9kT3B0aW9ucxikjQYgASgOMhsuYnl0ZWJhc2UudjEuTUNQTWV0aG9kQ2xhc3NSDm1jcE1ldGhvZENsYXNzQqUBCg9jb20uYnl0ZWJhc2UudjFCD0Fubm90YXRpb25Qcm90b1ABWjRnaXRodWIuY29tL2J5dGViYXNlL2J5dGViYXNlL2JhY2tlbmQvZ2VuZXJhdGVkLWdvL3YxogIDQlhYqgILQnl0ZWJhc2UuVjHKAgtCeXRlYmFzZVxWMeICF0J5dGViYXNlXFYxXEdQQk1ldGFkYXRh6gIMQnl0ZWJhc2U6OlYxYgZwcm90bzM", [file_google_protobuf_descriptor]);
/**
* Describes the enum bytebase.v1.AuthMethod.
@@ -25,6 +25,23 @@ export const AuthMethodSchema = /*@__PURE__*/
export const AuthMethod = /*@__PURE__*/
tsEnum(AuthMethodSchema);
+/**
+ * Describes the enum bytebase.v1.MCPMethodClass.
+ */
+export const MCPMethodClassSchema = /*@__PURE__*/
+ enumDesc(file_v1_annotation, 1);
+
+/**
+ * Classification of an RPC for MCP (AI agent) sessions. The effective
+ * authorization of an MCP session is this classification intersected with the
+ * caller's own RBAC: it can only ever narrow what the human could do, never
+ * widen it.
+ *
+ * @generated from enum bytebase.v1.MCPMethodClass
+ */
+export const MCPMethodClass = /*@__PURE__*/
+ tsEnum(MCPMethodClassSchema);
+
/**
* Whether the method allows access without authentication credentials.
*
@@ -57,3 +74,11 @@ export const auth_method = /*@__PURE__*/
export const audit = /*@__PURE__*/
extDesc(file_v1_annotation, 3);
+/**
+ * How the method is classified for MCP (AI agent) sessions.
+ *
+ * @generated from extension: bytebase.v1.MCPMethodClass mcp_method_class = 100004;
+ */
+export const mcp_method_class = /*@__PURE__*/
+ extDesc(file_v1_annotation, 4);
+
diff --git a/frontend/src/types/proto-es/v1/auth_service_pb.js b/frontend/src/types/proto-es/v1/auth_service_pb.js
index 045f42d536..1e18fcd00c 100644
--- a/frontend/src/types/proto-es/v1/auth_service_pb.js
+++ b/frontend/src/types/proto-es/v1/auth_service_pb.js
@@ -12,7 +12,7 @@ import { file_v1_user_service } from "./user_service_pb";
* Describes the file v1/auth_service.proto.
*/
export const file_v1_auth_service = /*@__PURE__*/
- fileDesc("ChV2MS9hdXRoX3NlcnZpY2UucHJvdG8SC2J5dGViYXNlLnYxItkCCgxMb2dpblJlcXVlc3QSDQoFZW1haWwYASABKAkSEAoIcGFzc3dvcmQYAiABKAkSCwoDd2ViGAMgASgIEhAKCGlkcF9uYW1lGAQgASgJEjkKC2lkcF9jb250ZXh0GAUgASgLMiQuYnl0ZWJhc2UudjEuSWRlbnRpdHlQcm92aWRlckNvbnRleHQSFQoIb3RwX2NvZGUYBiABKAlIAIgBARIaCg1yZWNvdmVyeV9jb2RlGAcgASgJSAGIAQESGwoObWZhX3RlbXBfdG9rZW4YCCABKAlIAogBARIXCgplbWFpbF9jb2RlGAkgASgJSAOIAQESFgoJd29ya3NwYWNlGAogASgJSASIAQFCCwoJX290cF9jb2RlQhAKDl9yZWNvdmVyeV9jb2RlQhEKD19tZmFfdGVtcF90b2tlbkINCgtfZW1haWxfY29kZUIMCgpfd29ya3NwYWNlIqwBChdJZGVudGl0eVByb3ZpZGVyQ29udGV4dBJECg5vYXV0aDJfY29udGV4dBgBIAEoCzIqLmJ5dGViYXNlLnYxLk9BdXRoMklkZW50aXR5UHJvdmlkZXJDb250ZXh0SAASQAoMb2lkY19jb250ZXh0GAIgASgLMiguYnl0ZWJhc2UudjEuT0lEQ0lkZW50aXR5UHJvdmlkZXJDb250Z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zZXQSKC5ieXRlYmFzZS52MS5SZXF1ZXN0UGFzc3dvcmRSZXNldFJlcXVlc3QaFi5nb29nbGUucHJvdG9idWYuRW1wdHkiLIDqMAGC0+STAiI6ASoiHS92MS9hdXRoOnJlcXVlc3RQYXNzd29yZFJlc2V0EnEKDVJlc2V0UGFzc3dvcmQSIS5ieXRlYmFzZS52MS5SZXNldFBhc3N3b3JkUmVxdWVzdBoWLmdvb2dsZS5wcm90b2J1Zi5FbXB0eSIlgOowAYLT5JMCGzoBKiIWL3YxL2F1dGg6cmVzZXRQYXNzd29yZBKEAQoSU2VuZEVtYWlsTG9naW5Db2RlEiYuYnl0ZWJhc2UudjEuU2VuZEVtYWlsTG9naW5Db2RlUmVxdWVzdBoWLmdvb2dsZS5wcm90b2J1Zi5FbXB0eSIugOowAZjqMAGC0+STAiA6ASoiGy92MS9hdXRoOnNlbmRFbWFpbExvZ2luQ29kZUKmAQoPY29tLmJ5dGViYXNlLnYxQhBBdXRoU2VydmljZVByb3RvUAFaNGdpdGh1Yi5jb20vYnl0ZWJhc2UvYnl0ZWJhc2UvYmFja2VuZC9nZW5lcmF0ZWQtZ28vdjGiAgNCWFiqAgtCeXRlYmFzZS5WMcoCC0J5dGViYXNlXFYx4gIXQnl0ZWJhc2VcVjFcR1BCTWV0YWRhdGHqAgxCeXRlYmFzZTo6VjFiBnByb3RvMw", [file_google_api_annotations, file_google_protobuf_empty, file_v1_annotation, file_v1_user_service]);
+ fileDesc("ChV2MS9hdXRoX3NlcnZpY2UucHJvdG8SC2J5dGViYXNlLnYxItkCCgxMb2dpblJlcXVlc3QSDQoFZW1haWwYASABKAkSEAoIcGFzc3dvcmQYAiABKAkSCwoDd2ViGAMgASgIEhAKCGlkcF9uYW1lGAQgASgJEjkKC2lkcF9jb250ZXh0GAUgASgLMiQuYnl0ZWJhc2UudjEuSWRlbnRpdHlQcm92aWRlckNvbnRleHQSFQoIb3RwX2NvZGUYBiABKAlIAIgBARIaCg1yZWNvdmVyeV9jb2R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ZWQtZ28vdjGiAgNCWFiqAgtCeXRlYmFzZS5WMcoCC0J5dGViYXNlXFYx4gIXQnl0ZWJhc2VcVjFcR1BCTWV0YWRhdGHqAgxCeXRlYmFzZTo6VjFiBnByb3RvMw", [file_google_api_annotations, file_google_protobuf_empty, file_v1_annotation, file_v1_user_service]);
/**
* Describes the message bytebase.v1.LoginRequest.
diff --git a/frontend/src/types/proto-es/v1/user_service_pb.js b/frontend/src/types/proto-es/v1/user_service_pb.js
index 7e0ded9cda..c40d41fcbe 100644
--- a/frontend/src/types/proto-es/v1/user_service_pb.js
+++ b/frontend/src/types/proto-es/v1/user_service_pb.js
@@ -16,7 +16,7 @@ import { file_v1_common } from "./common_pb";
* Describes the file v1/user_service.proto.
*/
export const file_v1_user_service = /*@__PURE__*/
- fileDesc("ChV2MS91c2VyX3NlcnZpY2UucHJvdG8SC2J5dGViYXNlLnYxIjkKDkdldFVzZXJSZXF1ZXN0EicKBG5hbWUYASABKAlCGeBBAvpBEwoRYnl0ZWJhc2UuY29tL1VzZXIiQAoUQmF0Y2hHZXRVc2Vyc1JlcXVlc3QSKAoFbmFtZXMYASADKAlCGeBBAvpBEwoRYnl0ZWJhc2UuY29tL1VzZXIiOQoVQmF0Y2hHZXRVc2Vyc1Jlc3BvbnNlEiAKBXVzZXJzGAEgAygLMhEuYnl0ZWJhc2UudjEuVXNlciJfChBMaXN0VXNlcnNSZXF1ZXN0EhEKCXBhZ2Vfc2l6ZRgBIAEoBRISCgpwYWdlX3Rva2VuGAIgASgJEhQKDHNob3dfZGVsZXRlZBgDIAEoCBIOCgZmaWx0ZXIYBCABKAkiTgoRTGlzdFVzZXJzUmVzcG9uc2USIAoFdXNlcnMYASADKAsyES5ieXRlYmFzZS52MS5Vc2VyEhcKD25leHRfcGFnZV90b2tlbhgCIAEoCSI5ChFDcmVhdGVVc2VyUmVxdWVzdBIkCgR1c2VyGAEgASgLMhEuYnl0ZWJhc2UudjEuVXNlckID4EECIuwBChFVcGRhdGVVc2Vy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YXRlkOowAZjqMAGC0+STAhE6BHVzZXIiCS92MS91c2VycxKBAQoKVXBkYXRlVXNlchIeLmJ5dGViYXNlLnYxLlVwZGF0ZVVzZXJSZXF1ZXN0GhEuYnl0ZWJhc2UudjEuVXNlciJA2kEQdXNlcix1cGRhdGVfbWFza5DqMAKY6jABgtPkkwIfOgR1c2VyMhcvdjEve3VzZXIubmFtZT11c2Vycy8qfRJvCgpEZWxldGVVc2VyEh4uYnl0ZWJhc2UudjEuRGVsZXRlVXNlclJlcXVlc3QaFi5nb29nbGUucHJvdG9idWYuRW1wdHkiKdpBBG5hbWWQ6jACmOowAYLT5JMCFCoSL3YxL3tuYW1lPXVzZXJzLyp9EnMKDFVuZGVsZXRlVXNlchIgLmJ5dGViYXNlLnYxLlVuZGVsZXRlVXNlclJlcXVlc3QaES5ieXRlYmFzZS52MS5Vc2VyIi6Q6jACmOowAYLT5JMCIDoBKiIbL3YxL3tuYW1lPXVzZXJzLyp9OnVuZGVsZXRlEpkBCgtVcGRhdGVFbWFpbBIfLmJ5dGViYXNlLnYxLlVwZGF0ZUVtYWlsUmVxdWVzdBoRLmJ5dGViYXNlLnYxLlVzZXIiVtpBCm5hbWUsZW1haWyK6jAUYmIudXNlcnMudXBkYXRlRW1haWyQ6jABmOowAYLT5JMCIzoBKiIeL3YxL3tuYW1lPXVzZXJzLyp9OnVwZGF0ZUVtYWlsQqYBCg9jb20uYnl0ZWJhc2UudjFCEFVzZXJTZXJ2aWNlUHJvdG9QAVo0Z2l0aHViLmNvbS9ieXRlYmFzZS9ieXRlYmFzZS9iYWNrZW5kL2dlbmVyYXRlZC1nby92MaICA0JYWKoCC0J5dGViYXNlLlYxygILQnl0ZWJhc2VcVjHiAhdCeXRlYmFzZVxWMVxHUEJNZXRhZGF0YeoCDEJ5dGViYXNlOjpWMWIGcHJvdG8z", [file_buf_validate_validate, file_google_api_annotations, file_google_api_client, file_google_api_field_behavior, file_google_api_resource, file_google_protobuf_empty, file_google_protobuf_field_mask, file_google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0ZVVzZXISIC5ieXRlYmFzZS52MS5VbmRlbGV0ZVVzZXJSZXF1ZXN0GhEuYnl0ZWJhc2UudjEuVXNlciIukOowApjqMAGC0+STAiA6ASoiGy92MS97bmFtZT11c2Vycy8qfTp1bmRlbGV0ZRKZAQoLVXBkYXRlRW1haWwSHy5ieXRlYmFzZS52MS5VcGRhdGVFbWFpbFJlcXVlc3QaES5ieXRlYmFzZS52MS5Vc2VyIlbaQQpuYW1lLGVtYWlsiuowFGJiLnVzZXJzLnVwZGF0ZUVtYWlskOowAZjqMAGC0+STAiM6ASoiHi92MS97bmFtZT11c2Vycy8qfTp1cGRhdGVFbWFpbEKmAQoPY29tLmJ5dGViYXNlLnYxQhBVc2VyU2VydmljZVByb3RvUAFaNGdpdGh1Yi5jb20vYnl0ZWJhc2UvYnl0ZWJhc2UvYmFja2VuZC9nZW5lcmF0ZWQtZ28vdjGiAgNCWFiqAgtCeXRlYmFzZS5WMcoCC0J5dGViYXNlXFYx4gIXQnl0ZWJhc2VcVjFcR1BCTWV0YWRhdGHqAgxCeXRlYmFzZTo6VjFiBnByb3RvMw", [file_buf_validate_validate, file_google_api_annotations, file_google_api_client, file_google_api_field_behavior, file_google_api_resource, file_google_protobuf_empty, file_google_protobuf_field_mask, file_google_protobuf_timestamp, file_v1_annotation, file_v1_common]);
/**
* Describes the message bytebase.v1.GetUserRequest.
diff --git a/frontend/src/types/proto-es/v1/workspace_service_pb.js b/frontend/src/types/proto-es/v1/workspace_service_pb.js
index dd61e7755e..17786fef74 100644
--- a/frontend/src/types/proto-es/v1/workspace_service_pb.js
+++ b/frontend/src/types/proto-es/v1/workspace_service_pb.js
@@ -16,7 +16,7 @@ import { file_v1_iam_policy } from "./iam_policy_pb";
* Describes the file v1/workspace_service.proto.
*/
export const file_v1_workspace_service = /*@__PURE__*/
- fileDesc("Chp2MS93b3Jrc3BhY2Vfc2VydmljZS5wcm90bxILYnl0ZWJhc2UudjEiTwofUm90YXRlRGlyZWN0b3J5U3luY1R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ZXF1ZXN0Gi0uYnl0ZWJhc2UudjEuUm90YXRlRGlyZWN0b3J5U3luY1Rva2VuUmVzcG9uc2UidNpBBG5hbWWK6jAmYmIud29ya3NwYWNlcy5yb3RhdGVEaXJlY3RvcnlTeW5jVG9rZW6Q6jABmOowAYLT5JMCNToBKiIwL3YxL3tuYW1lPXdvcmtzcGFjZXMvKn06cm90YXRlRGlyZWN0b3J5U3luY1Rva2VuQqsBCg9jb20uYnl0ZWJhc2UudjFCFVdvcmtzcGFjZVNlcnZpY2VQcm90b1ABWjRnaXRodWIuY29tL2J5dGViYXNlL2J5dGViYXNlL2JhY2tlbmQvZ2VuZXJhdGVkLWdvL3YxogIDQlhYqgILQnl0ZWJhc2UuVjHKAgtCeXRlYmFzZVxWMeICF0J5dGViYXNlXFYxXEdQQk1ldGFkYXRh6gIMQnl0ZWJhc2U6OlYxYgZwcm90bzM", [file_google_api_annotations, file_google_api_client, file_google_api_field_behavior, file_google_api_resource, file_google_protobuf_field_mask, file_v1_annotation, file_v1_auth_service, file_v1_iam_policy]);
+ fileDesc("Chp2MS93b3Jrc3BhY2Vfc2VydmljZS5wcm90bxILYnl0ZWJhc2UudjEiTwofUm90YXRlRGlyZWN0b3J5U3luY1Rva2VuUmVxdWVzdBIsCgRuYW1lGAEgASgJQh7gQQL6QRgKFmJ5dGViYXNlLmNvbS9Xb3Jrc3BhY2UiNgogUm90YXRlRGlyZWN0b3J5U3luY1Rva2VuUmVzcG9uc2USEgoFdG9rZW4YASABKAlCA+BBAyIXChVMaXN0V29ya3NwYWNlc1JlcXVlc3QiRAoWTGlzdFdvcmtzcGFjZXNSZXNwb25zZRIqCgp3b3Jrc3BhY2VzGAEgAygLMhYuYnl0ZWJhc2UudjEuV29ya3NwYWNlIiMKE0dldFdvcmtzcGFjZVJlcXVlc3QSDAoEbmFtZRgBIAEoCSI2CglXb3Jrc3BhY2USDAoEbmFtZRgBIAEoCRINCgV0aXRsZRgCIAEoCRIMCgRsb2dvGAMgASgJIisKFk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coCC0J5dGViYXNlXFYx4gIXQnl0ZWJhc2VcVjFcR1BCTWV0YWRhdGHqAgxCeXRlYmFzZTo6VjFiBnByb3RvMw", [file_google_api_annotations, file_google_api_client, file_google_api_field_behavior, file_google_api_resource, file_google_protobuf_field_mask, file_v1_annotation, file_v1_auth_service, file_v1_iam_policy]);
/**
* Describes the message bytebase.v1.RotateDirectorySyncTokenRequest.
diff --git a/proto/gen/grpc-doc/openapi.yaml b/proto/gen/grpc-doc/openapi.yaml
index 1f587ffca9..0f0fdf383e 100644
--- a/proto/gen/grpc-doc/openapi.yaml
+++ b/proto/gen/grpc-doc/openapi.yaml
@@ -26155,6 +26155,19 @@ components:
Protocol) server's delegated credential. The values are copied verbatim from
the verified credential's grant state; empty fields record that the grant
stored nothing (legacy sessions), never a resolved or synthesized value.
+ bytebase.v1.MCPMethodClass:
+ type: string
+ title: MCPMethodClass
+ enum:
+ - MCP_METHOD_CLASS_UNSPECIFIED
+ - READ
+ - WRITE
+ - FORBIDDEN
+ description: |-
+ Classification of an RPC for MCP (AI agent) sessions. The effective
+ authorization of an MCP session is this classification intersected with the
+ caller's own RBAC: it can only ever narrow what the human could do, never
+ widen it.
bytebase.v1.MaskingExemptionPolicy:
type: object
properties:
diff --git a/proto/gen/grpc-doc/v1/README.md b/proto/gen/grpc-doc/v1/README.md
index 49598787ae..aca89cce73 100644
--- a/proto/gen/grpc-doc/v1/README.md
+++ b/proto/gen/grpc-doc/v1/README.md
@@ -5,11 +5,13 @@
- [v1/annotation.proto](#v1_annotation-proto)
- [AuthMethod](#bytebase-v1-AuthMethod)
+ - [MCPMethodClass](#bytebase-v1-MCPMethodClass)
- [File-level Extensions](#v1_annotation-proto-extensions)
- [File-level Extensions](#v1_annotation-proto-extensions)
- [File-level Extensions](#v1_annotation-proto-extensions)
- [File-level Extensions](#v1_annotation-proto-extensions)
+ - [File-level Extensions](#v1_annotation-proto-extensions)
- [v1/access_grant_service.proto](#v1_access_grant_service-proto)
- [AccessGrant](#bytebase-v1-AccessGrant)
@@ -801,6 +803,23 @@ Authorization method for RPC calls.
| CUSTOM | 2 | Custom authorization logic. |
+
+<a name="bytebase-v1-MCPMethodClass"></a>
+
+### MCPMethodClass
+Classification of an RPC for MCP (AI agent) sessions. The effective
+authorization of an MCP session is this classification intersected with the
+caller&#39;s own RBAC: it can only ever narrow what the human could do, never
+widen it.
+
+| Name | Number | Description |
+| ---- | ------ | ----------- |
+| MCP_METHOD_CLASS_UNSPECIFIED | 0 | Not yet classified. Reaches its handler, subject to RBAC as usual — the classification is being rolled out method by method, and only FORBIDDEN is enforced today. |
+| READ | 1 | Served to a read-only MCP session and above. |
+| WRITE | 2 | Served to a read-write MCP session only. |
+| FORBIDDEN | 3 | Never reachable by an MCP session, whatever the caller&#39;s own permissions are. These methods escape the MCP boundary rather than merely exercising a permission: a human with the permission uses the console; an agent acting for them does not get to. |
+
+
@@ -812,6 +831,7 @@ Authorization method for RPC calls.
| allow_without_credential | bool | .google.protobuf.MethodOptions | 100000 | Whether the method allows access without authentication credentials. |
| audit | bool | .google.protobuf.MethodOptions | 100003 | Whether to audit calls to this method. |
| auth_method | AuthMethod | .google.protobuf.MethodOptions | 100002 | The authorization method to use for this RPC. |
+| mcp_method_class | MCPMethodClass | .google.protobuf.MethodOptions | 100004 | How the method is classified for MCP (AI agent) sessions. |
| permission | string | .google.protobuf.MethodOptions | 100001 | The permission required to call this method. |
diff --git a/proto/gen/grpc-doc/v1/index.html b/proto/gen/grpc-doc/v1/index.html
index 71909a969b..8f6b05051d 100644
--- a/proto/gen/grpc-doc/v1/index.html
+++ b/proto/gen/grpc-doc/v1/index.html
@@ -183,6 +183,14 @@
<a href="#bytebase.v1.AuthMethod"><span class="badge">E</span>AuthMethod</a>
</li>
+ <li>
+ <a href="#bytebase.v1.MCPMethodClass"><span class="badge">E</span>MCPMethodClass</a>
+ </li>
+
+
+ <li>
+ <a href="#v1%2fannotation.proto-extensions"><span class="badge">X</span>File-level Extensions</a>
+ </li>
<li>
<a href="#v1%2fannotation.proto-extensions"><span class="badge">X</span>File-level Extensions</a>
@@ -3172,6 +3180,46 @@
</tbody>
</table>
+ <h3 id="bytebase.v1.MCPMethodClass">MCPMethodClass</h3>
+ <p>Classification of an RPC for MCP (AI agent) sessions. The effective</p><p>authorization of an MCP session is this classification intersected with the</p><p>caller's own RBAC: it can only ever narrow what the human could do, never</p><p>widen it.</p>
+ <table class="enum-table">
+ <thead>
+ <tr><td>Name</td><td>Number</td><td>Description</td></tr>
+ </thead>
+ <tbody>
+
+ <tr>
+ <td>MCP_METHOD_CLASS_UNSPECIFIED</td>
+ <td>0</td>
+ <td><p>Not yet classified. Reaches its handler, subject to RBAC as usual —
+the classification is being rolled out method by method, and only
+FORBIDDEN is enforced today.</p></td>
+ </tr>
+
+ <tr>
+ <td>READ</td>
+ <td>1</td>
+ <td><p>Served to a read-only MCP session and above.</p></td>
+ </tr>
+
+ <tr>
+ <td>WRITE</td>
+ <td>2</td>
+ <td><p>Served to a read-write MCP session only.</p></td>
+ </tr>
+
+ <tr>
+ <td>FORBIDDEN</td>
+ <td>3</td>
+ <td><p>Never reachable by an MCP session, whatever the caller&#39;s own
+permissions are. These methods escape the MCP boundary rather than
+merely exercising a permission: a human with the permission uses the
+console; an agent acting for them does not get to.</p></td>
+ </tr>
+
+ </tbody>
+ </table>
+
<h3 id="v1/annotation.proto-extensions">File-level Extensions</h3>
@@ -3205,6 +3253,14 @@
<td><p>The authorization method to use for this RPC.</p></td>
</tr>
+ <tr>
+ <td>mcp_method_class</td>
+ <td><a href="#bytebase.v1.MCPMethodClass">MCPMethodClass</a></td>
+ <td><a href="#google.protobuf.MethodOptions">.google.protobuf.MethodOptions</a></td>
+ <td>100004</td>
+ <td><p>How the method is classified for MCP (AI agent) sessions.</p></td>
+ </tr>
+
<tr>
<td>permission</td>
<td><a href="#string">string</a></td>
@@ -3343,14 +3399,14 @@ Format: instances/{instance}/databases/{database} </p></td>
<td></td>
<td><p>The default schema to execute the query. </p></td>
</tr>
-
+
<tr>
<td>container</td>
<td><a href="#string">string</a></td>
<td></td>
<td><p>The container name to execute the query against, used for CosmosDB only. </p></td>
</tr>
-
+
</tbody>
</table>
diff --git a/proto/v1/v1/annotation.proto b/proto/v1/v1/annotation.proto
index 9fdec724cf..c8804d62ad 100644
--- a/proto/v1/v1/annotation.proto
+++ b/proto/v1/v1/annotation.proto
@@ -16,6 +16,8 @@ extend google.protobuf.MethodOptions {
AuthMethod auth_method = 100002;
// Whether to audit calls to this method.
bool audit = 100003;
+ // How the method is classified for MCP (AI agent) sessions.
+ MCPMethodClass mcp_method_class = 100004;
}
// Authorization method for RPC calls.
@@ -27,3 +29,23 @@ enum AuthMethod {
// Custom authorization logic.
CUSTOM = 2;
}
+
+// Classification of an RPC for MCP (AI agent) sessions. The effective
+// authorization of an MCP session is this classification intersected with the
+// caller's own RBAC: it can only ever narrow what the human could do, never
+// widen it.
+enum MCPMethodClass {
+ // Not yet classified. Reaches its handler, subject to RBAC as usual —
+ // the classification is being rolled out method by method, and only
+ // FORBIDDEN is enforced today.
+ MCP_METHOD_CLASS_UNSPECIFIED = 0;
+ // Served to a read-only MCP session and above.
+ READ = 1;
+ // Served to a read-write MCP session only.
+ WRITE = 2;
+ // Never reachable by an MCP session, whatever the caller's own
+ // permissions are. These methods escape the MCP boundary rather than
+ // merely exercising a permission: a human with the permission uses the
+ // console; an agent acting for them does not get to.
+ FORBIDDEN = 3;
+}
diff --git a/proto/v1/v1/auth_service.proto b/proto/v1/v1/auth_service.proto
index dfd3d070de..1de3c9b612 100644
--- a/proto/v1/v1/auth_service.proto
+++ b/proto/v1/v1/auth_service.proto
@@ -20,6 +20,7 @@ service AuthService {
};
option (bytebase.v1.allow_without_credential) = true;
option (bytebase.v1.audit) = true;
+ option (bytebase.v1.mcp_method_class) = FORBIDDEN;
}
// Logs out the current user session.
@@ -31,6 +32,7 @@ service AuthService {
};
option (bytebase.v1.allow_without_credential) = true;
option (bytebase.v1.audit) = true;
+ option (bytebase.v1.mcp_method_class) = FORBIDDEN;
}
// Exchanges an external OIDC token for a Bytebase access token.
@@ -43,6 +45,7 @@ service AuthService {
};
option (bytebase.v1.allow_without_credential) = true;
option (bytebase.v1.audit) = true;
+ option (bytebase.v1.mcp_method_class) = FORBIDDEN;
}
// Registers a new user account. Creates a principal and assigns a workspace:
@@ -56,6 +59,7 @@ service AuthService {
};
option (bytebase.v1.allow_without_credential) = true;
option (bytebase.v1.audit) = true;
+ option (bytebase.v1.mcp_method_class) = FORBIDDEN;
}
// Refreshes the access token using the refresh token cookie.
@@ -66,6 +70,7 @@ service AuthService {
body: "*"
};
option (bytebase.v1.allow_without_credential) = true;
+ option (bytebase.v1.mcp_method_class) = FORBIDDEN;
}
// Switches the current user's active workspace and issues new tokens.
@@ -76,6 +81,7 @@ service AuthService {
body: "*"
};
option (bytebase.v1.auth_method) = CUSTOM;
+ option (bytebase.v1.mcp_method_class) = FORBIDDEN;
}
// Requests a password reset email for the given email address.
@@ -87,6 +93,7 @@ service AuthService {
body: "*"
};
option (bytebase.v1.allow_without_credential) = true;
+ option (bytebase.v1.mcp_method_class) = FORBIDDEN;
}
// Resets the user's password using a password reset token from email.
@@ -97,6 +104,7 @@ service AuthService {
body: "*"
};
option (bytebase.v1.allow_without_credential) = true;
+ option (bytebase.v1.mcp_method_class) = FORBIDDEN;
}
// Sends a 6-digit verification code to the email for login/signup.
@@ -109,6 +117,7 @@ service AuthService {
};
option (bytebase.v1.allow_without_credential) = true;
option (bytebase.v1.audit) = true;
+ option (bytebase.v1.mcp_method_class) = FORBIDDEN;
}
}
diff --git a/proto/v1/v1/user_service.proto b/proto/v1/v1/user_service.proto
index a5a5d78ef1..b2d088fc9c 100644
--- a/proto/v1/v1/user_service.proto
+++ b/proto/v1/v1/user_service.proto
@@ -79,6 +79,7 @@ service UserService {
option (google.api.method_signature) = "user,update_mask";
option (bytebase.v1.auth_method) = CUSTOM;
option (bytebase.v1.audit) = true;
+ option (bytebase.v1.mcp_method_class) = FORBIDDEN;
}
// Deletes a user. Requires bb.users.delete permission with additional validation: the last remaining workspace admin cannot be deleted.
diff --git a/proto/v1/v1/workspace_service.proto b/proto/v1/v1/workspace_service.proto
index 1f1ee9a099..d08729fc28 100644
--- a/proto/v1/v1/workspace_service.proto
+++ b/proto/v1/v1/workspace_service.proto
@@ -58,6 +58,7 @@ service WorkspaceService {
option (bytebase.v1.permission) = "bb.workspaces.delete";
option (bytebase.v1.auth_method) = IAM;
option (bytebase.v1.audit) = true;
+ option (bytebase.v1.mcp_method_class) = FORBIDDEN;
}
// Removes the calling user from a workspace and switches to the next
@@ -70,6 +71,7 @@ service WorkspaceService {
};
option (bytebase.v1.auth_method) = CUSTOM;
option (bytebase.v1.audit) = true;
+ option (bytebase.v1.mcp_method_class) = FORBIDDEN;
}
// Sets IAM policy for the workspace.