{"action":"created","comment":{"url":"https://api.github.com/repos/NuGet/NuGetGallery/pulls/comments/90297121","pull_request_review_id":10816868,"id":90297121,"diff_hunk":"@@ -0,0 +1,194 @@\n+﻿// Copyright (c) .NET Foundation. All rights reserved.\n+// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.\n+\n+using System.Collections.Generic;\n+using System.IO;\n+using System.Reflection;\n+using System.Text;\n+using System.Web.Http.OData.Query;\n+using Newtonsoft.Json;\n+\n+namespace NuGetGallery.OData.QueryFilter\n+{\n+    /// <summary>\n+    /// IODataQueryFilter interface\n+    /// </summary>\n+    public class ODataQueryFilter\n+    {\n+        private static readonly string resourcesNamespace = \"NuGetGallery.OData.QueryAllowed.Data\";\n+        private static readonly int expand = 1;\n+        private static readonly int filter = 2;\n+        private static readonly int format = 4;\n+        private static readonly int inlinecount = 8;\n+        private static readonly int orderby = 16;\n+        private static readonly int select = 32;\n+        private static readonly int skip = 64;\n+        private static readonly int skiptoken = 128;\n+        private static readonly int top = 256;\n+\n+        private HashSet<int> allowedOperatorPatterns = null;\n+\n+        /// <summary>\n+        /// Initialization for a query filter\n+        /// </summary>\n+        /// <param name=\"fileName\"></param>\n+        public ODataQueryFilter(string fileName)\n+        {\n+            var assembly = Assembly.GetExecutingAssembly();\n+            StreamReader sr = new StreamReader(assembly.GetManifestResourceStream($\"{resourcesNamespace}.{fileName}\"));\n+            string json = sr.ReadToEnd(); \n+            ODataQueryRequest data = JsonConvert.DeserializeObject<ODataQueryRequest>(json);\n+            allowedOperatorPatterns = new HashSet<int>(data.AllowedOperatorPatterns);\n+        }\n+\n+        /// <summary>\n+        /// Returns true if the queryFormat is accepted\n+        /// </summary>\n+        /// <param name=\"queryFormat\">The integer representing the odata operators in the request representing the query to be validated.</param>","path":"src/NuGetGallery/OData/QueryAllowed/ODataQueryFilter.cs","position":47,"original_position":47,"commit_id":"41b9165b07827eb24ea805dc21960112aed8f47d","original_commit_id":"41b9165b07827eb24ea805dc21960112aed8f47d","user":{"login":"shishirx34","id":1646506,"avatar_url":"https://avatars.githubusercontent.com/u/1646506?v=3","gravatar_id":"","url":"https://api.github.com/users/shishirx34","html_url":"https://github.com/shishirx34","followers_url":"https://api.github.com/users/shishirx34/followers","following_url":"https://api.github.com/users/shishirx34/following{/other_user}","gists_url":"https://api.github.com/users/shishirx34/gists{/gist_id}","starred_url":"https://api.github.com/users/shishirx34/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shishirx34/subscriptions","organizations_url":"https://api.github.com/users/shishirx34/orgs","repos_url":"https://api.github.com/users/shishirx34/repos","events_url":"https://api.github.com/users/shishirx34/events{/privacy}","received_events_url":"https://api.github.com/users/shishirx34/received_events","type":"User","site_admin":false},"body":"Comment does not correlate to the method below.","created_at":"2016-11-30T18:35:09Z","updated_at":"2016-11-30T18:56:45Z","html_url":"https://github.com/NuGet/NuGetGallery/pull/3373#discussion_r90297121","pull_request_url":"https://api.github.com/repos/NuGet/NuGetGallery/pulls/3373","_links":{"self":{"href":"https://api.github.com/repos/NuGet/NuGetGallery/pulls/comments/90297121"},"html":{"href":"https://github.com/NuGet/NuGetGallery/pull/3373#discussion_r90297121"},"pull_request":{"href":"https://api.github.com/repos/NuGet/NuGetGallery/pulls/3373"}}},"pull_request":{"url":"https://api.github.com/repos/NuGet/NuGetGallery/pulls/3373","id":94925053,"html_url":"https://github.com/NuGet/NuGetGallery/pull/3373","diff_url":"https://github.com/NuGet/NuGetGallery/pull/3373.diff","patch_url":"https://github.com/NuGet/NuGetGallery/pull/3373.patch","issue_url":"https://api.github.com/repos/NuGet/NuGetGallery/issues/3373","number":3373,"state":"open","locked":false,"title":"Task86:Whitelist the odata queries for the /api/v2/FindPackagesById b…","user":{"login":"cristinamanum","id":16580006,"avatar_url":"https://avatars.githubusercontent.com/u/16580006?v=3","gravatar_id":"","url":"https://api.github.com/users/cristinamanum","html_url":"https://github.com/cristinamanum","followers_url":"https://api.github.com/users/cristinamanum/followers","following_url":"https://api.github.com/users/cristinamanum/following{/other_user}","gists_url":"https://api.github.com/users/cristinamanum/gists{/gist_id}","starred_url":"https://api.github.com/users/cristinamanum/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cristinamanum/subscriptions","organizations_url":"https://api.github.com/users/cristinamanum/orgs","repos_url":"https://api.github.com/users/cristinamanum/repos","events_url":"https://api.github.com/users/cristinamanum/events{/privacy}","received_events_url":"https://api.github.com/users/cristinamanum/received_events","type":"User","site_admin":false},"body":"…ased on the AppInsights data.","created_at":"2016-11-23T00:20:34Z","updated_at":"2016-11-30T18:56:45Z","closed_at":null,"merged_at":null,"merge_commit_sha":"340cb60985ff54114809e744f27874b38fddb3a1","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/NuGet/NuGetGallery/pulls/3373/commits","review_comments_url":"https://api.github.com/repos/NuGet/NuGetGallery/pulls/3373/comments","review_comment_url":"https://api.github.com/repos/NuGet/NuGetGallery/pulls/comments{/number}","comments_url":"https://api.github.com/repos/NuGet/NuGetGallery/issues/3373/comments","statuses_url":"https://api.github.com/repos/NuGet/NuGetGallery/statuses/41b9165b07827eb24ea805dc21960112aed8f47d","head":{"label":"NuGet:users/cmanu/task86","ref":"users/cmanu/task86","sha":"41b9165b07827eb24ea805dc21960112aed8f47d","user":{"login":"NuGet","id":968310,"avatar_url":"https://avatars.githubusercontent.com/u/968310?v=3","gravatar_id":"","url":"https://api.github.com/users/NuGet","html_url":"https://github.com/NuGet","followers_url":"https://api.github.com/users/NuGet/followers","following_url":"https://api.github.com/users/NuGet/following{/other_user}","gists_url":"https://api.github.com/users/NuGet/gists{/gist_id}","starred_url":"https://api.github.com/users/NuGet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NuGet/subscriptions","organizations_url":"https://api.github.com/users/NuGet/orgs","repos_url":"https://api.github.com/users/NuGet/repos","events_url":"https://api.github.com/users/NuGet/events{/privacy}","received_events_url":"https://api.github.com/users/NuGet/received_events","type":"Organization","site_admin":false},"repo":{"id":2180736,"name":"NuGetGallery","full_name":"NuGet/NuGetGallery","owner":{"login":"NuGet","id":968310,"avatar_url":"https://avatars.githubusercontent.com/u/968310?v=3","gravatar_id":"","url":"https://api.github.com/users/NuGet","html_url":"https://github.com/NuGet","followers_url":"https://api.github.com/users/NuGet/followers","following_url":"https://api.github.com/users/NuGet/following{/other_user}","gists_url":"https://api.github.com/users/NuGet/gists{/gist_id}","starred_url":"https://api.github.com/users/NuGet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NuGet/subscriptions","organizations_url":"https://api.github.com/users/NuGet/orgs","repos_url":"https://api.github.com/users/NuGet/repos","events_url":"https://api.github.com/users/NuGet/events{/privacy}","received_events_url":"https://api.github.com/users/NuGet/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/NuGet/NuGetGallery","description":"The NuGet Gallery","fork":false,"url":"https://api.github.com/repos/NuGet/NuGetGallery","forks_url":"https://api.github.com/repos/NuGet/NuGetGallery/forks","keys_url":"https://api.github.com/repos/NuGet/NuGetGallery/keys{/key_id}","collaborators_url":"https://api.github.com/repos/NuGet/NuGetGallery/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/NuGet/NuGetGallery/teams","hooks_url":"https://api.github.com/repos/NuGet/NuGetGallery/hooks","issue_events_url":"https://api.github.com/repos/NuGet/NuGetGallery/issues/events{/number}","events_url":"https://api.github.com/repos/NuGet/NuGetGallery/events","assignees_url":"https://api.github.com/repos/NuGet/NuGetGallery/assignees{/user}","branches_url":"https://api.github.com/repos/NuGet/NuGetGallery/branches{/branch}","tags_url":"https://api.github.com/repos/NuGet/NuGetGallery/tags","blobs_url":"https://api.github.com/repos/NuGet/NuGetGallery/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/NuGet/NuGetGallery/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/NuGet/NuGetGallery/git/refs{/sha}","trees_url":"https://api.github.com/repos/NuGet/NuGetGallery/git/trees{/sha}","statuses_url":"https://api.github.com/repos/NuGet/NuGetGallery/statuses/{sha}","languages_url":"https://api.github.com/repos/NuGet/NuGetGallery/languages","stargazers_url":"https://api.github.com/repos/NuGet/NuGetGallery/stargazers","contributors_url":"https://api.github.com/repos/NuGet/NuGetGallery/contributors","subscribers_url":"https://api.github.com/repos/NuGet/NuGetGallery/subscribers","subscription_url":"https://api.github.com/repos/NuGet/NuGetGallery/subscription","commits_url":"https://api.github.com/repos/NuGet/NuGetGallery/commits{/sha}","git_commits_url":"https://api.github.com/repos/NuGet/NuGetGallery/git/commits{/sha}","comments_url":"https://api.github.com/repos/NuGet/NuGetGallery/comments{/number}","issue_comment_url":"https://api.github.com/repos/NuGet/NuGetGallery/issues/comments{/number}","contents_url":"https://api.github.com/repos/NuGet/NuGetGallery/contents/{+path}","compare_url":"https://api.github.com/repos/NuGet/NuGetGallery/compare/{base}...{head}","merges_url":"https://api.github.com/repos/NuGet/NuGetGallery/merges","archive_url":"https://api.github.com/repos/NuGet/NuGetGallery/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/NuGet/NuGetGallery/downloads","issues_url":"https://api.github.com/repos/NuGet/NuGetGallery/issues{/number}","pulls_url":"https://api.github.com/repos/NuGet/NuGetGallery/pulls{/number}","milestones_url":"https://api.github.com/repos/NuGet/NuGetGallery/milestones{/number}","notifications_url":"https://api.github.com/repos/NuGet/NuGetGallery/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/NuGet/NuGetGallery/labels{/name}","releases_url":"https://api.github.com/repos/NuGet/NuGetGallery/releases{/id}","deployments_url":"https://api.github.com/repos/NuGet/NuGetGallery/deployments","created_at":"2011-08-09T17:57:32Z","updated_at":"2016-11-30T14:55:19Z","pushed_at":"2016-11-30T17:56:01Z","git_url":"git://github.com/NuGet/NuGetGallery.git","ssh_url":"git@github.com:NuGet/NuGetGallery.git","clone_url":"https://github.com/NuGet/NuGetGallery.git","svn_url":"https://github.com/NuGet/NuGetGallery","homepage":"http://www.nuget.org","size":65114,"stargazers_count":801,"watchers_count":801,"language":"C#","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":456,"mirror_url":null,"open_issues_count":254,"forks":456,"open_issues":254,"watchers":801,"default_branch":"master"}},"base":{"label":"NuGet:dev","ref":"dev","sha":"1f87aece06f71bb61c678f1682143e26e76d59bf","user":{"login":"NuGet","id":968310,"avatar_url":"https://avatars.githubusercontent.com/u/968310?v=3","gravatar_id":"","url":"https://api.github.com/users/NuGet","html_url":"https://github.com/NuGet","followers_url":"https://api.github.com/users/NuGet/followers","following_url":"https://api.github.com/users/NuGet/following{/other_user}","gists_url":"https://api.github.com/users/NuGet/gists{/gist_id}","starred_url":"https://api.github.com/users/NuGet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NuGet/subscriptions","organizations_url":"https://api.github.com/users/NuGet/orgs","repos_url":"https://api.github.com/users/NuGet/repos","events_url":"https://api.github.com/users/NuGet/events{/privacy}","received_events_url":"https://api.github.com/users/NuGet/received_events","type":"Organization","site_admin":false},"repo":{"id":2180736,"name":"NuGetGallery","full_name":"NuGet/NuGetGallery","owner":{"login":"NuGet","id":968310,"avatar_url":"https://avatars.githubusercontent.com/u/968310?v=3","gravatar_id":"","url":"https://api.github.com/users/NuGet","html_url":"https://github.com/NuGet","followers_url":"https://api.github.com/users/NuGet/followers","following_url":"https://api.github.com/users/NuGet/following{/other_user}","gists_url":"https://api.github.com/users/NuGet/gists{/gist_id}","starred_url":"https://api.github.com/users/NuGet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NuGet/subscriptions","organizations_url":"https://api.github.com/users/NuGet/orgs","repos_url":"https://api.github.com/users/NuGet/repos","events_url":"https://api.github.com/users/NuGet/events{/privacy}","received_events_url":"https://api.github.com/users/NuGet/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/NuGet/NuGetGallery","description":"The NuGet Gallery","fork":false,"url":"https://api.github.com/repos/NuGet/NuGetGallery","forks_url":"https://api.github.com/repos/NuGet/NuGetGallery/forks","keys_url":"https://api.github.com/repos/NuGet/NuGetGallery/keys{/key_id}","collaborators_url":"https://api.github.com/repos/NuGet/NuGetGallery/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/NuGet/NuGetGallery/teams","hooks_url":"https://api.github.com/repos/NuGet/NuGetGallery/hooks","issue_events_url":"https://api.github.com/repos/NuGet/NuGetGallery/issues/events{/number}","events_url":"https://api.github.com/repos/NuGet/NuGetGallery/events","assignees_url":"https://api.github.com/repos/NuGet/NuGetGallery/assignees{/user}","branches_url":"https://api.github.com/repos/NuGet/NuGetGallery/branches{/branch}","tags_url":"https://api.github.com/repos/NuGet/NuGetGallery/tags","blobs_url":"https://api.github.com/repos/NuGet/NuGetGallery/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/NuGet/NuGetGallery/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/NuGet/NuGetGallery/git/refs{/sha}","trees_url":"https://api.github.com/repos/NuGet/NuGetGallery/git/trees{/sha}","statuses_url":"https://api.github.com/repos/NuGet/NuGetGallery/statuses/{sha}","languages_url":"https://api.github.com/repos/NuGet/NuGetGallery/languages","stargazers_url":"https://api.github.com/repos/NuGet/NuGetGallery/stargazers","contributors_url":"https://api.github.com/repos/NuGet/NuGetGallery/contributors","subscribers_url":"https://api.github.com/repos/NuGet/NuGetGallery/subscribers","subscription_url":"https://api.github.com/repos/NuGet/NuGetGallery/subscription","commits_url":"https://api.github.com/repos/NuGet/NuGetGallery/commits{/sha}","git_commits_url":"https://api.github.com/repos/NuGet/NuGetGallery/git/commits{/sha}","comments_url":"https://api.github.com/repos/NuGet/NuGetGallery/comments{/number}","issue_comment_url":"https://api.github.com/repos/NuGet/NuGetGallery/issues/comments{/number}","contents_url":"https://api.github.com/repos/NuGet/NuGetGallery/contents/{+path}","compare_url":"https://api.github.com/repos/NuGet/NuGetGallery/compare/{base}...{head}","merges_url":"https://api.github.com/repos/NuGet/NuGetGallery/merges","archive_url":"https://api.github.com/repos/NuGet/NuGetGallery/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/NuGet/NuGetGallery/downloads","issues_url":"https://api.github.com/repos/NuGet/NuGetGallery/issues{/number}","pulls_url":"https://api.github.com/repos/NuGet/NuGetGallery/pulls{/number}","milestones_url":"https://api.github.com/repos/NuGet/NuGetGallery/milestones{/number}","notifications_url":"https://api.github.com/repos/NuGet/NuGetGallery/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/NuGet/NuGetGallery/labels{/name}","releases_url":"https://api.github.com/repos/NuGet/NuGetGallery/releases{/id}","deployments_url":"https://api.github.com/repos/NuGet/NuGetGallery/deployments","created_at":"2011-08-09T17:57:32Z","updated_at":"2016-11-30T14:55:19Z","pushed_at":"2016-11-30T17:56:01Z","git_url":"git://github.com/NuGet/NuGetGallery.git","ssh_url":"git@github.com:NuGet/NuGetGallery.git","clone_url":"https://github.com/NuGet/NuGetGallery.git","svn_url":"https://github.com/NuGet/NuGetGallery","homepage":"http://www.nuget.org","size":65114,"stargazers_count":801,"watchers_count":801,"language":"C#","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":456,"mirror_url":null,"open_issues_count":254,"forks":456,"open_issues":254,"watchers":801,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/NuGet/NuGetGallery/pulls/3373"},"html":{"href":"https://github.com/NuGet/NuGetGallery/pull/3373"},"issue":{"href":"https://api.github.com/repos/NuGet/NuGetGallery/issues/3373"},"comments":{"href":"https://api.github.com/repos/NuGet/NuGetGallery/issues/3373/comments"},"review_comments":{"href":"https://api.github.com/repos/NuGet/NuGetGallery/pulls/3373/comments"},"review_comment":{"href":"https://api.github.com/repos/NuGet/NuGetGallery/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/NuGet/NuGetGallery/pulls/3373/commits"},"statuses":{"href":"https://api.github.com/repos/NuGet/NuGetGallery/statuses/41b9165b07827eb24ea805dc21960112aed8f47d"}}}}
{"actor":{"display_login":"shishirx34"}}