{"action":"created","comment":{"url":"https://api.github.com/repos/coreos/clair/pulls/comments/77884407","id":77884407,"diff_hunk":"@@ -0,0 +1,426 @@\n+// Copyright 2015 clair authors\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+// This package contains the OvalFetcher definition which is being used\n+// for fetching update information on OVAL format\n+// see: https://oval.mitre.org/about/faqs.html#a1\n+//\n+// Example of an oval definition\n+// <oval_definitions xmlns=.....>\n+//  <definitions>\n+//    <definition>\n+//      <metadata>\n+//        <title>CVE-1111-11</title>\n+//        <description>blablabla</description>\n+//        <reference source=\"CVE\" ref_id=\"CVE-1111-11\" ref_url=\"http....\"/>\n+//        <reference source=\"RHSA\" ref_id=\"RHSA-111:11\" ref_url=\"http....\"/>\n+//      </metadata>\n+//      <criteria operator=\"AND\">\n+//        <criterion test_ref=\"123\" comment=\"glibc is ....\">\n+//        </criterion>\n+//        <criterion test_ref=\"456\" comment=\".... is signed with Red Hat....\">\n+//        </criterion>\n+//      </criteria>\n+//    </definition>\n+//  </definitions>\n+//  <tests>\n+//  ...\n+//  </tests>\n+//  <objects>\n+//  ...\n+//  </objects>\n+//  <states>\n+//  ...\n+//  </states>\n+// </oval_definitions>\n+// see more complete examples here\n+// https://oval.mitre.org/language/about/definition.html\n+// The methods here use an interface (see below) that must be implemented for\n+// each Distribution in updated/fetchers/\n+package oval\n+\n+import (\n+\t\"bufio\"\n+\t\"encoding/xml\"\n+\t\"fmt\"\n+\t\"io\"\n+\t\"net/http\"\n+\t\"strings\"\n+\n+\t\"github.com/coreos/clair/database\"\n+\t\"github.com/coreos/clair/updater\"\n+\tcerrors \"github.com/coreos/clair/utils/errors\"\n+\t\"github.com/coreos/clair/utils/types\"\n+\t\"github.com/coreos/pkg/capnslog\"\n+)\n+\n+type oval struct {\n+\tDefinitions []definition `xml:\"definitions>definition\"`\n+}\n+\n+type definition struct {\n+\tTitle       string      `xml:\"metadata>title\"`\n+\tDescription string      `xml:\"metadata>description\"`\n+\tReferences  []reference `xml:\"metadata>reference\"`\n+\tCriteria    criteria    `xml:\"criteria\"`\n+}\n+\n+type reference struct {\n+\tSource string `xml:\"source,attr\"`\n+\tURI    string `xml:\"ref_url,attr\"`\n+}\n+\n+type criteria struct {\n+\tOperator   string      `xml:\"operator,attr\"`\n+\tCriterias  []*criteria `xml:\"criteria\"`\n+\tCriterions []criterion `xml:\"criterion\"`\n+}\n+\n+type criterion struct {\n+\tComment string `xml:\"comment,attr\"`\n+}\n+\n+// OvalFetcher implements updater.Fetcher.\n+type OvalFetcher struct {\n+\t// OsInfo contains specifics to each Linux Distribution (see below)\n+\tOsInfo OSInfo\n+}\n+\n+// OSInfo interface contains specifics methods for parsing OVAL definitions\n+// that must be implemented by each Linux Distribution that uses OVAL\n+// i.e. Red Hat and SUSE\n+type OSInfo interface {\n+\t// ParsePackageNameVersion should, given a comment in a criterion, return\n+\t// the name and the version of the package.\n+\t// For example, if the comment is\n+\t//   glibc is earlier than 3.2\n+\t// should return glibc and 3.2\n+\t// This is based on the assumption that the distributions generate the comments\n+\t// automatically and they won't change (I know, not very reliable...)\n+\tParsePackageNameVersion(comment string) (string, string)\n+\t// ParseOsVersion should, given a comment in a criterion, return the version\n+\t// of the Operating System.\n+\t// For example, if the comment is\n+\t//   SUSE Linux Enterpise Server 12 is installed\n+\t// should return 12\n+\t// This is based on the assumption that the distributions generate the comments\n+\t// automatically and they won't change it (I know, not very reliable...)\n+\tParseOsVersion(comment string) string\n+\t// Given a line, parse for the xml file that contains the oval definition and\n+\t// returns the filename\n+\t// For example if the line contains\n+\t//\t com.redhat.rhsa-2003.xml, this will be return\n+\t// This is being used in conjunction with OvalUri (see below). Oval Uri contains\n+\t// a list of files, and you need ParseFilenameDist to get the right ones\n+\tParseFilenameDist(line string) string\n+\t// OvalUri returns the url where the oval definitions are stored for a given\n+\t// distributions. See examples:\n+\t//   https://www.redhat.com/security/data/oval/\n+\t//   http://ftp.suse.com/pub/projects/security/oval/\n+\tOvalURI() string\n+\t// DistName returns the distribution name. Mostly used for debugging purposes\n+\tDistName() string\n+\t// IgnoredCriterions returns a list of strings that must be ignored when\n+\t// parsing the criterions.\n+\t// Oval parses parses all criterions by default trying to identify either\n+\t// package name and version or distribution version\n+\tIgnoredCriterions() []string\n+\t// SecToken returns a string that is compared with the value of reference.source\n+\t// in order to know if that is a security reference for, for example, using\n+\t// its url value\n+\t// Example return values: CVE, RHSA\n+\tSecToken() string\n+\t//Namespace stores the namespace that will be used in clair to store the vulnerabilities\n+\tNamespace() string\n+}\n+\n+var (\n+\tlog = capnslog.NewPackageLogger(\"github.com/coreos/clair\", \"utils/oval\")\n+)\n+\n+// FetchUpdate gets vulnerability updates from the OVAL definitions.\n+func (f *OvalFetcher) FetchUpdate(datastore database.Datastore) (resp updater.FetcherResponse, err error) {\n+\tlog.Info(\"fetching %s vulnerabilities\", f.OsInfo.DistName())\n+\n+\tif err != nil {\n+\t\treturn resp, err\n+\t}","path":"utils/oval/oval.go","position":158,"original_position":158,"commit_id":"ddef42218aa249d57f71fca3b853186bb462a4f8","original_commit_id":"ddef42218aa249d57f71fca3b853186bb462a4f8","user":{"login":"jzelinskie","id":343539,"avatar_url":"https://avatars.githubusercontent.com/u/343539?v=3","gravatar_id":"","url":"https://api.github.com/users/jzelinskie","html_url":"https://github.com/jzelinskie","followers_url":"https://api.github.com/users/jzelinskie/followers","following_url":"https://api.github.com/users/jzelinskie/following{/other_user}","gists_url":"https://api.github.com/users/jzelinskie/gists{/gist_id}","starred_url":"https://api.github.com/users/jzelinskie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jzelinskie/subscriptions","organizations_url":"https://api.github.com/users/jzelinskie/orgs","repos_url":"https://api.github.com/users/jzelinskie/repos","events_url":"https://api.github.com/users/jzelinskie/events{/privacy}","received_events_url":"https://api.github.com/users/jzelinskie/received_events","type":"User","site_admin":false},"body":"I don't think this error check is necessary","created_at":"2016-09-07T19:05:50Z","updated_at":"2016-09-07T19:05:50Z","html_url":"https://github.com/coreos/clair/pull/199#discussion_r77884407","pull_request_url":"https://api.github.com/repos/coreos/clair/pulls/199","_links":{"self":{"href":"https://api.github.com/repos/coreos/clair/pulls/comments/77884407"},"html":{"href":"https://github.com/coreos/clair/pull/199#discussion_r77884407"},"pull_request":{"href":"https://api.github.com/repos/coreos/clair/pulls/199"}}},"pull_request":{"url":"https://api.github.com/repos/coreos/clair/pulls/199","id":73220837,"html_url":"https://github.com/coreos/clair/pull/199","diff_url":"https://github.com/coreos/clair/pull/199.diff","patch_url":"https://github.com/coreos/clair/pull/199.patch","issue_url":"https://api.github.com/repos/coreos/clair/issues/199","number":199,"state":"open","locked":false,"title":"Add openSUSE/SLES support","user":{"login":"tboerger","id":156964,"avatar_url":"https://avatars.githubusercontent.com/u/156964?v=3","gravatar_id":"","url":"https://api.github.com/users/tboerger","html_url":"https://github.com/tboerger","followers_url":"https://api.github.com/users/tboerger/followers","following_url":"https://api.github.com/users/tboerger/following{/other_user}","gists_url":"https://api.github.com/users/tboerger/gists{/gist_id}","starred_url":"https://api.github.com/users/tboerger/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tboerger/subscriptions","organizations_url":"https://api.github.com/users/tboerger/orgs","repos_url":"https://api.github.com/users/tboerger/repos","events_url":"https://api.github.com/users/tboerger/events{/privacy}","received_events_url":"https://api.github.com/users/tboerger/received_events","type":"User","site_admin":false},"body":"In order to integrate openSUSE/SLES including the available patches for CVEs I have started to work on this pull request. I already opened this pull   request to get feedback early as possible. Below you can see a checklist for the remaining items.\r\n\r\n* [x] Fetcher for openSUSE\r\n* [x] Write tests for openSUSE fetcher\r\n* [x] Fetcher for SLES\r\n* [x] Write tests for SLES fetcher\r\n\r\nDo I miss something? Should we abstract the shared functionality from RedHat and openSUSE/SLES?\r\n","created_at":"2016-06-09T14:11:25Z","updated_at":"2016-09-07T19:05:50Z","closed_at":null,"merged_at":null,"merge_commit_sha":"9867c5ae3c11985da513f5a1c01e438d0b6f1cf4","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/coreos/clair/pulls/199/commits","review_comments_url":"https://api.github.com/repos/coreos/clair/pulls/199/comments","review_comment_url":"https://api.github.com/repos/coreos/clair/pulls/comments{/number}","comments_url":"https://api.github.com/repos/coreos/clair/issues/199/comments","statuses_url":"https://api.github.com/repos/coreos/clair/statuses/ddef42218aa249d57f71fca3b853186bb462a4f8","head":{"label":"openSUSE:feature/opensuse","ref":"feature/opensuse","sha":"ddef42218aa249d57f71fca3b853186bb462a4f8","user":{"login":"openSUSE","id":623819,"avatar_url":"https://avatars.githubusercontent.com/u/623819?v=3","gravatar_id":"","url":"https://api.github.com/users/openSUSE","html_url":"https://github.com/openSUSE","followers_url":"https://api.github.com/users/openSUSE/followers","following_url":"https://api.github.com/users/openSUSE/following{/other_user}","gists_url":"https://api.github.com/users/openSUSE/gists{/gist_id}","starred_url":"https://api.github.com/users/openSUSE/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/openSUSE/subscriptions","organizations_url":"https://api.github.com/users/openSUSE/orgs","repos_url":"https://api.github.com/users/openSUSE/repos","events_url":"https://api.github.com/users/openSUSE/events{/privacy}","received_events_url":"https://api.github.com/users/openSUSE/received_events","type":"Organization","site_admin":false},"repo":{"id":60621302,"name":"clair","full_name":"openSUSE/clair","owner":{"login":"openSUSE","id":623819,"avatar_url":"https://avatars.githubusercontent.com/u/623819?v=3","gravatar_id":"","url":"https://api.github.com/users/openSUSE","html_url":"https://github.com/openSUSE","followers_url":"https://api.github.com/users/openSUSE/followers","following_url":"https://api.github.com/users/openSUSE/following{/other_user}","gists_url":"https://api.github.com/users/openSUSE/gists{/gist_id}","starred_url":"https://api.github.com/users/openSUSE/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/openSUSE/subscriptions","organizations_url":"https://api.github.com/users/openSUSE/orgs","repos_url":"https://api.github.com/users/openSUSE/repos","events_url":"https://api.github.com/users/openSUSE/events{/privacy}","received_events_url":"https://api.github.com/users/openSUSE/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/openSUSE/clair","description":"Vulnerability Static Analysis for Containers","fork":true,"url":"https://api.github.com/repos/openSUSE/clair","forks_url":"https://api.github.com/repos/openSUSE/clair/forks","keys_url":"https://api.github.com/repos/openSUSE/clair/keys{/key_id}","collaborators_url":"https://api.github.com/repos/openSUSE/clair/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/openSUSE/clair/teams","hooks_url":"https://api.github.com/repos/openSUSE/clair/hooks","issue_events_url":"https://api.github.com/repos/openSUSE/clair/issues/events{/number}","events_url":"https://api.github.com/repos/openSUSE/clair/events","assignees_url":"https://api.github.com/repos/openSUSE/clair/assignees{/user}","branches_url":"https://api.github.com/repos/openSUSE/clair/branches{/branch}","tags_url":"https://api.github.com/repos/openSUSE/clair/tags","blobs_url":"https://api.github.com/repos/openSUSE/clair/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/openSUSE/clair/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/openSUSE/clair/git/refs{/sha}","trees_url":"https://api.github.com/repos/openSUSE/clair/git/trees{/sha}","statuses_url":"https://api.github.com/repos/openSUSE/clair/statuses/{sha}","languages_url":"https://api.github.com/repos/openSUSE/clair/languages","stargazers_url":"https://api.github.com/repos/openSUSE/clair/stargazers","contributors_url":"https://api.github.com/repos/openSUSE/clair/contributors","subscribers_url":"https://api.github.com/repos/openSUSE/clair/subscribers","subscription_url":"https://api.github.com/repos/openSUSE/clair/subscription","commits_url":"https://api.github.com/repos/openSUSE/clair/commits{/sha}","git_commits_url":"https://api.github.com/repos/openSUSE/clair/git/commits{/sha}","comments_url":"https://api.github.com/repos/openSUSE/clair/comments{/number}","issue_comment_url":"https://api.github.com/repos/openSUSE/clair/issues/comments{/number}","contents_url":"https://api.github.com/repos/openSUSE/clair/contents/{+path}","compare_url":"https://api.github.com/repos/openSUSE/clair/compare/{base}...{head}","merges_url":"https://api.github.com/repos/openSUSE/clair/merges","archive_url":"https://api.github.com/repos/openSUSE/clair/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/openSUSE/clair/downloads","issues_url":"https://api.github.com/repos/openSUSE/clair/issues{/number}","pulls_url":"https://api.github.com/repos/openSUSE/clair/pulls{/number}","milestones_url":"https://api.github.com/repos/openSUSE/clair/milestones{/number}","notifications_url":"https://api.github.com/repos/openSUSE/clair/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/openSUSE/clair/labels{/name}","releases_url":"https://api.github.com/repos/openSUSE/clair/releases{/id}","deployments_url":"https://api.github.com/repos/openSUSE/clair/deployments","created_at":"2016-06-07T14:45:51Z","updated_at":"2016-06-07T14:45:52Z","pushed_at":"2016-07-15T20:47:55Z","git_url":"git://github.com/openSUSE/clair.git","ssh_url":"git@github.com:openSUSE/clair.git","clone_url":"https://github.com/openSUSE/clair.git","svn_url":"https://github.com/openSUSE/clair","homepage":"","size":13175,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":0,"forks":1,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"coreos:master","ref":"master","sha":"be97db52611b69aab97db3b90e2b371349e137b2","user":{"login":"coreos","id":3730757,"avatar_url":"https://avatars.githubusercontent.com/u/3730757?v=3","gravatar_id":"","url":"https://api.github.com/users/coreos","html_url":"https://github.com/coreos","followers_url":"https://api.github.com/users/coreos/followers","following_url":"https://api.github.com/users/coreos/following{/other_user}","gists_url":"https://api.github.com/users/coreos/gists{/gist_id}","starred_url":"https://api.github.com/users/coreos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/coreos/subscriptions","organizations_url":"https://api.github.com/users/coreos/orgs","repos_url":"https://api.github.com/users/coreos/repos","events_url":"https://api.github.com/users/coreos/events{/privacy}","received_events_url":"https://api.github.com/users/coreos/received_events","type":"Organization","site_admin":false},"repo":{"id":46140633,"name":"clair","full_name":"coreos/clair","owner":{"login":"coreos","id":3730757,"avatar_url":"https://avatars.githubusercontent.com/u/3730757?v=3","gravatar_id":"","url":"https://api.github.com/users/coreos","html_url":"https://github.com/coreos","followers_url":"https://api.github.com/users/coreos/followers","following_url":"https://api.github.com/users/coreos/following{/other_user}","gists_url":"https://api.github.com/users/coreos/gists{/gist_id}","starred_url":"https://api.github.com/users/coreos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/coreos/subscriptions","organizations_url":"https://api.github.com/users/coreos/orgs","repos_url":"https://api.github.com/users/coreos/repos","events_url":"https://api.github.com/users/coreos/events{/privacy}","received_events_url":"https://api.github.com/users/coreos/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/coreos/clair","description":"Vulnerability Static Analysis for Containers","fork":false,"url":"https://api.github.com/repos/coreos/clair","forks_url":"https://api.github.com/repos/coreos/clair/forks","keys_url":"https://api.github.com/repos/coreos/clair/keys{/key_id}","collaborators_url":"https://api.github.com/repos/coreos/clair/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/coreos/clair/teams","hooks_url":"https://api.github.com/repos/coreos/clair/hooks","issue_events_url":"https://api.github.com/repos/coreos/clair/issues/events{/number}","events_url":"https://api.github.com/repos/coreos/clair/events","assignees_url":"https://api.github.com/repos/coreos/clair/assignees{/user}","branches_url":"https://api.github.com/repos/coreos/clair/branches{/branch}","tags_url":"https://api.github.com/repos/coreos/clair/tags","blobs_url":"https://api.github.com/repos/coreos/clair/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/coreos/clair/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/coreos/clair/git/refs{/sha}","trees_url":"https://api.github.com/repos/coreos/clair/git/trees{/sha}","statuses_url":"https://api.github.com/repos/coreos/clair/statuses/{sha}","languages_url":"https://api.github.com/repos/coreos/clair/languages","stargazers_url":"https://api.github.com/repos/coreos/clair/stargazers","contributors_url":"https://api.github.com/repos/coreos/clair/contributors","subscribers_url":"https://api.github.com/repos/coreos/clair/subscribers","subscription_url":"https://api.github.com/repos/coreos/clair/subscription","commits_url":"https://api.github.com/repos/coreos/clair/commits{/sha}","git_commits_url":"https://api.github.com/repos/coreos/clair/git/commits{/sha}","comments_url":"https://api.github.com/repos/coreos/clair/comments{/number}","issue_comment_url":"https://api.github.com/repos/coreos/clair/issues/comments{/number}","contents_url":"https://api.github.com/repos/coreos/clair/contents/{+path}","compare_url":"https://api.github.com/repos/coreos/clair/compare/{base}...{head}","merges_url":"https://api.github.com/repos/coreos/clair/merges","archive_url":"https://api.github.com/repos/coreos/clair/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/coreos/clair/downloads","issues_url":"https://api.github.com/repos/coreos/clair/issues{/number}","pulls_url":"https://api.github.com/repos/coreos/clair/pulls{/number}","milestones_url":"https://api.github.com/repos/coreos/clair/milestones{/number}","notifications_url":"https://api.github.com/repos/coreos/clair/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/coreos/clair/labels{/name}","releases_url":"https://api.github.com/repos/coreos/clair/releases{/id}","deployments_url":"https://api.github.com/repos/coreos/clair/deployments","created_at":"2015-11-13T18:46:16Z","updated_at":"2016-09-07T07:01:52Z","pushed_at":"2016-09-06T19:19:08Z","git_url":"git://github.com/coreos/clair.git","ssh_url":"git@github.com:coreos/clair.git","clone_url":"https://github.com/coreos/clair.git","svn_url":"https://github.com/coreos/clair","homepage":"","size":48628,"stargazers_count":1362,"watchers_count":1362,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":153,"mirror_url":null,"open_issues_count":52,"forks":153,"open_issues":52,"watchers":1362,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/coreos/clair/pulls/199"},"html":{"href":"https://github.com/coreos/clair/pull/199"},"issue":{"href":"https://api.github.com/repos/coreos/clair/issues/199"},"comments":{"href":"https://api.github.com/repos/coreos/clair/issues/199/comments"},"review_comments":{"href":"https://api.github.com/repos/coreos/clair/pulls/199/comments"},"review_comment":{"href":"https://api.github.com/repos/coreos/clair/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/coreos/clair/pulls/199/commits"},"statuses":{"href":"https://api.github.com/repos/coreos/clair/statuses/ddef42218aa249d57f71fca3b853186bb462a4f8"}}}}
{"actor":{"display_login":"jzelinskie"}}