{"record":{"id":"b67e90a892c6ea3b","repo":"microsoft/semantic-kernel","slug":"the-address-address-is-not-allowed-for-the-o","errorCode":null,"errorMessage":"The address '{address}' is not allowed for the '{operation.Name}' gRPC operation. The address must match one of the allowed base addresses.","messagePattern":"The address '(.+?)' is not allowed for the '(.+?)' gRPC operation\\. The address must match one of the allowed base addresses\\.","errorType":"exception","errorClass":"KernelException","httpStatus":null,"severity":"error","filePath":"dotnet/src/Functions/Functions.Grpc/GrpcOperationRunner.cs","lineNumber":215,"sourceCode":"                {\n                    // If the allowed URI already ends at a boundary (e.g., trailing '/'),\n                    // or the full URIs match exactly, no further check is needed.\n                    // Otherwise, ensure the next character is a path boundary to prevent\n                    // prefix bypasses (e.g., allowed \"https://host/grpc\" should not match \"https://host/grpcevil\").\n                    int prefixLength = allowedUri.Length;\n                    if (prefixLength >= addressUri.AbsoluteUri.Length ||\n                        allowedUri[prefixLength - 1] is '/' ||\n                        addressUri.AbsoluteUri[prefixLength] is '/' or '?' or '#')\n                    {\n                        isAllowed = true;\n                        break;\n                    }\n                }\n            }\n\n            if (!isAllowed)\n            {\n                throw new KernelException($\"The address '{address}' is not allowed for the '{operation.Name}' gRPC operation. The address must match one of the allowed base addresses.\");\n            }\n        }\n\n        return address!;\n    }\n\n    /// <summary>\n    /// Creates a marshaller - a typed abstraction for gRPC message serialization and deserialization.\n    /// </summary>\n    /// <param name=\"contractType\">The message contract data type.</param>\n    /// <returns>The marshaller.</returns>\n    private Marshaller<T> CreateMarshaller<T>(Type contractType)\n    {\n        byte[] Serialize(T instance)\n        {\n            using var memoryStream = new MemoryStream();\n\n            Serializer.NonGeneric.Serialize(memoryStream, instance);","sourceCodeStart":197,"sourceCodeEnd":233,"githubUrl":"https://github.com/microsoft/semantic-kernel/blob/c028a0c7dc4f0814cdcbaba9d998f187a41197bf/dotnet/src/Functions/Functions.Grpc/GrpcOperationRunner.cs#L197-L233","documentation":"Thrown when `_allowedAddresses` is configured (non-empty) and the resolved operation address does not prefix-match any allowed base address with a proper boundary (`/`, `?`, or `#` after the prefix). This is an SSRF guard: even with a valid scheme, the destination must fall under a whitelisted base.","triggerScenarios":"Allowed base is `https://internal.example.com/` and the address is `https://internal.example.com.evil.com/` (no boundary) or `https://other.example.com/` (no match).","commonSituations":"Address override pointing outside the approved base; production allow-list missing the new service host after a migration; trailing-slash mismatch between allow-list entry and address.","solutions":["Point the address at a URL that starts with (and is bounded by) an allowed base address.","Add the service's base address to AllowedAddresses in GrpcOperationRunnerOptions.","Ensure the allow-list entry ends with `/` if the base is a path prefix."],"exampleFix":"// before\n// allowed = [https://api.example.com/], address = https://api2.example.com/v1\n// after\noptions.AllowedAddresses = new[] { new Uri(\"https://api2.example.com/\") };\n// or use an already-allowed host","handlingStrategy":"validation","validationCode":"bool allowed(Uri addr, IEnumerable<Uri> bases) =>\n    bases.Any(b => addr.AbsoluteUri.StartsWith(b.AbsoluteUri, StringComparison.OrdinalIgnoreCase));","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Maintain an explicit, reviewed AllowedAddresses list.","End base addresses with '/' when they are path prefixes."],"tags":["grpc","network","security","ssrf","configuration"],"backgroundTag":null,"analyzedSha":"c028a0c7dc4f0814cdcbaba9d998f187a41197bf","analyzedAt":"2026-08-13T13:48:05.040Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}