Skip to content

Commit 37f3885

Browse files
authored
Fix for: Malicious OData requests trigger exception monitoring (#8141)
* Remove exception logging for OData format exception in Get
1 parent a4403ae commit 37f3885

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

src/NuGetGallery/Controllers/ODataV2FeedController.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
using System.Web.Http;
1010
using System.Web.Http.OData;
1111
using System.Web.Http.OData.Query;
12+
using Microsoft.Data.OData;
1213
using NuGet.Frameworks;
1314
using NuGet.Services.Entities;
1415
using NuGet.Versioning;
@@ -121,6 +122,10 @@ public async Task<IHttpActionResult> Get(
121122
customQuery = true;
122123
}
123124
}
125+
catch (ODataException ex) when (ex.InnerException != null && ex.InnerException is FormatException)
126+
{
127+
// Sometimes users make invalid requests. It's not exceptional behavior, don't trace.
128+
}
124129
catch (Exception ex)
125130
{
126131
// Swallowing Exception intentionally. If *anything* goes wrong in search, just fall back to the database.
@@ -634,4 +639,4 @@ internal IQueryable<Package> GetAll()
634639
return _readWritePackagesRepository.GetAll();
635640
}
636641
}
637-
}
642+
}

0 commit comments

Comments
 (0)