{"action":"created","comment":{"url":"https://api.github.com/repos/cilium/cilium/pulls/comments/239712806","pull_request_review_id":182572519,"id":239712806,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIzOTcxMjgwNg==","diff_hunk":"@@ -0,0 +1,279 @@\n+// Copyright 2018 Authors of Cilium\n+//\n+// Licensed under the Apache License, Version 2.0 (the \"License\");\n+// you may not use this file except in compliance with the License.\n+// You may obtain a copy of the License at\n+//\n+//     http://www.apache.org/licenses/LICENSE-2.0\n+//\n+// Unless required by applicable law or agreed to in writing, software\n+// distributed under the License is distributed on an \"AS IS\" BASIS,\n+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+// See the License for the specific language governing permissions and\n+// limitations under the License.\n+\n+package awsparsers\n+\n+import (\n+\t\"bytes\"\n+\t\"encoding/json\"\n+\t\"fmt\"\n+\t. \"github.com/cilium/cilium/proxylib/proxylib\"\n+\t\"github.com/cilium/proxy/go/cilium/api\"\n+\tlog \"github.com/sirupsen/logrus\"\n+\t\"io/ioutil\"\n+\t\"regexp\"\n+\t\"strings\"\n+)\n+\n+//\n+// AWS Dynamo DB Parser\n+//\n+// Spec:  https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_Operations_Amazon_DynamoDB.html\n+//\n+\n+// Current AWS DynamoDB parser supports matching on 'Action' and 'Table', both of which can be wildcarded.\n+// Table can be a regular expression.\n+// Examples:\n+// action = 'GetItem', table = 'table1'\n+\n+type AWSDynamoDBRule struct {\n+\tactionExact        string\n+\ttableRegexCompiled *regexp.Regexp\n+}\n+\n+type AWSDynamoDBRequestData struct {\n+\taction string\n+\ttable  string\n+}\n+\n+type AWSDynamoDBRequestJSON struct {\n+\tTableName string\n+}\n+\n+func (rule *AWSDynamoDBRule) Matches(data interface{}) bool {\n+\t// Cast 'data' to the type we give to 'Matches()'\n+\n+\treqData, ok := data.(AWSDynamoDBRequestData)\n+\tif !ok {\n+\t\tlog.Warning(\"Matches() called with type other than string\")\n+\t\treturn false\n+\t}\n+\tlog.Infof(\"Match Request: action '%s' table '%s'\", reqData.action, reqData.table)\n+\tregexStr := \"\"\n+\tif rule.tableRegexCompiled != nil {\n+\t\tregexStr = rule.tableRegexCompiled.String()\n+\t}\n+\tlog.Infof(\"Match Rule: action '%s', table '%s'\", rule.actionExact, regexStr)\n+\n+\tif rule.actionExact != \"\" && rule.actionExact != reqData.action {\n+\t\tlog.Debugf(\"AWSDynamoDBRule: action mismatch %v, %s\", rule.actionExact, reqData.action)\n+\t\treturn false\n+\t}\n+\tif len(reqData.table) > 0 &&\n+\t\trule.tableRegexCompiled != nil &&\n+\t\t!rule.tableRegexCompiled.MatchString(reqData.table) {\n+\t\tlog.Debugf(\"AWSDynamoDBRule: table_regex mismatch '%s', '%s'\", regexStr, reqData.table)\n+\t\treturn false\n+\t}\n+\n+\treturn true\n+}\n+\n+// AWSDyanmoDBRuleParser parses protobuf L7 rules to enforcement objects\n+// May panic\n+func AWSDynamoDBRuleParser(rule *cilium.PortNetworkPolicyRule) []L7NetworkPolicyRule {\n+\tvar rules []L7NetworkPolicyRule\n+\tl7Rules := rule.GetL7Rules()\n+\tif l7Rules == nil {\n+\t\treturn rules\n+\t}\n+\tfor _, l7Rule := range l7Rules.GetL7Rules() {\n+\t\tvar r AWSDynamoDBRule\n+\t\tfor k, v := range l7Rule.Rule {\n+\t\t\tswitch k {\n+\t\t\tcase \"action\":\n+\t\t\t\tr.actionExact = v\n+\t\t\tcase \"table\":\n+\t\t\t\tif v != \"\" {\n+\t\t\t\t\tr.tableRegexCompiled = regexp.MustCompile(v)\n+\t\t\t\t}\n+\t\t\tdefault:\n+\t\t\t\tParseError(fmt.Sprintf(\"Unsupported key: %s\", k), rule)\n+\t\t\t}\n+\t\t}\n+\t\tif len(r.actionExact) > 0 {\n+\t\t\t// ensure this is a valid query action\n+\t\t\tres := DynamoDBActionMap[r.actionExact]\n+\t\t\tif res == invalidAction {\n+\t\t\t\tParseError(fmt.Sprintf(\"Unable to parse L7 AWS-DynamoDB rule with invalid action: '%s'\", r.actionExact), rule)\n+\t\t\t} else if res == actionNoTable && r.tableRegexCompiled != nil {\n+\t\t\t\tParseError(fmt.Sprintf(\"action '%s' is not compatible with a table match\", r.actionExact), rule)\n+\t\t\t}\n+\n+\t\t}\n+\n+\t\tlog.Debugf(\"Parsed AWSDynamoDBRule pair: %v\", r)\n+\t\trules = append(rules, &r)\n+\t}\n+\treturn rules\n+}\n+\n+type AWSDynamoDBParserFactory struct{}\n+\n+var awsDynamoDBParserFactory *AWSDynamoDBParserFactory\n+\n+func init() {\n+\tlog.Info(\"init(): Registering AWSDynamoDBParserFactory\")\n+\tRegisterParserFactory(\"aws-dynamodb\", awsDynamoDBParserFactory)\n+\tRegisterL7RuleParser(\"aws-dynamodb\", AWSDynamoDBRuleParser)\n+}\n+\n+type AWSDynamoDBParser struct {","path":"proxylib/aws/aws-dynamodb.go","position":132,"original_position":132,"commit_id":"04db1824567f37d121ed5b6f48195dc15ebb8049","original_commit_id":"04db1824567f37d121ed5b6f48195dc15ebb8049","user":{"login":"houndci-bot","id":6697940,"node_id":"MDQ6VXNlcjY2OTc5NDA=","avatar_url":"https://avatars0.githubusercontent.com/u/6697940?v=4","gravatar_id":"","url":"https://api.github.com/users/houndci-bot","html_url":"https://github.com/houndci-bot","followers_url":"https://api.github.com/users/houndci-bot/followers","following_url":"https://api.github.com/users/houndci-bot/following{/other_user}","gists_url":"https://api.github.com/users/houndci-bot/gists{/gist_id}","starred_url":"https://api.github.com/users/houndci-bot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/houndci-bot/subscriptions","organizations_url":"https://api.github.com/users/houndci-bot/orgs","repos_url":"https://api.github.com/users/houndci-bot/repos","events_url":"https://api.github.com/users/houndci-bot/events{/privacy}","received_events_url":"https://api.github.com/users/houndci-bot/received_events","type":"User","site_admin":false},"body":"exported type AWSDynamoDBParser should have comment or be unexported","created_at":"2018-12-07T07:19:05Z","updated_at":"2018-12-07T07:19:06Z","html_url":"https://github.com/cilium/cilium/pull/6240#discussion_r239712806","pull_request_url":"https://api.github.com/repos/cilium/cilium/pulls/6240","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/cilium/cilium/pulls/comments/239712806"},"html":{"href":"https://github.com/cilium/cilium/pull/6240#discussion_r239712806"},"pull_request":{"href":"https://api.github.com/repos/cilium/cilium/pulls/6240"}}},"pull_request":{"url":"https://api.github.com/repos/cilium/cilium/pulls/6240","id":230790874,"node_id":"MDExOlB1bGxSZXF1ZXN0MjMwNzkwODc0","html_url":"https://github.com/cilium/cilium/pull/6240","diff_url":"https://github.com/cilium/cilium/pull/6240.diff","patch_url":"https://github.com/cilium/cilium/pull/6240.patch","issue_url":"https://api.github.com/repos/cilium/cilium/issues/6240","number":6240,"state":"open","locked":false,"title":"(WIP) AWS sqs + dynamodb parser","user":{"login":"danwent","id":413995,"node_id":"MDQ6VXNlcjQxMzk5NQ==","avatar_url":"https://avatars2.githubusercontent.com/u/413995?v=4","gravatar_id":"","url":"https://api.github.com/users/danwent","html_url":"https://github.com/danwent","followers_url":"https://api.github.com/users/danwent/followers","following_url":"https://api.github.com/users/danwent/following{/other_user}","gists_url":"https://api.github.com/users/danwent/gists{/gist_id}","starred_url":"https://api.github.com/users/danwent/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danwent/subscriptions","organizations_url":"https://api.github.com/users/danwent/orgs","repos_url":"https://api.github.com/users/danwent/repos","events_url":"https://api.github.com/users/danwent/events{/privacy}","received_events_url":"https://api.github.com/users/danwent/received_events","type":"User","site_admin":false},"body":"Initial version of Amazon Simple Queuing Service proxy in golang framework\r\n\r\nUnit tests, no end-to-end tests.  Needs more testing and refactoring, but interested in feedback.\n\n<!-- Reviewable:start -->\n---\nThis change is [<img src=\"https://reviewable.io/review_button.svg\" height=\"34\" align=\"absmiddle\" alt=\"Reviewable\"/>](https://reviewable.io/reviews/cilium/cilium/6240)\n<!-- Reviewable:end -->\n","created_at":"2018-11-14T10:53:18Z","updated_at":"2018-12-07T07:19:06Z","closed_at":null,"merged_at":null,"merge_commit_sha":"82425a9e6d8dc000a83c9791184f9d2ff48fa385","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[{"name":"proxy","id":2519788,"node_id":"MDQ6VGVhbTI1MTk3ODg=","slug":"proxy","description":"Proxy layer","privacy":"closed","url":"https://api.github.com/teams/2519788","members_url":"https://api.github.com/teams/2519788/members{/member}","repositories_url":"https://api.github.com/teams/2519788/repos","permission":"pull"}],"labels":[{"id":403244562,"node_id":"MDU6TGFiZWw0MDMyNDQ1NjI=","url":"https://api.github.com/repos/cilium/cilium/labels/wip","name":"wip","color":"fef2c0","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/cilium/cilium/pulls/6240/commits","review_comments_url":"https://api.github.com/repos/cilium/cilium/pulls/6240/comments","review_comment_url":"https://api.github.com/repos/cilium/cilium/pulls/comments{/number}","comments_url":"https://api.github.com/repos/cilium/cilium/issues/6240/comments","statuses_url":"https://api.github.com/repos/cilium/cilium/statuses/04db1824567f37d121ed5b6f48195dc15ebb8049","head":{"label":"danwent:aws-sqs-parser","ref":"aws-sqs-parser","sha":"04db1824567f37d121ed5b6f48195dc15ebb8049","user":{"login":"danwent","id":413995,"node_id":"MDQ6VXNlcjQxMzk5NQ==","avatar_url":"https://avatars2.githubusercontent.com/u/413995?v=4","gravatar_id":"","url":"https://api.github.com/users/danwent","html_url":"https://github.com/danwent","followers_url":"https://api.github.com/users/danwent/followers","following_url":"https://api.github.com/users/danwent/following{/other_user}","gists_url":"https://api.github.com/users/danwent/gists{/gist_id}","starred_url":"https://api.github.com/users/danwent/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danwent/subscriptions","organizations_url":"https://api.github.com/users/danwent/orgs","repos_url":"https://api.github.com/users/danwent/repos","events_url":"https://api.github.com/users/danwent/events{/privacy}","received_events_url":"https://api.github.com/users/danwent/received_events","type":"User","site_admin":false},"repo":{"id":85126548,"node_id":"MDEwOlJlcG9zaXRvcnk4NTEyNjU0OA==","name":"cilium","full_name":"danwent/cilium","private":false,"owner":{"login":"danwent","id":413995,"node_id":"MDQ6VXNlcjQxMzk5NQ==","avatar_url":"https://avatars2.githubusercontent.com/u/413995?v=4","gravatar_id":"","url":"https://api.github.com/users/danwent","html_url":"https://github.com/danwent","followers_url":"https://api.github.com/users/danwent/followers","following_url":"https://api.github.com/users/danwent/following{/other_user}","gists_url":"https://api.github.com/users/danwent/gists{/gist_id}","starred_url":"https://api.github.com/users/danwent/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danwent/subscriptions","organizations_url":"https://api.github.com/users/danwent/orgs","repos_url":"https://api.github.com/users/danwent/repos","events_url":"https://api.github.com/users/danwent/events{/privacy}","received_events_url":"https://api.github.com/users/danwent/received_events","type":"User","site_admin":false},"html_url":"https://github.com/danwent/cilium","description":"BPF & XDP for containers","fork":true,"url":"https://api.github.com/repos/danwent/cilium","forks_url":"https://api.github.com/repos/danwent/cilium/forks","keys_url":"https://api.github.com/repos/danwent/cilium/keys{/key_id}","collaborators_url":"https://api.github.com/repos/danwent/cilium/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/danwent/cilium/teams","hooks_url":"https://api.github.com/repos/danwent/cilium/hooks","issue_events_url":"https://api.github.com/repos/danwent/cilium/issues/events{/number}","events_url":"https://api.github.com/repos/danwent/cilium/events","assignees_url":"https://api.github.com/repos/danwent/cilium/assignees{/user}","branches_url":"https://api.github.com/repos/danwent/cilium/branches{/branch}","tags_url":"https://api.github.com/repos/danwent/cilium/tags","blobs_url":"https://api.github.com/repos/danwent/cilium/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/danwent/cilium/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/danwent/cilium/git/refs{/sha}","trees_url":"https://api.github.com/repos/danwent/cilium/git/trees{/sha}","statuses_url":"https://api.github.com/repos/danwent/cilium/statuses/{sha}","languages_url":"https://api.github.com/repos/danwent/cilium/languages","stargazers_url":"https://api.github.com/repos/danwent/cilium/stargazers","contributors_url":"https://api.github.com/repos/danwent/cilium/contributors","subscribers_url":"https://api.github.com/repos/danwent/cilium/subscribers","subscription_url":"https://api.github.com/repos/danwent/cilium/subscription","commits_url":"https://api.github.com/repos/danwent/cilium/commits{/sha}","git_commits_url":"https://api.github.com/repos/danwent/cilium/git/commits{/sha}","comments_url":"https://api.github.com/repos/danwent/cilium/comments{/number}","issue_comment_url":"https://api.github.com/repos/danwent/cilium/issues/comments{/number}","contents_url":"https://api.github.com/repos/danwent/cilium/contents/{+path}","compare_url":"https://api.github.com/repos/danwent/cilium/compare/{base}...{head}","merges_url":"https://api.github.com/repos/danwent/cilium/merges","archive_url":"https://api.github.com/repos/danwent/cilium/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/danwent/cilium/downloads","issues_url":"https://api.github.com/repos/danwent/cilium/issues{/number}","pulls_url":"https://api.github.com/repos/danwent/cilium/pulls{/number}","milestones_url":"https://api.github.com/repos/danwent/cilium/milestones{/number}","notifications_url":"https://api.github.com/repos/danwent/cilium/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/danwent/cilium/labels{/name}","releases_url":"https://api.github.com/repos/danwent/cilium/releases{/id}","deployments_url":"https://api.github.com/repos/danwent/cilium/deployments","created_at":"2017-03-15T22:20:39Z","updated_at":"2017-03-15T22:20:41Z","pushed_at":"2018-12-07T07:18:33Z","git_url":"git://github.com/danwent/cilium.git","ssh_url":"git@github.com:danwent/cilium.git","clone_url":"https://github.com/danwent/cilium.git","svn_url":"https://github.com/danwent/cilium","homepage":"","size":60511,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"cilium:master","ref":"master","sha":"0b78eb1470d10f9fcd59d9570fd105d55263301f","user":{"login":"cilium","id":21054566,"node_id":"MDEyOk9yZ2FuaXphdGlvbjIxMDU0NTY2","avatar_url":"https://avatars0.githubusercontent.com/u/21054566?v=4","gravatar_id":"","url":"https://api.github.com/users/cilium","html_url":"https://github.com/cilium","followers_url":"https://api.github.com/users/cilium/followers","following_url":"https://api.github.com/users/cilium/following{/other_user}","gists_url":"https://api.github.com/users/cilium/gists{/gist_id}","starred_url":"https://api.github.com/users/cilium/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cilium/subscriptions","organizations_url":"https://api.github.com/users/cilium/orgs","repos_url":"https://api.github.com/users/cilium/repos","events_url":"https://api.github.com/users/cilium/events{/privacy}","received_events_url":"https://api.github.com/users/cilium/received_events","type":"Organization","site_admin":false},"repo":{"id":48109239,"node_id":"MDEwOlJlcG9zaXRvcnk0ODEwOTIzOQ==","name":"cilium","full_name":"cilium/cilium","private":false,"owner":{"login":"cilium","id":21054566,"node_id":"MDEyOk9yZ2FuaXphdGlvbjIxMDU0NTY2","avatar_url":"https://avatars0.githubusercontent.com/u/21054566?v=4","gravatar_id":"","url":"https://api.github.com/users/cilium","html_url":"https://github.com/cilium","followers_url":"https://api.github.com/users/cilium/followers","following_url":"https://api.github.com/users/cilium/following{/other_user}","gists_url":"https://api.github.com/users/cilium/gists{/gist_id}","starred_url":"https://api.github.com/users/cilium/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cilium/subscriptions","organizations_url":"https://api.github.com/users/cilium/orgs","repos_url":"https://api.github.com/users/cilium/repos","events_url":"https://api.github.com/users/cilium/events{/privacy}","received_events_url":"https://api.github.com/users/cilium/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/cilium/cilium","description":"HTTP, gRPC, and Kafka Aware Security and Networking for Containers with BPF and XDP","fork":false,"url":"https://api.github.com/repos/cilium/cilium","forks_url":"https://api.github.com/repos/cilium/cilium/forks","keys_url":"https://api.github.com/repos/cilium/cilium/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cilium/cilium/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cilium/cilium/teams","hooks_url":"https://api.github.com/repos/cilium/cilium/hooks","issue_events_url":"https://api.github.com/repos/cilium/cilium/issues/events{/number}","events_url":"https://api.github.com/repos/cilium/cilium/events","assignees_url":"https://api.github.com/repos/cilium/cilium/assignees{/user}","branches_url":"https://api.github.com/repos/cilium/cilium/branches{/branch}","tags_url":"https://api.github.com/repos/cilium/cilium/tags","blobs_url":"https://api.github.com/repos/cilium/cilium/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cilium/cilium/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cilium/cilium/git/refs{/sha}","trees_url":"https://api.github.com/repos/cilium/cilium/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cilium/cilium/statuses/{sha}","languages_url":"https://api.github.com/repos/cilium/cilium/languages","stargazers_url":"https://api.github.com/repos/cilium/cilium/stargazers","contributors_url":"https://api.github.com/repos/cilium/cilium/contributors","subscribers_url":"https://api.github.com/repos/cilium/cilium/subscribers","subscription_url":"https://api.github.com/repos/cilium/cilium/subscription","commits_url":"https://api.github.com/repos/cilium/cilium/commits{/sha}","git_commits_url":"https://api.github.com/repos/cilium/cilium/git/commits{/sha}","comments_url":"https://api.github.com/repos/cilium/cilium/comments{/number}","issue_comment_url":"https://api.github.com/repos/cilium/cilium/issues/comments{/number}","contents_url":"https://api.github.com/repos/cilium/cilium/contents/{+path}","compare_url":"https://api.github.com/repos/cilium/cilium/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cilium/cilium/merges","archive_url":"https://api.github.com/repos/cilium/cilium/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cilium/cilium/downloads","issues_url":"https://api.github.com/repos/cilium/cilium/issues{/number}","pulls_url":"https://api.github.com/repos/cilium/cilium/pulls{/number}","milestones_url":"https://api.github.com/repos/cilium/cilium/milestones{/number}","notifications_url":"https://api.github.com/repos/cilium/cilium/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cilium/cilium/labels{/name}","releases_url":"https://api.github.com/repos/cilium/cilium/releases{/id}","deployments_url":"https://api.github.com/repos/cilium/cilium/deployments","created_at":"2015-12-16T12:33:31Z","updated_at":"2018-12-07T04:42:02Z","pushed_at":"2018-12-07T07:18:43Z","git_url":"git://github.com/cilium/cilium.git","ssh_url":"git@github.com:cilium/cilium.git","clone_url":"https://github.com/cilium/cilium.git","svn_url":"https://github.com/cilium/cilium","homepage":"","size":77360,"stargazers_count":3156,"watchers_count":3156,"language":"Go","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":278,"mirror_url":null,"archived":false,"open_issues_count":561,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":278,"open_issues":561,"watchers":3156,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/cilium/cilium/pulls/6240"},"html":{"href":"https://github.com/cilium/cilium/pull/6240"},"issue":{"href":"https://api.github.com/repos/cilium/cilium/issues/6240"},"comments":{"href":"https://api.github.com/repos/cilium/cilium/issues/6240/comments"},"review_comments":{"href":"https://api.github.com/repos/cilium/cilium/pulls/6240/comments"},"review_comment":{"href":"https://api.github.com/repos/cilium/cilium/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/cilium/cilium/pulls/6240/commits"},"statuses":{"href":"https://api.github.com/repos/cilium/cilium/statuses/04db1824567f37d121ed5b6f48195dc15ebb8049"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"houndci-bot"}}