Skip to content

Commit a56483a

Browse files
Update GH verification statuses enum, bump to 1.324 (#30)
* Adding new enums for verification reasons using X.509 certificate signatures * Back to the original pom * 1.3243 -> 1.324 --------- Co-authored-by: Ulises <0xTlaloc@gmail.com>
1 parent 6377342 commit a56483a

File tree

33 files changed

+2200
-16
lines changed

33 files changed

+2200
-16
lines changed

pom.xml

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<modelVersion>4.0.0</modelVersion>
33
<groupId>org.kohsuke</groupId>
44
<artifactId>cortexapps-github-api</artifactId>
5-
<version>1.323</version>
5+
<version>1.324</version>
66
<name>GitHub API for Java</name>
77
<url>https://github-api.kohsuke.org/</url>
88
<description>GitHub API for Java</description>
@@ -925,4 +925,4 @@
925925
</developer>
926926
</developers>
927927

928-
</project>
928+
</project>

src/main/java/org/kohsuke/github/GHVerification.java

+29-14
Original file line numberDiff line numberDiff line change
@@ -66,43 +66,58 @@ public String getPayload() {
6666
*/
6767
public enum Reason {
6868

69-
/** The expired key. */
69+
/** Signing key expired. */
7070
EXPIRED_KEY,
7171

72-
/** The not signing key. */
72+
/** The usage flags for the key that signed this don't allow signing. */
7373
NOT_SIGNING_KEY,
7474

75-
/** The gpgverify error. */
75+
/** The GPG verification service misbehaved. */
7676
GPGVERIFY_ERROR,
7777

78-
/** The gpgverify unavailable. */
78+
/** The GPG verification service is unavailable at the moment. */
7979
GPGVERIFY_UNAVAILABLE,
8080

81-
/** The unsigned. */
81+
/** Unsigned. */
8282
UNSIGNED,
8383

84-
/** The unknown signature type. */
84+
/** Unknown signature type. */
8585
UNKNOWN_SIGNATURE_TYPE,
8686

87-
/** The no user. */
87+
/** Email used for signing not known to GitHub. */
8888
NO_USER,
8989

90-
/** The unverified email. */
90+
/** Email used for signing unverified on GitHub. */
9191
UNVERIFIED_EMAIL,
9292

93-
/** The bad email. */
93+
/** Invalid email used for signing. */
9494
BAD_EMAIL,
9595

96-
/** The unknown key. */
96+
/** Key used for signing not known to GitHub. */
9797
UNKNOWN_KEY,
9898

99-
/** The malformed signature. */
99+
/** Malformed signature. */
100100
MALFORMED_SIGNATURE,
101101

102-
/** The invalid. */
102+
/** Invalid signature. */
103103
INVALID,
104104

105-
/** The valid. */
106-
VALID
105+
/** Valid signature and verified by GitHub. */
106+
VALID,
107+
108+
/** The signing certificate or its chain could not be verified. */
109+
BAD_CERT,
110+
111+
/** Malformed signature. (Returned by graphQL) */
112+
MALFORMED_SIG,
113+
114+
/** Valid signature, though certificate revocation check failed. */
115+
OCSP_ERROR,
116+
117+
/** Valid signature, pending certificate revocation checking. */
118+
OCSP_PENDING,
119+
120+
/** One or more certificates in chain has been revoked. */
121+
OCSP_REVOKED
107122
}
108123
}

src/test/java/org/kohsuke/github/GHVerificationReasonTest.java

+84
Original file line numberDiff line numberDiff line change
@@ -217,4 +217,88 @@ public void testValid() throws Exception {
217217
assertThat(commit.getCommitShortInfo().getVerification().getPayload(), notNullValue());
218218
assertThat(commit.getCommitShortInfo().getVerification().getSignature(), notNullValue());
219219
}
220+
221+
/**
222+
* Test bad cert.
223+
*
224+
* @throws Exception
225+
* the exception
226+
*/
227+
@Test
228+
public void testBadCert() throws Exception {
229+
GHRepository r = gitHub.getRepository("hub4j/github-api");
230+
GHCommit commit = r.getCommit("86a2e245aa6d71d54923655066049d9e21a15f01");
231+
assertThat(commit.getCommitShortInfo().getAuthor().getName(), equalTo("Sourabh Parkala"));
232+
assertThat(commit.getCommitShortInfo().getVerification().getSignature(), notNullValue());
233+
assertThat(commit.getCommitShortInfo().getVerification().isVerified(), is(false));
234+
assertThat(commit.getCommitShortInfo().getVerification().getReason(), equalTo(GHVerification.Reason.BAD_CERT));
235+
}
236+
237+
/**
238+
* Test malformed sig.
239+
*
240+
* @throws Exception
241+
* the exception
242+
*/
243+
@Test
244+
public void testMalformedSig() throws Exception {
245+
GHRepository r = gitHub.getRepository("hub4j/github-api");
246+
GHCommit commit = r.getCommit("86a2e245aa6d71d54923655066049d9e21a15f01");
247+
assertThat(commit.getCommitShortInfo().getAuthor().getName(), equalTo("Sourabh Parkala"));
248+
assertThat(commit.getCommitShortInfo().getVerification().getSignature(), notNullValue());
249+
assertThat(commit.getCommitShortInfo().getVerification().isVerified(), is(false));
250+
assertThat(commit.getCommitShortInfo().getVerification().getReason(),
251+
equalTo(GHVerification.Reason.MALFORMED_SIG));
252+
}
253+
254+
/**
255+
* Test OSCP error.
256+
*
257+
* @throws Exception
258+
* the exception
259+
*/
260+
@Test
261+
public void testOcspError() throws Exception {
262+
GHRepository r = gitHub.getRepository("hub4j/github-api");
263+
GHCommit commit = r.getCommit("86a2e245aa6d71d54923655066049d9e21a15f01");
264+
assertThat(commit.getCommitShortInfo().getAuthor().getName(), equalTo("Sourabh Parkala"));
265+
assertThat(commit.getCommitShortInfo().getVerification().getSignature(), notNullValue());
266+
assertThat(commit.getCommitShortInfo().getVerification().isVerified(), is(false));
267+
assertThat(commit.getCommitShortInfo().getVerification().getReason(),
268+
equalTo(GHVerification.Reason.OCSP_ERROR));
269+
}
270+
271+
/**
272+
* Test OSCP pending.
273+
*
274+
* @throws Exception
275+
* the exception
276+
*/
277+
@Test
278+
public void testOscpPending() throws Exception {
279+
GHRepository r = gitHub.getRepository("hub4j/github-api");
280+
GHCommit commit = r.getCommit("86a2e245aa6d71d54923655066049d9e21a15f01");
281+
assertThat(commit.getCommitShortInfo().getAuthor().getName(), equalTo("Sourabh Parkala"));
282+
assertThat(commit.getCommitShortInfo().getVerification().getSignature(), notNullValue());
283+
assertThat(commit.getCommitShortInfo().getVerification().isVerified(), is(false));
284+
assertThat(commit.getCommitShortInfo().getVerification().getReason(),
285+
equalTo(GHVerification.Reason.OCSP_PENDING));
286+
}
287+
288+
/**
289+
* Test OCSP revoked.
290+
*
291+
* @throws Exception
292+
* the exception
293+
*/
294+
@Test
295+
public void testOscpRevoked() throws Exception {
296+
GHRepository r = gitHub.getRepository("hub4j/github-api");
297+
GHCommit commit = r.getCommit("86a2e245aa6d71d54923655066049d9e21a15f01");
298+
assertThat(commit.getCommitShortInfo().getAuthor().getName(), equalTo("Sourabh Parkala"));
299+
assertThat(commit.getCommitShortInfo().getVerification().getSignature(), notNullValue());
300+
assertThat(commit.getCommitShortInfo().getVerification().isVerified(), is(false));
301+
assertThat(commit.getCommitShortInfo().getVerification().getReason(),
302+
equalTo(GHVerification.Reason.OCSP_REVOKED));
303+
}
220304
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
{
2+
"id": 617210,
3+
"node_id": "MDEwOlJlcG9zaXRvcnk2MTcyMTA=",
4+
"name": "github-api",
5+
"full_name": "hub4j/github-api",
6+
"private": false,
7+
"owner": {
8+
"login": "hub4j",
9+
"id": 54909825,
10+
"node_id": "MDEyOk9yZ2FuaXphdGlvbjU0OTA5ODI1",
11+
"avatar_url": "https://avatars3.githubusercontent.com/u/54909825?v=4",
12+
"gravatar_id": "",
13+
"url": "https://api.github.com/users/hub4j",
14+
"html_url": "https://github.com/hub4j",
15+
"followers_url": "https://api.github.com/users/hub4j/followers",
16+
"following_url": "https://api.github.com/users/hub4j/following{/other_user}",
17+
"gists_url": "https://api.github.com/users/hub4j/gists{/gist_id}",
18+
"starred_url": "https://api.github.com/users/hub4j/starred{/owner}{/repo}",
19+
"subscriptions_url": "https://api.github.com/users/hub4j/subscriptions",
20+
"organizations_url": "https://api.github.com/users/hub4j/orgs",
21+
"repos_url": "https://api.github.com/users/hub4j/repos",
22+
"events_url": "https://api.github.com/users/hub4j/events{/privacy}",
23+
"received_events_url": "https://api.github.com/users/hub4j/received_events",
24+
"type": "Organization",
25+
"site_admin": false
26+
},
27+
"html_url": "https://github.com/hub4j/github-api",
28+
"description": "Java API for GitHub",
29+
"fork": false,
30+
"url": "https://api.github.com/repos/hub4j/github-api",
31+
"forks_url": "https://api.github.com/repos/hub4j/github-api/forks",
32+
"keys_url": "https://api.github.com/repos/hub4j/github-api/keys{/key_id}",
33+
"collaborators_url": "https://api.github.com/repos/hub4j/github-api/collaborators{/collaborator}",
34+
"teams_url": "https://api.github.com/repos/hub4j/github-api/teams",
35+
"hooks_url": "https://api.github.com/repos/hub4j/github-api/hooks",
36+
"issue_events_url": "https://api.github.com/repos/hub4j/github-api/issues/events{/number}",
37+
"events_url": "https://api.github.com/repos/hub4j/github-api/events",
38+
"assignees_url": "https://api.github.com/repos/hub4j/github-api/assignees{/user}",
39+
"branches_url": "https://api.github.com/repos/hub4j/github-api/branches{/branch}",
40+
"tags_url": "https://api.github.com/repos/hub4j/github-api/tags",
41+
"blobs_url": "https://api.github.com/repos/hub4j/github-api/git/blobs{/sha}",
42+
"git_tags_url": "https://api.github.com/repos/hub4j/github-api/git/tags{/sha}",
43+
"git_refs_url": "https://api.github.com/repos/hub4j/github-api/git/refs{/sha}",
44+
"trees_url": "https://api.github.com/repos/hub4j/github-api/git/trees{/sha}",
45+
"statuses_url": "https://api.github.com/repos/hub4j/github-api/statuses/{sha}",
46+
"languages_url": "https://api.github.com/repos/hub4j/github-api/languages",
47+
"stargazers_url": "https://api.github.com/repos/hub4j/github-api/stargazers",
48+
"contributors_url": "https://api.github.com/repos/hub4j/github-api/contributors",
49+
"subscribers_url": "https://api.github.com/repos/hub4j/github-api/subscribers",
50+
"subscription_url": "https://api.github.com/repos/hub4j/github-api/subscription",
51+
"commits_url": "https://api.github.com/repos/hub4j/github-api/commits{/sha}",
52+
"git_commits_url": "https://api.github.com/repos/hub4j/github-api/git/commits{/sha}",
53+
"comments_url": "https://api.github.com/repos/hub4j/github-api/comments{/number}",
54+
"issue_comment_url": "https://api.github.com/repos/hub4j/github-api/issues/comments{/number}",
55+
"contents_url": "https://api.github.com/repos/hub4j/github-api/contents/{+path}",
56+
"compare_url": "https://api.github.com/repos/hub4j/github-api/compare/{base}...{head}",
57+
"merges_url": "https://api.github.com/repos/hub4j/github-api/merges",
58+
"archive_url": "https://api.github.com/repos/hub4j/github-api/{archive_format}{/ref}",
59+
"downloads_url": "https://api.github.com/repos/hub4j/github-api/downloads",
60+
"issues_url": "https://api.github.com/repos/hub4j/github-api/issues{/number}",
61+
"pulls_url": "https://api.github.com/repos/hub4j/github-api/pulls{/number}",
62+
"milestones_url": "https://api.github.com/repos/hub4j/github-api/milestones{/number}",
63+
"notifications_url": "https://api.github.com/repos/hub4j/github-api/notifications{?since,all,participating}",
64+
"labels_url": "https://api.github.com/repos/hub4j/github-api/labels{/name}",
65+
"releases_url": "https://api.github.com/repos/hub4j/github-api/releases{/id}",
66+
"deployments_url": "https://api.github.com/repos/hub4j/github-api/deployments",
67+
"created_at": "2010-04-19T04:13:03Z",
68+
"updated_at": "2019-10-25T01:32:16Z",
69+
"pushed_at": "2019-10-25T16:41:09Z",
70+
"git_url": "git://github.com/hub4j/github-api.git",
71+
"ssh_url": "git@github.com:hub4j/github-api.git",
72+
"clone_url": "https://github.com/hub4j/github-api.git",
73+
"svn_url": "https://github.com/hub4j/github-api",
74+
"homepage": "http://github-api.kohsuke.org/",
75+
"size": 13494,
76+
"stargazers_count": 565,
77+
"watchers_count": 565,
78+
"language": "Java",
79+
"has_issues": true,
80+
"has_projects": true,
81+
"has_downloads": true,
82+
"has_wiki": true,
83+
"has_pages": true,
84+
"forks_count": 433,
85+
"mirror_url": null,
86+
"archived": false,
87+
"disabled": false,
88+
"open_issues_count": 64,
89+
"license": {
90+
"key": "mit",
91+
"name": "MIT License",
92+
"spdx_id": "MIT",
93+
"url": "https://api.github.com/licenses/mit",
94+
"node_id": "MDc6TGljZW5zZTEz"
95+
},
96+
"forks": 433,
97+
"open_issues": 64,
98+
"watchers": 565,
99+
"default_branch": "main",
100+
"permissions": {
101+
"admin": true,
102+
"push": true,
103+
"pull": true
104+
},
105+
"allow_squash_merge": true,
106+
"allow_merge_commit": true,
107+
"allow_rebase_merge": true,
108+
"organization": {
109+
"login": "hub4j",
110+
"id": 54909825,
111+
"node_id": "MDEyOk9yZ2FuaXphdGlvbjU0OTA5ODI1",
112+
"avatar_url": "https://avatars3.githubusercontent.com/u/54909825?v=4",
113+
"gravatar_id": "",
114+
"url": "https://api.github.com/users/hub4j",
115+
"html_url": "https://github.com/hub4j",
116+
"followers_url": "https://api.github.com/users/hub4j/followers",
117+
"following_url": "https://api.github.com/users/hub4j/following{/other_user}",
118+
"gists_url": "https://api.github.com/users/hub4j/gists{/gist_id}",
119+
"starred_url": "https://api.github.com/users/hub4j/starred{/owner}{/repo}",
120+
"subscriptions_url": "https://api.github.com/users/hub4j/subscriptions",
121+
"organizations_url": "https://api.github.com/users/hub4j/orgs",
122+
"repos_url": "https://api.github.com/users/hub4j/repos",
123+
"events_url": "https://api.github.com/users/hub4j/events{/privacy}",
124+
"received_events_url": "https://api.github.com/users/hub4j/received_events",
125+
"type": "Organization",
126+
"site_admin": false
127+
},
128+
"network_count": 433,
129+
"subscribers_count": 48
130+
}

0 commit comments

Comments
 (0)