Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
fix(mcp): canonicalize a requested scope set to its maximum, don't reject it
Vincent Huang3c4846d4afae
diff --git a/backend/api/mcp/server_test.go b/backend/api/mcp/server_test.goindex b1b7fb8bec..1adf67540a 100644--- a/backend/api/mcp/server_test.go+++ b/backend/api/mcp/server_test.go@@ -104,6 +104,17 @@ func TestMCPAuthMiddleware(t *testing.T) {// RFC 9728 §3.3 strict clients receive metadata whose `resource`// field matches the URL they were accessing.require.Contains(t, wwwAuth, "https://bb.example.com/.well-known/oauth-protected-resource/mcp")+ // Containment for the MCP scope vocabulary: the challenge must not+ // advertise scopes while P1a persists and echoes a consented mode+ // that nothing enforces yet (the access token is still a generic+ // bearer the whole API accepts). Advertising here is what would make+ // clients request a mode and treat the echoed `scope` as a guarantee.+ // The v1 bootstrap does call for listing the full mode set in this+ // challenge — but only in the change that lands P1b enforcement.+ require.NotContains(t, wwwAuth, "scope=",+ "the challenge may advertise scopes only alongside P1b enforcement")+ require.NotContains(t, wwwAuth, "mcp:read",+ "no scope token may leak into the challenge")})}}diff --git a/backend/api/oauth2/discovery_test.go b/backend/api/oauth2/discovery_test.goindex d717152d25..debb001145 100644--- a/backend/api/oauth2/discovery_test.go+++ b/backend/api/oauth2/discovery_test.go@@ -72,3 +72,34 @@ func TestProtectedResourceMetadataMatchesRequestedResource(t *testing.T) {})}}++// TestDiscoveryOmitsScopesSupported is a containment test, not a feature test.+//+// P1a persists and echoes the consented scope but nothing enforces it yet: the+// access token is still a generic bearer the whole API accepts. Advertising+// `scopes_supported` would invite clients to request a mode and then rely on the+// echoed `scope` as a guarantee the server does not yet keep — the same+// "read-only is a label, not a boundary" failure this project exists to remove.+//+// So the vocabulary stays undiscoverable until P1b enforces it. Both this+// document and the /mcp WWW-Authenticate challenge (see the MCP server's own+// test) must stay silent about scopes, and either may start advertising them+// only in the change that lands enforcement.+func TestDiscoveryOmitsScopesSupported(t *testing.T) {+ s := &Service{profile: &config.Profile{ExternalURL: "https://bb.example.com"}}++ e := echo.New()+ req := httptest.NewRequest(http.MethodGet, "/.well-known/oauth-authorization-server", nil)+ rec := httptest.NewRecorder()+ c := e.NewContext(req, rec)++ require.NoError(t, s.handleDiscovery(c))+ require.Equal(t, http.StatusOK, rec.Code)++ var raw map[string]any+ require.NoError(t, json.Unmarshal(rec.Body.Bytes(), &raw))+ require.NotContains(t, raw, "scopes_supported",+ "advertising the scope vocabulary before P1b enforces it would let a client rely on a mode the server does not honor; add this only alongside enforcement")+ require.NotContains(t, rec.Body.String(), "mcp:read",+ "no scope token may leak into discovery through any other field")+}diff --git a/backend/api/oauth2/grant_test.go b/backend/api/oauth2/grant_test.goindex 4b1f7a19bd..e97066abd1 100644--- a/backend/api/oauth2/grant_test.go+++ b/backend/api/oauth2/grant_test.go@@ -266,7 +266,7 @@ func TestResourceScopeGrantLifecycle(t *testing.T) {})t.Run("a grant with no consented resource survives a resource-bearing exchange", func(t *testing.T) {- // This is the upgrade path. A code or refresh token issued before 3.21.5+ // This is the upgrade path. A code or refresh token issued before 3.22.1// has no stored resource, and RFC 8707 clients keep sending `resource` on// every exchange and refresh — so rejecting the parameter here would fail// in-flight codes and every live session at its next refresh. The@@ -306,12 +306,34 @@ func TestResourceScopeGrantLifecycle(t *testing.T) {require.Empty(t, rotated.Config.GetResource())})- t.Run("consent rejects two scope tiers in one parameter", func(t *testing.T) {+ t.Run("a requested scope set is consented as its maximum", func(t *testing.T) {// Distinct from the repeated-parameter case above: one `scope` value- // carrying both tiers. A grant binds to a single predefined set, so a- // combination names nothing resolvable.- redirect := consent(t, configured, url.Values{"scope": {"mcp:read-only mcp:read-write"}})- require.Equal(t, "invalid_scope", redirect.Query().Get("error"))+ // naming both tiers, which is what the v1 bootstrap produces — the 401+ // challenge advertises every mode pre-authentication, so clients ask for+ // all of them. The set resolves to one stored mode; a multi-mode string+ // must never reach the grant record.+ code := consentOK(t, configured, url.Values{"scope": {"mcp:read-only mcp:read-write"}})++ got, err := st.GetOAuth2AuthorizationCode(ctx, testClientID, code)+ require.NoError(t, err)+ require.Equal(t, "mcp:read-write", got.Config.Scope)++ // And the client can keep sending the set it asked for: it normalizes to+ // the same mode, so the exchange matches instead of failing.+ first := tokenOK(t, configured, url.Values{+ "grant_type": {"authorization_code"},+ "code": {code},+ "redirect_uri": {testRedirectURI},+ "code_verifier": {testCodeVerifier},+ "client_id": {testClientID},+ "scope": {"mcp:read-only mcp:read-write"},+ })+ require.Equal(t, "mcp:read-write", first.Scope)++ stored, err := st.GetOAuth2RefreshToken(ctx, testClientID, auth.HashToken(first.RefreshToken))+ require.NoError(t, err)+ require.NotNil(t, stored)+ require.Equal(t, "mcp:read-write", stored.Config.GetScope())})}diff --git a/backend/api/oauth2/resource.go b/backend/api/oauth2/resource.goindex ab28110ce9..8690e6a0d4 100644--- a/backend/api/oauth2/resource.go+++ b/backend/api/oauth2/resource.go@@ -32,18 +32,21 @@ const externalURLSetupError = "MCP OAuth requires a configured external URL. Sta// site; every other validation failure is a client error.var errExternalURLNotConfigured = errors.New("no configured external URL to validate the resource against")-// knownScopes is the P1a scope vocabulary: one scope per predefined permission-// set. P1a persists and echoes the consented scope; enforcement is P1b, and the-// consent-time picker that lets a user choose between them lands with it. Until-// then an unknown scope is rejected rather than silently dropped, so a client-// never believes it holds something we did not grant.-var knownScopes = []string{"mcp:read-only", "mcp:read-write"}+// scopeLadder is the P1a scope vocabulary — one scope per predefined permission+// set — ordered narrowest to widest. Vocabulary per proposal v2 §4; the+// Metadata-only tier is deferred, so there are two rungs.+//+// The scopes are tiers rather than additive permissions, which is why a request+// naming several of them reduces to the highest one instead of their union. P1a+// persists and echoes the selected mode; enforcement is P1b, and the consent-time+// picker that lets a user choose below the requested maximum lands with it.+var scopeLadder = []string{"mcp:read-only", "mcp:read-write"}// grantParams is the validated resource/scope pair consented for one grant.type grantParams struct {// resource is canonical (see canonicalizeResourceURI) or empty.resource string- // scope is the client's scope string, stored verbatim, or empty.+ // scope is the single mode the requested scope set resolved to, or empty.scope string}@@ -107,11 +110,12 @@ func (s *Service) parseGrantParams(ctx context.Context, values url.Values) (granif err != nil {return grantParams{}, &oauth2Failure{code: "invalid_target", description: err.Error()}}- scope, err := singleValue(values, "scope")+ requestedScope, err := singleValue(values, "scope")if err != nil {return grantParams{}, &oauth2Failure{code: "invalid_scope", description: err.Error()}}- if err := validateScope(scope); err != nil {+ scope, err := canonicalizeScope(requestedScope)+ if err != nil {return grantParams{}, &oauth2Failure{code: "invalid_scope", description: err.Error()}}if resource == "" {@@ -156,7 +160,7 @@ func checkConsentedResource(values url.Values, consented string) *oauth2Failureif err != nil {return &oauth2Failure{code: "invalid_target", description: err.Error()}}- // Codes and refresh tokens issued before 3.21.5 read back with no resource,+ // Codes and refresh tokens issued before 3.22.1 read back with no resource,// and RFC 8707 clients send `resource` on every exchange *and* every refresh.// Rejecting it would fail each in-flight code and every live session at its// next refresh, for up to a refresh-token lifetime after upgrade. Accept it@@ -182,23 +186,35 @@ func checkConsentedResource(values url.Values, consented string) *oauth2Failure// authority, and changing what a session may do happens on the grant page, never// by asking for a different scope at the token endpoint.//+// The requested value is normalized the same way consent normalized it, so a+// client that keeps sending its full requested set matches the single mode that+// set resolved to.+//// A grant with no stored scope is treated the same way as one with no stored// resource, and for the same upgrade reason: RFC 6749 §6 lets a client send-// `scope` on a refresh, so a pre-3.21.5 grant would start failing its refreshes.-// The requested value is ignored rather than adopted, so the grant keeps the-// (empty) scope it was issued with.+// `scope` on a refresh, so a pre-3.22.1 grant would start failing its refreshes.+// That case returns before normalization on purpose — a legacy client may be+// sending a custom scope that was simply ignored before this change, and running+// it through the vocabulary check would turn "ignored" into "rejected".func checkConsentedScope(values url.Values, consented string) *oauth2Failure {requested, err := singleValue(values, "scope")if err != nil {return &oauth2Failure{code: "invalid_scope", description: err.Error()}}- if requested == "" || requested == consented || consented == "" {+ if requested == "" || consented == "" {return nil}- return &oauth2Failure{- code: "invalid_scope",- description: "scope cannot be changed when exchanging or refreshing a token; reconnect to authorize a different scope",+ canonical, err := canonicalizeScope(requested)+ if err != nil {+ return &oauth2Failure{code: "invalid_scope", description: err.Error()}+ }+ if canonical != consented {+ return &oauth2Failure{+ code: "invalid_scope",+ description: "scope cannot be changed when exchanging or refreshing a token; reconnect to authorize a different scope",+ }}+ return nil}// singleValue returns the sole value of name, "" when absent, and an error when@@ -278,25 +294,30 @@ func canonicalizeResourceURI(resource string) (string, error) {return scheme + "://" + strings.ToLower(u.Host) + strings.TrimSuffix(u.EscapedPath(), "/"), nil}-// validateScope accepts an empty scope (the common case today — no client asks-// for one) and otherwise requires exactly one token from the known vocabulary.+// canonicalizeScope reduces a requested scope set to the one mode a grant can be+// bound to: the requested maximum, the highest rung named. Returns "" for an+// empty or whitespace-only request.//-// Exactly one, not a set of them: a grant is bound to a single predefined-// permission set (proposal v2 §4 — "consent binds the grant to a predefined-// set", stored as one set reference). The scopes are a ladder, not additive-// permissions, so `mcp:read-only mcp:read-write` names no set that can be-// resolved. Accepting it would persist and echo a scope string with no-// representation in the model P1b enforces against.-func validateScope(scope string) error {- tokens := strings.Fields(scope)- if len(tokens) == 0 {- return nil- }- if len(tokens) > 1 {- return errors.Errorf("scope must name exactly one permission set, got %d tokens; supported scopes are %s", len(tokens), strings.Join(knownScopes, " "))- }- if !slices.Contains(knownScopes, tokens[0]) {- return errors.Errorf("unknown scope %q; supported scopes are %s", tokens[0], strings.Join(knownScopes, " "))+// A set is normal input, not a malformed request. The v1 bootstrap has the 401+// challenge advertise every mode — it is pre-authentication, so it cannot be+// capped by a workspace ceiling — and clients therefore ask for everything; the+// consent picker then selects a mode at or below that maximum (research doc §5.4,+// "Scope normalization"). Two values are tracked separately: the client's+// requested maximum, which this produces, and the durable consented grant, which+// is always exactly one mode.+//+// Unknown tokens are rejected rather than dropped, so a client never believes it+// holds something we did not grant.+func canonicalizeScope(scope string) (string, error) {+ canonical, highest := "", -1+ for token := range strings.FieldsSeq(scope) {+ rung := slices.Index(scopeLadder, token)+ if rung < 0 {+ return "", errors.Errorf("unknown scope %q; supported scopes are %s", token, strings.Join(scopeLadder, " "))+ }+ if rung > highest {+ canonical, highest = token, rung+ }}- return nil+ return canonical, nil}diff --git a/backend/api/oauth2/resource_test.go b/backend/api/oauth2/resource_test.goindex de02a3abd7..a24f0a8a1e 100644--- a/backend/api/oauth2/resource_test.go+++ b/backend/api/oauth2/resource_test.go@@ -2,6 +2,7 @@ package oauth2import ("net/url"+ "strings""testing""github.com/stretchr/testify/require"@@ -100,35 +101,51 @@ func TestValidateResource(t *testing.T) {})}-func TestValidateScope(t *testing.T) {- t.Run("empty scope is allowed", func(t *testing.T) {- // The consent-time picker is P1b; until it exists every real client- // sends no scope at all, and rejecting that would break MCP entirely.- require.NoError(t, validateScope(""))- })- for _, scope := range knownScopes {- t.Run("known scope "+scope, func(t *testing.T) {- require.NoError(t, validateScope(scope))- })+func TestCanonicalizeScope(t *testing.T) {+ // The v1 bootstrap has the 401 challenge advertise every mode, so clients+ // request the whole set by design. A set is normal input: it resolves to its+ // highest rung, which is the one mode the grant is bound to.+ accepted := []struct {+ name string+ in string+ want string+ }{+ {"empty is allowed", "", ""},+ {"whitespace only is empty", " \t\n ", ""},+ {"read-only alone", "mcp:read-only", "mcp:read-only"},+ {"read-write alone", "mcp:read-write", "mcp:read-write"},+ {"both modes, narrow first", "mcp:read-only mcp:read-write", "mcp:read-write"},+ {"both modes, wide first", "mcp:read-write mcp:read-only", "mcp:read-write"},+ {"repeated token", "mcp:read-only mcp:read-only", "mcp:read-only"},+ // Whatever whitespace a client uses, the stored value is one bare token —+ // the grant record must never hold a padded or multi-token string.+ {"padded and tab-separated", " mcp:read-only\tmcp:read-write ", "mcp:read-write"},}- for _, scope := range []string{"mcp:admin", "openid", "mcp:read-only extra", "MCP:READ-ONLY", "mcp:readonly"} {- t.Run("unknown scope "+scope, func(t *testing.T) {- require.Error(t, validateScope(scope),- "an unrecognized scope must be refused, not silently dropped — a client would otherwise believe it holds something we never granted")+ for _, tc := range accepted {+ t.Run(tc.name, func(t *testing.T) {+ got, err := canonicalizeScope(tc.in)+ require.NoError(t, err)+ require.Equal(t, tc.want, got)+ require.Equal(t, strings.TrimSpace(got), got, "a stored scope must never carry whitespace")+ require.NotContains(t, got, " ", "a stored scope must name exactly one mode")})}- // A grant is bound to ONE predefined set (proposal v2 §4). The scopes are a- // ladder, not additive permissions, so a combination names no resolvable set- // — and persisting one would hand P1b a scope string it cannot map.+ // Unknown tokens are rejected rather than dropped, including when mixed in+ // with recognized ones — otherwise a client would believe the unrecognized+ // part of its request was granted.for _, scope := range []string{- "mcp:read-only mcp:read-write",- "mcp:read-write mcp:read-only",- "mcp:read-only mcp:read-only",+ "mcp:admin",+ "openid",+ "MCP:READ-ONLY",+ "mcp:readonly",+ "mcp:read-only extra",+ "mcp:read-only mcp:admin",+ "mcp:admin mcp:read-write",} {- t.Run("combined tiers rejected: "+scope, func(t *testing.T) {- require.Error(t, validateScope(scope),- "two known tokens are still not a set we can resolve; the tier choice is single-valued")+ t.Run("unknown scope rejected: "+scope, func(t *testing.T) {+ _, err := canonicalizeScope(scope)+ require.Error(t, err)})}}@@ -211,10 +228,20 @@ func TestCheckConsentedScope(t *testing.T) {{"exact match", url.Values{"scope": {"mcp:read-only"}}, "mcp:read-only", ""},{"widening is rejected", url.Values{"scope": {"mcp:read-write"}}, "mcp:read-only", "invalid_scope"},{"narrowing is rejected too (the grant record is the authority)", url.Values{"scope": {"mcp:read-only"}}, "mcp:read-write", "invalid_scope"},+ // The client keeps sending the set it originally requested; it has to+ // normalize to the same mode consent stored, or every refresh would fail.+ {"the original requested set matches the maximum it resolved to", url.Values{"scope": {"mcp:read-only mcp:read-write"}}, "mcp:read-write", ""},+ {"a set whose maximum exceeds the grant is rejected", url.Values{"scope": {"mcp:read-only mcp:read-write"}}, "mcp:read-only", "invalid_scope"},+ {"a set containing an unknown token is rejected", url.Values{"scope": {"mcp:read-write mcp:admin"}}, "mcp:read-write", "invalid_scope"},// Same upgrade path as the resource: RFC 6749 §6 permits `scope` on a// refresh, so a grant issued before the column must not start failing.// Ignored, not adopted — the grant keeps its empty scope.{"scope on a grant that consented none is accepted, not adopted", url.Values{"scope": {"mcp:read-only"}}, "", ""},+ // A legacy client may be sending a scope we never recognized; before this+ // change it was ignored, and it must stay ignored rather than become a+ // rejection. This is why the empty-grant case returns before the+ // vocabulary check.+ {"an unrecognized scope on an unbound grant stays ignored", url.Values{"scope": {"openid profile"}}, "", ""},{"repeated value", url.Values{"scope": {"mcp:read-only", "mcp:read-write"}}, "mcp:read-only", "invalid_scope"},}for _, tc := range cases {diff --git a/backend/generated-go/store/oauth2.pb.go b/backend/generated-go/store/oauth2.pb.goindex b01b6155b1..7a42c64cea 100644--- a/backend/generated-go/store/oauth2.pb.go+++ b/backend/generated-go/store/oauth2.pb.go@@ -99,8 +99,8 @@ type OAuth2RefreshTokenConfig struct {// consent time against the configured external URL. Empty for clients that// omit the resource parameter.Resource string `protobuf:"bytes,1,opt,name=resource,proto3" json:"resource,omitempty"`- // The scope string consented to, stored verbatim. Empty means no scope was- // requested.+ // The single mode consented to, normalized from the client's requested scope+ // set to its maximum. Empty means no scope was requested.Scope string `protobuf:"bytes,2,opt,name=scope,proto3" json:"scope,omitempty"`unknownFields protoimpl.UnknownFieldssizeCache protoimpl.SizeCache@@ -159,8 +159,8 @@ type OAuth2AuthorizationCodeConfig struct {// consent time against the configured external URL. Empty for clients that// omit the resource parameter.Resource string `protobuf:"bytes,4,opt,name=resource,proto3" json:"resource,omitempty"`- // The scope string consented to, stored verbatim. Empty means no scope was- // requested.+ // The single mode consented to, normalized from the client's requested scope+ // set to its maximum. Empty means no scope was requested.Scope string `protobuf:"bytes,5,opt,name=scope,proto3" json:"scope,omitempty"`unknownFields protoimpl.UnknownFieldssizeCache protoimpl.SizeCachediff --git a/backend/store/oauth2_refresh_token.go b/backend/store/oauth2_refresh_token.goindex 01ca5f5c08..bf474c4f73 100644--- a/backend/store/oauth2_refresh_token.go+++ b/backend/store/oauth2_refresh_token.go@@ -24,7 +24,7 @@ type OAuth2RefreshTokenMessage struct {Workspace string// Config is the consented grant state (resource, scope) inherited from the// authorization code. Carried forward unchanged by every refresh — a refresh- // never widens a grant. Empty for tokens created before the 3.21.5 migration.+ // never widens a grant. Empty for tokens created before the 3.22.1 migration.Config *storepb.OAuth2RefreshTokenConfigExpiresAt time.Time}diff --git a/backend/store/oauth2_workspace_test.go b/backend/store/oauth2_workspace_test.goindex 7804580fa9..e76e318077 100644--- a/backend/store/oauth2_workspace_test.go+++ b/backend/store/oauth2_workspace_test.go@@ -127,7 +127,7 @@ func TestOAuth2WorkspaceBinding(t *testing.T) {require.Empty(t, got.Workspace)})- // The refresh token's config payload (3.21.5) is the durable half of the token+ // The refresh token's config payload (3.22.1) is the durable half of the token// boundary: a refresh reads it back to re-issue the same grant, so a dropped// value would silently widen or unbind the session.t.Run("refresh token config round-trips resource and scope", func(t *testing.T) {@@ -152,7 +152,7 @@ func TestOAuth2WorkspaceBinding(t *testing.T) {})t.Run("refresh token with no config stays empty", func(t *testing.T) {- // Both parameters are optional, and rows written before 3.21.5 default to+ // Both parameters are optional, and rows written before 3.22.1 default to// '{}' — either way the handler must see "" and carry "" forward._, err := s.CreateOAuth2RefreshToken(ctx, &store.OAuth2RefreshTokenMessage{TokenHash: "rt-hash-4",diff --git a/proto/gen/grpc-doc/store/README.md b/proto/gen/grpc-doc/store/README.mdindex bd568ee14a..156462c820 100644--- a/proto/gen/grpc-doc/store/README.md+++ b/proto/gen/grpc-doc/store/README.md@@ -3072,7 +3072,7 @@ ReviewSubmission records that an issue entered review.| code_challenge | [string](#string) | | || code_challenge_method | [string](#string) | | || resource | [string](#string) | | The canonical resource URI (RFC 8707) this grant is bound to, validated at consent time against the configured external URL. Empty for clients that omit the resource parameter. |-| scope | [string](#string) | | The scope string consented to, stored verbatim. Empty means no scope was requested. |+| scope | [string](#string) | | The single mode consented to, normalized from the client's requested scope set to its maximum. Empty means no scope was requested. |@@ -3109,7 +3109,7 @@ grant can gain fields without a schema migration.| Field | Type | Label | Description || ----- | ---- | ----- | ----------- || resource | [string](#string) | | The canonical resource URI (RFC 8707) this grant is bound to, validated at consent time against the configured external URL. Empty for clients that omit the resource parameter. |-| scope | [string](#string) | | The scope string consented to, stored verbatim. Empty means no scope was requested. |+| scope | [string](#string) | | The single mode consented to, normalized from the client's requested scope set to its maximum. Empty means no scope was requested. |diff --git a/proto/gen/grpc-doc/store/index.html b/proto/gen/grpc-doc/store/index.htmlindex 5056fff191..96505fe1d6 100644--- a/proto/gen/grpc-doc/store/index.html+++ b/proto/gen/grpc-doc/store/index.html@@ -9109,8 +9109,8 @@ omit the resource parameter. </p></td><td>scope</td><td><a href="#string">string</a></td><td></td>- <td><p>The scope string consented to, stored verbatim. Empty means no scope was-requested. </p></td>+ <td><p>The single mode consented to, normalized from the client's requested scope+set to its maximum. Empty means no scope was requested. </p></td></tr></tbody>@@ -9188,8 +9188,8 @@ omit the resource parameter. </p></td><td>scope</td><td><a href="#string">string</a></td><td></td>- <td><p>The scope string consented to, stored verbatim. Empty means no scope was-requested. </p></td>+ <td><p>The single mode consented to, normalized from the client's requested scope+set to its maximum. Empty means no scope was requested. </p></td></tr></tbody>diff --git a/proto/store/store/oauth2.proto b/proto/store/store/oauth2.protoindex ee3203c6c1..9118795c93 100644--- a/proto/store/store/oauth2.proto+++ b/proto/store/store/oauth2.proto@@ -20,8 +20,8 @@ message OAuth2RefreshTokenConfig {// consent time against the configured external URL. Empty for clients that// omit the resource parameter.string resource = 1;- // The scope string consented to, stored verbatim. Empty means no scope was- // requested.+ // The single mode consented to, normalized from the client's requested scope+ // set to its maximum. Empty means no scope was requested.string scope = 2;}@@ -33,7 +33,7 @@ message OAuth2AuthorizationCodeConfig {// consent time against the configured external URL. Empty for clients that// omit the resource parameter.string resource = 4;- // The scope string consented to, stored verbatim. Empty means no scope was- // requested.+ // The single mode consented to, normalized from the client's requested scope+ // set to its maximum. Empty means no scope was requested.string scope = 5;}