From b95642c1e0e03972efc1748fdd526172c9159559 Mon Sep 17 00:00:00 2001 From: Waldek Mastykarz Date: Wed, 26 Jun 2024 09:05:48 +0200 Subject: [PATCH] Excludes OPTIONS requests in Graph permissions plugins (#807) --- .../RequestLogs/MinimalPermissionsGuidancePlugin.cs | 5 +++++ dev-proxy-plugins/RequestLogs/MinimalPermissionsPlugin.cs | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/dev-proxy-plugins/RequestLogs/MinimalPermissionsGuidancePlugin.cs b/dev-proxy-plugins/RequestLogs/MinimalPermissionsGuidancePlugin.cs index b6efca57..af4721b2 100644 --- a/dev-proxy-plugins/RequestLogs/MinimalPermissionsGuidancePlugin.cs +++ b/dev-proxy-plugins/RequestLogs/MinimalPermissionsGuidancePlugin.cs @@ -71,6 +71,11 @@ private async Task AfterRecordingStop(object? sender, RecordingArgs e) var methodAndUrlString = request.MessageLines.First(); var methodAndUrl = GetMethodAndUrl(methodAndUrlString); + if (methodAndUrl.method.Equals("OPTIONS", StringComparison.OrdinalIgnoreCase)) + { + continue; + } + var requestsFromBatch = Array.Empty<(string method, string url)>(); var uri = new Uri(methodAndUrl.url); diff --git a/dev-proxy-plugins/RequestLogs/MinimalPermissionsPlugin.cs b/dev-proxy-plugins/RequestLogs/MinimalPermissionsPlugin.cs index 9dca71c3..4f8be652 100644 --- a/dev-proxy-plugins/RequestLogs/MinimalPermissionsPlugin.cs +++ b/dev-proxy-plugins/RequestLogs/MinimalPermissionsPlugin.cs @@ -62,6 +62,10 @@ private async Task AfterRecordingStop(object? sender, RecordingArgs e) var methodAndUrlString = request.MessageLines.First(); var methodAndUrl = GetMethodAndUrl(methodAndUrlString); + if (methodAndUrl.method.Equals("OPTIONS", StringComparison.OrdinalIgnoreCase)) + { + continue; + } var uri = new Uri(methodAndUrl.url); if (!ProxyUtils.IsGraphUrl(uri))