[Cosmos] Onboard CosmosService.GetCosmosBaseUri into EndpointValidator.ValidateAzureServiceEndpoint

Aperta
#4,062 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 2 giorni

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
76/100
Tipo di issue
Funzionalità
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
azure, csharp
Ambito
backend, security

Direzione di ricerca

Read CosmosService.GetCosmosBaseUri in tools/Azure.Mcp.Tools.Cosmos/src/Services/CosmosService.cs and the suffix allow lists in core/Microsoft.Mcp.Core/src/Helpers/EndpointValidator.AllowLists.cs. Follow the existing service validation patterns and add tests for valid and invalid Cosmos endpoints across the listed clouds. Done when the endpoint is validated and the tests cover those cases.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

needs-team-triage server-Azure.Mcp tools-CosmosDB
Area / Tool

Azure.Mcp.Tools.Cosmos (CosmosService)

Describe the improvement

Most service tools in microsoft/mcp validate constructed data-plane endpoint URIs using AzureService.ValidateAzureServiceEndpoint(endpoint, serviceType) with domain suffixes registered in EndpointValidator.AllowLists.cs (for example, AcrService.CreateValidatedAcrEndpoint, PostgresService, SearchService, StorageService, etc., following microsoft/mcp#3603).

Currently, CosmosService.GetCosmosBaseUri constructs the Cosmos DB endpoint URI (https://{accountName}.documents.azure.com:443/ or its sovereign cloud equivalent) without calling AzureService.ValidateAzureServiceEndpoint, and "cosmos" is not yet included in s_allowedDomainSuffixes in EndpointValidator.AllowLists.cs.

Expected behavior

CosmosService.GetCosmosBaseUri should validate the constructed endpoint URI using AzureService.ValidateAzureServiceEndpoint(endpoint, "cosmos"), consistent with the other service tools in the repository.

Proposed Changes
  1. Add a "cosmos" entry to s_allowedDomainSuffixes in EndpointValidator.AllowLists.cs:
    • Public: [".documents.azure.com"]
    • China: [".documents.azure.cn"]
    • UsGov: [".documents.azure.us"]
    • Germany: []
  2. Call AzureService.ValidateAzureServiceEndpoint(baseUri, "cosmos") in CosmosService.GetCosmosBaseUri before returning the endpoint URI.
  3. Add unit tests covering valid and invalid Cosmos endpoint/account inputs across clouds.
Lingua principale
C#
Stelle
3.9k
Fork
689
Merge medio
2g 11h
PR unite (30g)
143

Preparare l'ambiente

Apri in Codespaces

Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di microsoft/mcp

Tutte le issue di microsoft/mcp

Issue simili

Altre issue su C#

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.