diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 038bc93fad..11d644db46 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -42,7 +42,7 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL diff --git a/.github/workflows/maven-build.yml b/.github/workflows/maven-build.yml index 2ef600e1ec..d572259804 100644 --- a/.github/workflows/maven-build.yml +++ b/.github/workflows/maven-build.yml @@ -19,64 +19,44 @@ permissions: jobs: build: - name: build-only (Java ${{ matrix.java }}) + name: build-only (Java 17) runs-on: ubuntu-latest strategy: - fail-fast: false - matrix: - java: [ 17 ] + fail-fast: true steps: - - uses: actions/checkout@v3 - - name: Set up JDK - uses: actions/setup-java@v3 - with: - java-version: ${{ matrix.java }} - distribution: 'temurin' - cache: 'maven' - - name: Maven Install (skipTests) - env: - MAVEN_OPTS: ${{ env.JAVA_11_PLUS_MAVEN_OPTS }} - run: mvn -B clean install -DskipTests --file pom.xml + - uses: actions/checkout@v4 + - name: Set up JDK + uses: actions/setup-java@v3 + with: + java-version: 17 + distribution: 'temurin' + cache: 'maven' + - name: Maven Install (skipTests) + env: + MAVEN_OPTS: ${{ env.JAVA_11_PLUS_MAVEN_OPTS }} + run: mvn -B clean install -DskipTests --file pom.xml + - uses: actions/upload-artifact@v3 + with: + name: maven-target-directory + path: target/ + retention-days: 3 site: - name: site (Java ${{ matrix.java }}) + name: site (Java 17) runs-on: ubuntu-latest strategy: fail-fast: false - matrix: - java: [ 17 ] - steps: - - uses: actions/checkout@v3 - - name: Set up JDK - uses: actions/setup-java@v3 - with: - java-version: ${{ matrix.java }} - distribution: 'temurin' - cache: 'maven' - - name: Maven Site - env: - MAVEN_OPTS: ${{ env.JAVA_11_PLUS_MAVEN_OPTS }} - run: mvn -B clean site -D enable-ci --file pom.xml - test-8: - name: test (${{ matrix.os }}, Java 8) - runs-on: ${{ matrix.os }}-latest - strategy: - fail-fast: false - matrix: - os: [ ubuntu ] - java: [ 8 ] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up JDK uses: actions/setup-java@v3 with: - java-version: ${{ matrix.java }} + java-version: 17 distribution: 'temurin' cache: 'maven' - # JDK 8 - - name: Maven Install with Code Coverage - run: mvn -B clean install -D enable-ci -Djapicmp.skip --file pom.xml - - name: Codecov Report - uses: codecov/codecov-action@v3.1.4 + - name: Maven Site + env: + MAVEN_OPTS: ${{ env.JAVA_11_PLUS_MAVEN_OPTS }} + run: mvn -B clean site -D enable-ci --file pom.xml test: name: test (${{ matrix.os }}, Java ${{ matrix.java }}) runs-on: ${{ matrix.os }}-latest @@ -86,7 +66,7 @@ jobs: os: [ ubuntu, windows ] java: [ 11, 17 ] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up JDK uses: actions/setup-java@v3 with: @@ -104,3 +84,25 @@ jobs: env: MAVEN_OPTS: ${{ env.JAVA_11_PLUS_MAVEN_OPTS }} run: mvn -B clean install -D enable-ci --file pom.xml "-Dsurefire.argLine=--add-opens java.base/java.net=ALL-UNNAMED" + - name: Codecov Report + if: matrix.os == 'ubuntu' && matrix.java == '17' + uses: codecov/codecov-action@v3.1.4 + + test-java-8: + name: test Java 8 (no-build) + needs: build + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/download-artifact@v3 + with: + name: maven-target-directory + path: target + - name: Set up JDK + uses: actions/setup-java@v3 + with: + java-version: 8 + distribution: 'temurin' + cache: 'maven' + - name: Maven Test (no build) Java 8 + run: mvn -B surefire:test -DfailIfNoTests -Dsurefire.excludesFile=src/test/resources/slow-or-flaky-tests.txt diff --git a/pom.xml b/pom.xml index da69a65c61..bd9bb94e04 100644 --- a/pom.xml +++ b/pom.xml @@ -2,7 +2,7 @@ 4.0.0 org.kohsuke github-api - 1.316-SNAPSHOT + 1.318-SNAPSHOT GitHub API for Java https://github-api.kohsuke.org/ GitHub API for Java @@ -44,7 +44,7 @@ 0.50 false - 0.11.5 + 0.12.3 @@ -60,7 +60,7 @@ org.apache.maven.scm maven-scm-manager-plexus - 1.13.0 + 2.0.1 false @@ -92,7 +92,7 @@ org.apache.maven.plugins maven-source-plugin - 3.2.1 + 3.3.0 org.apache.maven.plugins @@ -241,6 +241,9 @@ java18 1.0 + + java.net.http.* + @@ -301,19 +304,52 @@ + + + compile-java-11 + compile + + compile + + + 11 + 11 + 11 + + ${project.basedir}/src/main/java11 + + true + + + maven-surefire-plugin + + @{jacoco.surefire.argLine} ${surefire.argLine} + default-test src/test/resources/slow-or-flaky-tests.txt - @{jacoco.surefire.argLine} ${surefire.argLine} + + org.apache.maven.plugins + maven-jar-plugin + 3.3.0 + + + + org.kohsuke.github.api + true + + + + org.codehaus.mojo animal-sniffer-maven-plugin @@ -321,7 +357,7 @@ com.infradna.tool bridge-method-injector - 1.23 + 1.29 @@ -422,6 +458,18 @@ + + + + com.fasterxml.jackson + jackson-bom + 2.15.3 + import + pom + + + + org.apache.commons @@ -474,7 +522,6 @@ com.fasterxml.jackson.core jackson-databind - 2.15.2 commons-io @@ -484,7 +531,7 @@ com.infradna.tool bridge-method-annotation - 1.23 + 1.29 true @@ -517,7 +564,7 @@ org.eclipse.jgit org.eclipse.jgit - 6.4.0.202211300538-r + 6.7.0.202309050840-r test @@ -585,7 +632,7 @@ com.github.tomakehurst wiremock-jre8-standalone - 2.35.0 + 2.35.1 test @@ -597,7 +644,7 @@ org.slf4j slf4j-simple - 2.0.3 + 2.0.7 test @@ -616,7 +663,7 @@ - slow-or-flaky-test + test-jwt-slow-multireleasejar-flaky !test @@ -639,6 +686,32 @@ @{jacoco.surefire.argLine} ${surefire.argLine} -Dtest.github.connector=okhttp + + java11-test + integration-test + + test + + + ${project.basedir}/target/github-api-${project.version}.jar + false + src/test/resources/slow-or-flaky-tests.txt + @{jacoco.surefire.argLine} ${surefire.argLine} -Dtest.github.connector=httpclient + + + + java11-urlconnection-test + integration-test + + test + + + ${project.basedir}/target/github-api-${project.version}.jar + false + src/test/resources/slow-or-flaky-tests.txt + @{jacoco.surefire.argLine} ${surefire.argLine} -Dtest.github.connector=urlconnection + + slow-or-flaky-test integration-test @@ -651,7 +724,40 @@ src/test/resources/slow-or-flaky-tests.txt - @{jacoco.surefire.argLine} ${surefire.argLine} + + + + + jwt0.11.x-test + integration-test + + test + + + ${project.basedir}/target/github-api-${project.version}.jar + false + src/test/resources/slow-or-flaky-tests.txt + @{jacoco.surefire.argLine} ${surefire.argLine} -Dtest.github.connector=okhttp + + io.jsonwebtoken:* + + + + io.jsonwebtoken + jjwt-api + 0.11.5 + + + io.jsonwebtoken + jjwt-impl + 0.11.5 + + + io.jsonwebtoken + jjwt-jackson + 0.11.5 + + @@ -782,105 +888,6 @@ - - multirelease - - [11,) - - - - - org.codehaus.mojo - animal-sniffer-maven-plugin - - - java.net.http.* - - - - - maven-compiler-plugin - 3.10.1 - - - compile-java-11 - compile - - compile - - - 11 - 11 - 11 - - ${project.basedir}/src/main/java11 - - true - - - - - - org.apache.maven.plugins - maven-jar-plugin - 3.3.0 - - - - org.kohsuke.github.api - true - - - - - - - - - multirelease-test - - [11,) - - !test - - - - - - maven-surefire-plugin - - - java11-test - integration-test - - test - - - ${project.basedir}/target/github-api-${project.version}.jar - false - src/test/resources/slow-or-flaky-tests.txt - @{jacoco.surefire.argLine} ${surefire.argLine} -Dtest.github.connector=httpclient - - - - java11-urlconnection-test - integration-test - - test - - - ${project.basedir}/target/github-api-${project.version}.jar - false - src/test/resources/slow-or-flaky-tests.txt - @{jacoco.surefire.argLine} ${surefire.argLine} -Dtest.github.connector=urlconnection - - - - - - - - diff --git a/src/main/java/org/kohsuke/github/GHBranchProtection.java b/src/main/java/org/kohsuke/github/GHBranchProtection.java index 697686ce2d..834544944f 100644 --- a/src/main/java/org/kohsuke/github/GHBranchProtection.java +++ b/src/main/java/org/kohsuke/github/GHBranchProtection.java @@ -22,9 +22,30 @@ public class GHBranchProtection extends GitHubInteractiveObject { private static final String REQUIRE_SIGNATURES_URI = "/required_signatures"; + @JsonProperty + private AllowDeletions allowDeletions; + + @JsonProperty + private AllowForcePushes allowForcePushes; + + @JsonProperty + private AllowForkSyncing allowForkSyncing; + + @JsonProperty + private BlockCreations blockCreations; + @JsonProperty private EnforceAdmins enforceAdmins; + @JsonProperty + private LockBranch lockBranch; + + @JsonProperty + private RequiredConversationResolution requiredConversationResolution; + + @JsonProperty + private RequiredLinearHistory requiredLinearHistory; + @JsonProperty("required_pull_request_reviews") private RequiredReviews requiredReviews; @@ -59,6 +80,42 @@ public void disableSignedCommits() throws IOException { requester().method("DELETE").withUrlPath(url + REQUIRE_SIGNATURES_URI).send(); } + /** + * Gets allow deletions. + * + * @return the enforce admins + */ + public AllowDeletions getAllowDeletions() { + return allowDeletions; + } + + /** + * Gets allow force pushes. + * + * @return the enforce admins + */ + public AllowForcePushes getAllowForcePushes() { + return allowForcePushes; + } + + /** + * Gets allow fork syncing. + * + * @return the enforce admins + */ + public AllowForkSyncing getAllowForkSyncing() { + return allowForkSyncing; + } + + /** + * Gets block creations. + * + * @return the enforce admins + */ + public BlockCreations getBlockCreations() { + return blockCreations; + } + /** * Gets enforce admins. * @@ -68,6 +125,33 @@ public EnforceAdmins getEnforceAdmins() { return enforceAdmins; } + /** + * Gets lock branch. + * + * @return the enforce admins + */ + public LockBranch getLockBranch() { + return lockBranch; + } + + /** + * Gets required conversation resolution. + * + * @return the enforce admins + */ + public RequiredConversationResolution getRequiredConversationResolution() { + return requiredConversationResolution; + } + + /** + * Gets required linear history. + * + * @return the enforce admins + */ + public RequiredLinearHistory getRequiredLinearHistory() { + return requiredLinearHistory; + } + /** * Gets required reviews. * @@ -120,6 +204,74 @@ private Requester requester() { return root().createRequest().withPreview(ZZZAX); } + /** + * The type AllowDeletions. + */ + public static class AllowDeletions { + @JsonProperty + private boolean enabled; + + /** + * Is enabled boolean. + * + * @return the boolean + */ + public boolean isEnabled() { + return enabled; + } + } + + /** + * The type AllowForcePushes. + */ + public static class AllowForcePushes { + @JsonProperty + private boolean enabled; + + /** + * Is enabled boolean. + * + * @return the boolean + */ + public boolean isEnabled() { + return enabled; + } + } + + /** + * The type AllowForkSyncing. + */ + public static class AllowForkSyncing { + @JsonProperty + private boolean enabled; + + /** + * Is enabled boolean. + * + * @return the boolean + */ + public boolean isEnabled() { + return enabled; + } + } + + /** + * The type BlockCreations. + */ + public static class BlockCreations { + @JsonProperty + private boolean enabled; + + /** + * Is enabled boolean. + * + * @return the boolean + */ + public boolean isEnabled() { + return enabled; + } + } + /** * The type EnforceAdmins. */ @@ -149,6 +301,57 @@ public boolean isEnabled() { } } + /** + * The type LockBranch. + */ + public static class LockBranch { + @JsonProperty + private boolean enabled; + + /** + * Is enabled boolean. + * + * @return the boolean + */ + public boolean isEnabled() { + return enabled; + } + } + + /** + * The type RequiredConversationResolution. + */ + public static class RequiredConversationResolution { + @JsonProperty + private boolean enabled; + + /** + * Is enabled boolean. + * + * @return the boolean + */ + public boolean isEnabled() { + return enabled; + } + } + + /** + * The type RequiredLinearHistory. + */ + public static class RequiredLinearHistory { + @JsonProperty + private boolean enabled; + + /** + * Is enabled boolean. + * + * @return the boolean + */ + public boolean isEnabled() { + return enabled; + } + } + /** * The type RequiredReviews. */ @@ -156,10 +359,15 @@ public static class RequiredReviews { @JsonProperty("dismissal_restrictions") private Restrictions dismissalRestriction; + @JsonProperty private boolean dismissStaleReviews; + @JsonProperty private boolean requireCodeOwnerReviews; + @JsonProperty + private boolean requireLastPushApproval; + @JsonProperty("required_approving_review_count") private int requiredReviewers; @@ -202,6 +410,15 @@ public boolean isRequireCodeOwnerReviews() { return requireCodeOwnerReviews; } + /** + * Is require last push approval boolean. + * + * @return the boolean + */ + public boolean isRequireLastPushApproval() { + return requireLastPushApproval; + } + /** * Gets required reviewers. * diff --git a/src/main/java/org/kohsuke/github/GHBranchProtectionBuilder.java b/src/main/java/org/kohsuke/github/GHBranchProtectionBuilder.java index 9d22703914..ec21b3168c 100644 --- a/src/main/java/org/kohsuke/github/GHBranchProtectionBuilder.java +++ b/src/main/java/org/kohsuke/github/GHBranchProtectionBuilder.java @@ -27,7 +27,7 @@ public class GHBranchProtectionBuilder { private final GHBranch branch; - private boolean enforceAdmins; + private Map fields = new HashMap(); private Map prReviews; private Restrictions restrictions; private StatusChecks statusChecks; @@ -40,6 +40,7 @@ public class GHBranchProtectionBuilder { */ GHBranchProtectionBuilder(GHBranch branch) { this.branch = branch; + includeAdmins(false); } /** @@ -66,6 +67,95 @@ public GHBranchProtectionBuilder addRequiredChecks(String... checks) { return this; } + /** + * Allow deletion of the protected branch. + * + * @return the gh branch protection builder + */ + public GHBranchProtectionBuilder allowDeletions() { + return allowDeletions(true); + } + + /** + * Allows deletion of the protected branch by anyone with write access to the repository. Set to true to allow + * deletion of the protected branch. Default: false. + * + * @param v + * the v + * @return the gh branch protection builder + */ + public GHBranchProtectionBuilder allowDeletions(boolean v) { + fields.put("allow_deletions", v); + return this; + } + + /** + * Permits force pushes. + * + * @return the gh branch protection builder + */ + public GHBranchProtectionBuilder allowForcePushes() { + return allowForcePushes(true); + } + + /** + * Permits force pushes to the protected branch by anyone with write access to the repository. Set to true to allow + * force pushes. Set to false to block force pushes. Default: false. + * + * @param v + * the v + * @return the gh branch protection builder + */ + public GHBranchProtectionBuilder allowForcePushes(boolean v) { + fields.put("allow_force_pushes", v); + return this; + } + + /** + * Allow fork syncing. + * + * @return the gh branch protection builder + */ + public GHBranchProtectionBuilder allowForkSyncing() { + return allowForkSyncing(true); + } + + /** + * Whether users can pull changes from upstream when the branch is locked. Set to true to allow fork syncing. Set to + * true to enable. Default: false. + * + * @param v + * the v + * @return the gh branch protection builder + */ + public GHBranchProtectionBuilder allowForkSyncing(boolean v) { + fields.put("allow_fork_syncing", v); + return this; + } + + /** + * Restrict new branch creation. + * + * @return the gh branch protection builder + */ + public GHBranchProtectionBuilder blockCreations() { + return blockCreations(true); + } + + /** + * If set to true, the restrictions branch protection settings which limits who can push will also block pushes + * which create new branches, unless the push is initiated by a user, team, or app which has the ability to push. + * Set to true to restrict new branch creation. Default: false. + * + * @param v + * the v + * @return the gh branch protection builder + */ + public GHBranchProtectionBuilder blockCreations(boolean v) { + fields.put("block_creations", v); + return this; + } + /** * Dismiss stale reviews gh branch protection builder. * @@ -96,10 +186,10 @@ public GHBranchProtectionBuilder dismissStaleReviews(boolean v) { */ public GHBranchProtection enable() throws IOException { return requester().method("PUT") + .with(fields) .withNullable("required_status_checks", statusChecks) .withNullable("required_pull_request_reviews", prReviews) .withNullable("restrictions", restrictions) - .withNullable("enforce_admins", enforceAdmins) .withUrlPath(branch.getProtectionUrl().toString()) .fetch(GHBranchProtection.class); } @@ -121,7 +211,29 @@ public GHBranchProtectionBuilder includeAdmins() { * @return the gh branch protection builder */ public GHBranchProtectionBuilder includeAdmins(boolean v) { - enforceAdmins = v; + fields.put("enforce_admins", v); + return this; + } + + /** + * Set the branch as read-only. + * + * @return the gh branch protection builder + */ + public GHBranchProtectionBuilder lockBranch() { + return lockBranch(true); + } + + /** + * Whether to set the branch as read-only. If this is true, users will not be able to push to the branch. Set to + * true to enable. Default: false. + * + * @param v + * the v + * @return the gh branch protection builder + */ + public GHBranchProtectionBuilder lockBranch(boolean v) { + fields.put("lock_branch", v); return this; } @@ -179,6 +291,73 @@ public GHBranchProtectionBuilder requireCodeOwnReviews(boolean v) { return this; } + /** + * Enable the most recent push must be approved by someone other than the person who pushed it. + * + * @return the gh branch protection builder + */ + public GHBranchProtectionBuilder requireLastPushApproval() { + return requireLastPushApproval(true); + } + + /** + * Whether the most recent push must be approved by someone other than the person who pushed it. Default: false. + * + * @param v + * the v + * @return the gh branch protection builder + */ + public GHBranchProtectionBuilder requireLastPushApproval(boolean v) { + getPrReviews().put("require_last_push_approval", v); + return this; + } + + /** + * Require all conversations on code to be resolved before a pull request can be merged into a branch that matches + * this rule. + * + * @return the gh branch protection builder + */ + public GHBranchProtectionBuilder requiredConversationResolution() { + return requiredConversationResolution(true); + } + + /** + * Require all conversations on code to be resolved before a pull request can be merged into a branch that matches + * this rule. Set to true to enable. Default: false. + * + * @param v + * the v + * @return the gh branch protection builder + */ + public GHBranchProtectionBuilder requiredConversationResolution(boolean v) { + fields.put("required_conversation_resolution", v); + return this; + } + + /** + * Enforce a linear commit Git history. + * + * @return the gh branch protection builder + */ + public GHBranchProtectionBuilder requiredLinearHistory() { + return requiredLinearHistory(true); + } + + /** + * Enforces a linear commit Git history, which prevents anyone from pushing merge commits to a branch. Set to true + * to enforce a linear commit history. Set to false to disable a linear commit Git history. Your repository must + * allow squash merging or rebase merging before you can enable a linear commit history. Default: false. + * + * @param v + * the v + * @return the gh branch protection builder + */ + public GHBranchProtectionBuilder requiredLinearHistory(boolean v) { + fields.put("required_linear_history", v); + return this; + } + /** * Require reviews gh branch protection builder. * diff --git a/src/main/java/org/kohsuke/github/GHContent.java b/src/main/java/org/kohsuke/github/GHContent.java index 9a0e38c2ab..c476a89d8c 100644 --- a/src/main/java/org/kohsuke/github/GHContent.java +++ b/src/main/java/org/kohsuke/github/GHContent.java @@ -321,12 +321,11 @@ public GHContentUpdateResponse update(byte[] newContentBytes, String commitMessa String encodedContent = Base64.getEncoder().encodeToString(newContentBytes); Requester requester = root().createRequest() - .method("POST") + .method("PUT") .with("path", path) .with("message", commitMessage) .with("sha", sha) - .with("content", encodedContent) - .method("PUT"); + .with("content", encodedContent); if (branch != null) { requester.with("branch", branch); @@ -368,11 +367,10 @@ public GHContentUpdateResponse delete(String message) throws IOException { */ public GHContentUpdateResponse delete(String commitMessage, String branch) throws IOException { Requester requester = root().createRequest() - .method("POST") + .method("DELETE") .with("path", path) .with("message", commitMessage) - .with("sha", sha) - .method("DELETE"); + .with("sha", sha); if (branch != null) { requester.with("branch", branch); diff --git a/src/main/java/org/kohsuke/github/GHEvent.java b/src/main/java/org/kohsuke/github/GHEvent.java index d93411bedf..1170743ac3 100644 --- a/src/main/java/org/kohsuke/github/GHEvent.java +++ b/src/main/java/org/kohsuke/github/GHEvent.java @@ -102,6 +102,9 @@ public enum GHEvent { /** The merge queue entry. */ MERGE_QUEUE_ENTRY, + /** The merge group entry. */ + MERGE_GROUP, + /** The meta. */ META, diff --git a/src/main/java/org/kohsuke/github/GHRepository.java b/src/main/java/org/kohsuke/github/GHRepository.java index deaf4aeaff..a20aac28eb 100644 --- a/src/main/java/org/kohsuke/github/GHRepository.java +++ b/src/main/java/org/kohsuke/github/GHRepository.java @@ -103,6 +103,8 @@ public class GHRepository extends GHObject { private boolean allow_rebase_merge; + private boolean allow_forking; + private boolean delete_branch_on_merge; @JsonProperty("private") @@ -715,6 +717,15 @@ public boolean isAllowRebaseMerge() { return allow_rebase_merge; } + /** + * Is allow private forks + * + * @return the boolean + */ + public boolean isAllowForking() { + return allow_forking; + } + /** * Automatically deleting head branches when pull requests are merged. * @@ -1461,6 +1472,18 @@ public void allowRebaseMerge(boolean value) throws IOException { set().allowRebaseMerge(value); } + /** + * Allow private fork. + * + * @param value + * the value + * @throws IOException + * the io exception + */ + public void allowForking(boolean value) throws IOException { + set().allowForking(value); + } + /** * After pull requests are merged, you can have head branches deleted automatically. * diff --git a/src/main/java/org/kohsuke/github/GHRepositoryBuilder.java b/src/main/java/org/kohsuke/github/GHRepositoryBuilder.java index 1d8602a044..a7b5b11a72 100644 --- a/src/main/java/org/kohsuke/github/GHRepositoryBuilder.java +++ b/src/main/java/org/kohsuke/github/GHRepositoryBuilder.java @@ -76,6 +76,19 @@ public S allowRebaseMerge(boolean enabled) throws IOException { return with("allow_rebase_merge", enabled); } + /** + * Allow or disallow private forks + * + * @param enabled + * true if enabled + * @return a builder to continue with building + * @throws IOException + * In case of any networking error or error from the server. + */ + public S allowForking(boolean enabled) throws IOException { + return with("allow_forking", enabled); + } + /** * After pull requests are merged, you can have head branches deleted automatically. * diff --git a/src/main/java/org/kohsuke/github/GHVerification.java b/src/main/java/org/kohsuke/github/GHVerification.java index 382d39a26e..2a759ea5a5 100644 --- a/src/main/java/org/kohsuke/github/GHVerification.java +++ b/src/main/java/org/kohsuke/github/GHVerification.java @@ -61,48 +61,63 @@ public String getPayload() { * The possible values for reason in verification object from github. * * @author Sourabh Sarvotham Parkala - * @see List of possible - * reason values + * @see List of possible reason + * values. Note graphQL documentation has currently the most updated values. */ public enum Reason { - /** The expired key. */ + /** Signing key expired. */ EXPIRED_KEY, - /** The not signing key. */ + /** The usage flags for the key that signed this don't allow signing. */ NOT_SIGNING_KEY, - /** The gpgverify error. */ + /** The GPG verification service misbehaved. */ GPGVERIFY_ERROR, - /** The gpgverify unavailable. */ + /** The GPG verification service is unavailable at the moment. */ GPGVERIFY_UNAVAILABLE, - /** The unsigned. */ + /** Unsigned. */ UNSIGNED, - /** The unknown signature type. */ + /** Unknown signature type. */ UNKNOWN_SIGNATURE_TYPE, - /** The no user. */ + /** Email used for signing not known to GitHub. */ NO_USER, - /** The unverified email. */ + /** Email used for signing unverified on GitHub. */ UNVERIFIED_EMAIL, - /** The bad email. */ + /** Invalid email used for signing. */ BAD_EMAIL, - /** The unknown key. */ + /** Key used for signing not known to GitHub. */ UNKNOWN_KEY, - /** The malformed signature. */ + /** Malformed signature. */ MALFORMED_SIGNATURE, - /** The invalid. */ + /** Invalid signature. */ INVALID, - /** The valid. */ - VALID + /** Valid signature and verified by GitHub. */ + VALID, + + /** The signing certificate or its chain could not be verified. */ + BAD_CERT, + + /** Malformed signature. (Returned by graphQL) */ + MALFORMED_SIG, + + /** Valid signature, though certificate revocation check failed. */ + OCSP_ERROR, + + /** Valid signature, pending certificate revocation checking. */ + OCSP_PENDING, + + /** One or more certificates in chain has been revoked. */ + OCSP_REVOKED } } diff --git a/src/main/java/org/kohsuke/github/extras/authorization/JWTTokenProvider.java b/src/main/java/org/kohsuke/github/extras/authorization/JWTTokenProvider.java index 85ed1f69ed..cc3f3c4df5 100644 --- a/src/main/java/org/kohsuke/github/extras/authorization/JWTTokenProvider.java +++ b/src/main/java/org/kohsuke/github/extras/authorization/JWTTokenProvider.java @@ -1,9 +1,5 @@ package org.kohsuke.github.extras.authorization; -import io.jsonwebtoken.JwtBuilder; -import io.jsonwebtoken.Jwts; -import io.jsonwebtoken.SignatureAlgorithm; -import io.jsonwebtoken.jackson.io.JacksonSerializer; import org.kohsuke.github.authorization.AuthorizationProvider; import java.io.File; @@ -19,7 +15,6 @@ import java.time.Duration; import java.time.Instant; import java.util.Base64; -import java.util.Date; import javax.annotation.Nonnull; @@ -171,18 +166,10 @@ private String refreshJWT() { // Setting the issued at to a time in the past to allow for clock skew Instant issuedAt = getIssuedAt(now); - // Let's set the JWT Claims - JwtBuilder builder = Jwts.builder() - .setIssuedAt(Date.from(issuedAt)) - .setExpiration(Date.from(expiration)) - .setIssuer(this.applicationId) - .signWith(privateKey, SignatureAlgorithm.RS256); - // Token will refresh 2 minutes before it expires validUntil = expiration.minus(Duration.ofMinutes(2)); - // Builds the JWT and serializes it to a compact, URL-safe string - return builder.serializeToJsonWith(new JacksonSerializer<>()).compact(); + return JwtBuilderUtil.buildJwt(issuedAt, expiration, applicationId, privateKey); } Instant getIssuedAt(Instant now) { diff --git a/src/main/java/org/kohsuke/github/extras/authorization/JwtBuilderUtil.java b/src/main/java/org/kohsuke/github/extras/authorization/JwtBuilderUtil.java new file mode 100644 index 0000000000..754b2f315c --- /dev/null +++ b/src/main/java/org/kohsuke/github/extras/authorization/JwtBuilderUtil.java @@ -0,0 +1,202 @@ +package org.kohsuke.github.extras.authorization; + +import io.jsonwebtoken.JwtBuilder; +import io.jsonwebtoken.Jwts; +import io.jsonwebtoken.io.Serializer; +import io.jsonwebtoken.jackson.io.JacksonSerializer; +import io.jsonwebtoken.security.SignatureAlgorithm; +import org.kohsuke.github.GHException; + +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.security.Key; +import java.security.PrivateKey; +import java.time.Instant; +import java.util.Date; +import java.util.logging.Logger; + +/** + * This is a util to build a JWT. + * + *

+ * This class is used to build a JWT using the jjwt library. It uses reflection to support older versions of jjwt. The + * class may be removed once we are sure we no longer need to support pre-0.12.x versions of jjwt. + *

+ */ +final class JwtBuilderUtil { + + private static final Logger LOGGER = Logger.getLogger(JwtBuilderUtil.class.getName()); + + private static IJwtBuilder builder; + + /** + * Build a JWT. + * + * @param issuedAt + * issued at + * @param expiration + * expiration + * @param applicationId + * application id + * @param privateKey + * private key + * @return JWT + */ + static String buildJwt(Instant issuedAt, Instant expiration, String applicationId, PrivateKey privateKey) { + if (builder == null) { + createBuilderImpl(issuedAt, expiration, applicationId, privateKey); + } + return builder.buildJwt(issuedAt, expiration, applicationId, privateKey); + } + + private static void createBuilderImpl(Instant issuedAt, + Instant expiration, + String applicationId, + PrivateKey privateKey) { + // Figure out which builder to use and cache it. We don't worry about thread safety here because we're fine if + // the builder is assigned multiple times. The end result will be the same. + try { + builder = new DefaultBuilderImpl(); + } catch (NoSuchMethodError | NoClassDefFoundError e) { + LOGGER.warning( + "You are using an outdated version of the io.jsonwebtoken:jjwt-* suite. v0.12.x or later is recommended."); + + try { + ReflectionBuilderImpl reflectionBuider = new ReflectionBuilderImpl(); + // Build a JWT to eagerly check for any reflection errors. + reflectionBuider.buildJwtWithReflection(issuedAt, expiration, applicationId, privateKey); + + builder = reflectionBuider; + } catch (ReflectiveOperationException re) { + throw new GHException( + "Could not build JWT using reflection on io.jsonwebtoken:jjwt-* suite." + + "The minimum supported version is v0.11.x, v0.12.x or later is recommended.", + re); + } + } + } + + /** + * IJwtBuilder interface to isolate loading of JWT classes allowing us to catch and handle linkage errors. + */ + interface IJwtBuilder { + /** + * Build a JWT. + * + * @param issuedAt + * issued at + * @param expiration + * expiration + * @param applicationId + * application id + * @param privateKey + * private key + * @return JWT + */ + String buildJwt(Instant issuedAt, Instant expiration, String applicationId, PrivateKey privateKey); + } + + /** + * A class to isolate loading of JWT classes allowing us to catch and handle linkage errors. + * + * Without this class, JwtBuilderUtil.buildJwt() immediately throws NoClassDefFoundError when called. With this + * class the error is thrown when DefaultBuilder.build() is called allowing us to catch and handle it. + */ + private static class DefaultBuilderImpl implements IJwtBuilder { + /** + * This method builds a JWT using 0.12.x or later versions of jjwt library + * + * @param issuedAt + * issued at + * @param expiration + * expiration + * @param applicationId + * application id + * @param privateKey + * private key + * @return JWT + */ + public String buildJwt(Instant issuedAt, Instant expiration, String applicationId, PrivateKey privateKey) { + + // io.jsonwebtoken.security.SignatureAlgorithm is not present in v0.11.x and below. + // Trying to call a method that uses it causes "NoClassDefFoundError" if v0.11.x is being used. + SignatureAlgorithm rs256 = Jwts.SIG.RS256; + + JwtBuilder jwtBuilder = Jwts.builder(); + jwtBuilder = jwtBuilder.issuedAt(Date.from(issuedAt)) + .expiration(Date.from(expiration)) + .issuer(applicationId) + .signWith(privateKey, rs256) + .json(new JacksonSerializer<>()); + return jwtBuilder.compact(); + } + } + + /** + * A class to encapsulate building a JWT using reflection. + */ + private static class ReflectionBuilderImpl implements IJwtBuilder { + + private Method setIssuedAtMethod; + private Method setExpirationMethod; + private Method setIssuerMethod; + private Enum rs256SignatureAlgorithm; + private Method signWithMethod; + private Method serializeToJsonMethod; + + ReflectionBuilderImpl() throws ReflectiveOperationException { + JwtBuilder jwtBuilder = Jwts.builder(); + Class jwtReflectionClass = jwtBuilder.getClass(); + + setIssuedAtMethod = jwtReflectionClass.getMethod("setIssuedAt", Date.class); + setIssuerMethod = jwtReflectionClass.getMethod("setIssuer", String.class); + setExpirationMethod = jwtReflectionClass.getMethod("setExpiration", Date.class); + Class signatureAlgorithmClass = Class.forName("io.jsonwebtoken.SignatureAlgorithm"); + rs256SignatureAlgorithm = createEnumInstance(signatureAlgorithmClass, "RS256"); + signWithMethod = jwtReflectionClass.getMethod("signWith", Key.class, signatureAlgorithmClass); + serializeToJsonMethod = jwtReflectionClass.getMethod("serializeToJsonWith", Serializer.class); + } + + /** + * This method builds a JWT using older (pre 0.12.x) versions of jjwt library by leveraging reflection. + * + * @param issuedAt + * issued at + * @param expiration + * expiration + * @param applicationId + * application id + * @param privateKey + * private key + * @return JWTBuilder + */ + public String buildJwt(Instant issuedAt, Instant expiration, String applicationId, PrivateKey privateKey) { + + try { + return buildJwtWithReflection(issuedAt, expiration, applicationId, privateKey); + } catch (ReflectiveOperationException e) { + // This should never happen. Reflection errors should have been caught during initialization. + throw new GHException("Reflection errors during JWT creation should have been checked already.", e); + } + } + + private String buildJwtWithReflection(Instant issuedAt, + Instant expiration, + String applicationId, + PrivateKey privateKey) throws IllegalAccessException, InvocationTargetException { + JwtBuilder jwtBuilder = Jwts.builder(); + Object builderObj = jwtBuilder; + builderObj = setIssuedAtMethod.invoke(builderObj, Date.from(issuedAt)); + builderObj = setExpirationMethod.invoke(builderObj, Date.from(expiration)); + builderObj = setIssuerMethod.invoke(builderObj, applicationId); + builderObj = signWithMethod.invoke(builderObj, privateKey, rs256SignatureAlgorithm); + builderObj = serializeToJsonMethod.invoke(builderObj, new JacksonSerializer<>()); + return ((JwtBuilder) builderObj).compact(); + } + + @SuppressWarnings("unchecked") + private static > T createEnumInstance(Class type, String name) { + return Enum.valueOf((Class) type, name); + } + } +} diff --git a/src/test/java/org/kohsuke/github/AbstractGitHubWireMockTest.java b/src/test/java/org/kohsuke/github/AbstractGitHubWireMockTest.java index 990583c945..044a7122ec 100644 --- a/src/test/java/org/kohsuke/github/AbstractGitHubWireMockTest.java +++ b/src/test/java/org/kohsuke/github/AbstractGitHubWireMockTest.java @@ -226,7 +226,7 @@ protected GHRepository getTempRepository() throws IOException { * Creates a temporary repository that will be deleted at the end of the test. * * @param name - * string name of the the repository + * string name of the repository * * @return a temporary repository * @throws IOException diff --git a/src/test/java/org/kohsuke/github/EnumTest.java b/src/test/java/org/kohsuke/github/EnumTest.java index 59cf1f4d44..939c6360e3 100644 --- a/src/test/java/org/kohsuke/github/EnumTest.java +++ b/src/test/java/org/kohsuke/github/EnumTest.java @@ -32,7 +32,7 @@ public void touchEnums() { assertThat(GHDirection.values().length, equalTo(2)); - assertThat(GHEvent.values().length, equalTo(64)); + assertThat(GHEvent.values().length, equalTo(65)); assertThat(GHEvent.ALL.symbol(), equalTo("*")); assertThat(GHEvent.PULL_REQUEST.symbol(), equalTo(GHEvent.PULL_REQUEST.toString().toLowerCase())); diff --git a/src/test/java/org/kohsuke/github/GHBranchProtectionTest.java b/src/test/java/org/kohsuke/github/GHBranchProtectionTest.java index 3624068ee5..5254b3a707 100755 --- a/src/test/java/org/kohsuke/github/GHBranchProtectionTest.java +++ b/src/test/java/org/kohsuke/github/GHBranchProtectionTest.java @@ -2,7 +2,14 @@ import org.junit.Before; import org.junit.Test; +import org.kohsuke.github.GHBranchProtection.AllowDeletions; +import org.kohsuke.github.GHBranchProtection.AllowForcePushes; +import org.kohsuke.github.GHBranchProtection.AllowForkSyncing; +import org.kohsuke.github.GHBranchProtection.BlockCreations; import org.kohsuke.github.GHBranchProtection.EnforceAdmins; +import org.kohsuke.github.GHBranchProtection.LockBranch; +import org.kohsuke.github.GHBranchProtection.RequiredConversationResolution; +import org.kohsuke.github.GHBranchProtection.RequiredLinearHistory; import org.kohsuke.github.GHBranchProtection.RequiredReviews; import org.kohsuke.github.GHBranchProtection.RequiredStatusChecks; @@ -45,9 +52,17 @@ public void testEnableBranchProtections() throws Exception { .addRequiredChecks("test-status-check") .requireBranchIsUpToDate() .requireCodeOwnReviews() + .requireLastPushApproval() .dismissStaleReviews() .requiredReviewers(2) + .allowDeletions() + .allowForcePushes() + .allowForkSyncing() + .blockCreations() .includeAdmins() + .lockBranch() + .requiredConversationResolution() + .requiredLinearHistory() .enable(); verifyBranchProtection(protection); @@ -67,11 +82,40 @@ private void verifyBranchProtection(GHBranchProtection protection) { assertThat(requiredReviews, notNullValue()); assertThat(requiredReviews.isDismissStaleReviews(), is(true)); assertThat(requiredReviews.isRequireCodeOwnerReviews(), is(true)); + assertThat(requiredReviews.isRequireLastPushApproval(), is(true)); assertThat(requiredReviews.getRequiredReviewers(), equalTo(2)); + AllowDeletions allowDeletions = protection.getAllowDeletions(); + assertThat(allowDeletions, notNullValue()); + assertThat(allowDeletions.isEnabled(), is(true)); + + AllowForcePushes allowForcePushes = protection.getAllowForcePushes(); + assertThat(allowForcePushes, notNullValue()); + assertThat(allowForcePushes.isEnabled(), is(true)); + + AllowForkSyncing allowForkSyncing = protection.getAllowForkSyncing(); + assertThat(allowForkSyncing, notNullValue()); + assertThat(allowForkSyncing.isEnabled(), is(true)); + + BlockCreations blockCreations = protection.getBlockCreations(); + assertThat(blockCreations, notNullValue()); + assertThat(blockCreations.isEnabled(), is(true)); + EnforceAdmins enforceAdmins = protection.getEnforceAdmins(); assertThat(enforceAdmins, notNullValue()); assertThat(enforceAdmins.isEnabled(), is(true)); + + LockBranch lockBranch = protection.getLockBranch(); + assertThat(lockBranch, notNullValue()); + assertThat(lockBranch.isEnabled(), is(true)); + + RequiredConversationResolution requiredConversationResolution = protection.getRequiredConversationResolution(); + assertThat(requiredConversationResolution, notNullValue()); + assertThat(requiredConversationResolution.isEnabled(), is(true)); + + RequiredLinearHistory requiredLinearHistory = protection.getRequiredLinearHistory(); + assertThat(requiredLinearHistory, notNullValue()); + assertThat(requiredLinearHistory.isEnabled(), is(true)); } /** diff --git a/src/test/java/org/kohsuke/github/GHRepositoryTest.java b/src/test/java/org/kohsuke/github/GHRepositoryTest.java index d0ff0f73e1..61ca35c9c8 100644 --- a/src/test/java/org/kohsuke/github/GHRepositoryTest.java +++ b/src/test/java/org/kohsuke/github/GHRepositoryTest.java @@ -98,6 +98,7 @@ public void testGetters() throws IOException { assertThat(r.isAllowMergeCommit(), is(true)); assertThat(r.isAllowRebaseMerge(), is(true)); assertThat(r.isAllowSquashMerge(), is(true)); + assertThat(r.isAllowForking(), is(false)); String httpTransport = "https://github.com/hub4j-test-org/temp-testGetters.git"; assertThat(r.getHttpTransportUrl(), equalTo(httpTransport)); @@ -380,6 +381,7 @@ public void testUpdateRepository() throws Exception { GHRepository updated = builder.allowRebaseMerge(false) .allowSquashMerge(false) .deleteBranchOnMerge(true) + .allowForking(true) .description(description) .downloads(false) .downloads(false) @@ -394,6 +396,7 @@ public void testUpdateRepository() throws Exception { assertThat(updated.isAllowRebaseMerge(), is(false)); assertThat(updated.isAllowSquashMerge(), is(false)); assertThat(updated.isDeleteBranchOnMerge(), is(true)); + assertThat(updated.isAllowForking(), is(true)); assertThat(updated.isPrivate(), is(true)); assertThat(updated.hasDownloads(), is(false)); assertThat(updated.hasIssues(), is(false)); diff --git a/src/test/java/org/kohsuke/github/GHVerificationReasonTest.java b/src/test/java/org/kohsuke/github/GHVerificationReasonTest.java index 73977ef1d4..42b3292c72 100644 --- a/src/test/java/org/kohsuke/github/GHVerificationReasonTest.java +++ b/src/test/java/org/kohsuke/github/GHVerificationReasonTest.java @@ -217,4 +217,88 @@ public void testValid() throws Exception { assertThat(commit.getCommitShortInfo().getVerification().getPayload(), notNullValue()); assertThat(commit.getCommitShortInfo().getVerification().getSignature(), notNullValue()); } + + /** + * Test bad cert. + * + * @throws Exception + * the exception + */ + @Test + public void testBadCert() throws Exception { + GHRepository r = gitHub.getRepository("hub4j/github-api"); + GHCommit commit = r.getCommit("86a2e245aa6d71d54923655066049d9e21a15f01"); + assertThat(commit.getCommitShortInfo().getAuthor().getName(), equalTo("Sourabh Parkala")); + assertThat(commit.getCommitShortInfo().getVerification().getSignature(), notNullValue()); + assertThat(commit.getCommitShortInfo().getVerification().isVerified(), is(false)); + assertThat(commit.getCommitShortInfo().getVerification().getReason(), equalTo(GHVerification.Reason.BAD_CERT)); + } + + /** + * Test malformed sig. + * + * @throws Exception + * the exception + */ + @Test + public void testMalformedSig() throws Exception { + GHRepository r = gitHub.getRepository("hub4j/github-api"); + GHCommit commit = r.getCommit("86a2e245aa6d71d54923655066049d9e21a15f01"); + assertThat(commit.getCommitShortInfo().getAuthor().getName(), equalTo("Sourabh Parkala")); + assertThat(commit.getCommitShortInfo().getVerification().getSignature(), notNullValue()); + assertThat(commit.getCommitShortInfo().getVerification().isVerified(), is(false)); + assertThat(commit.getCommitShortInfo().getVerification().getReason(), + equalTo(GHVerification.Reason.MALFORMED_SIG)); + } + + /** + * Test OSCP error. + * + * @throws Exception + * the exception + */ + @Test + public void testOcspError() throws Exception { + GHRepository r = gitHub.getRepository("hub4j/github-api"); + GHCommit commit = r.getCommit("86a2e245aa6d71d54923655066049d9e21a15f01"); + assertThat(commit.getCommitShortInfo().getAuthor().getName(), equalTo("Sourabh Parkala")); + assertThat(commit.getCommitShortInfo().getVerification().getSignature(), notNullValue()); + assertThat(commit.getCommitShortInfo().getVerification().isVerified(), is(false)); + assertThat(commit.getCommitShortInfo().getVerification().getReason(), + equalTo(GHVerification.Reason.OCSP_ERROR)); + } + + /** + * Test OSCP pending. + * + * @throws Exception + * the exception + */ + @Test + public void testOscpPending() throws Exception { + GHRepository r = gitHub.getRepository("hub4j/github-api"); + GHCommit commit = r.getCommit("86a2e245aa6d71d54923655066049d9e21a15f01"); + assertThat(commit.getCommitShortInfo().getAuthor().getName(), equalTo("Sourabh Parkala")); + assertThat(commit.getCommitShortInfo().getVerification().getSignature(), notNullValue()); + assertThat(commit.getCommitShortInfo().getVerification().isVerified(), is(false)); + assertThat(commit.getCommitShortInfo().getVerification().getReason(), + equalTo(GHVerification.Reason.OCSP_PENDING)); + } + + /** + * Test OCSP revoked. + * + * @throws Exception + * the exception + */ + @Test + public void testOscpRevoked() throws Exception { + GHRepository r = gitHub.getRepository("hub4j/github-api"); + GHCommit commit = r.getCommit("86a2e245aa6d71d54923655066049d9e21a15f01"); + assertThat(commit.getCommitShortInfo().getAuthor().getName(), equalTo("Sourabh Parkala")); + assertThat(commit.getCommitShortInfo().getVerification().getSignature(), notNullValue()); + assertThat(commit.getCommitShortInfo().getVerification().isVerified(), is(false)); + assertThat(commit.getCommitShortInfo().getVerification().getReason(), + equalTo(GHVerification.Reason.OCSP_REVOKED)); + } } diff --git a/src/test/java/org/kohsuke/github/WireMockStatusReporterTest.java b/src/test/java/org/kohsuke/github/WireMockStatusReporterTest.java index f2033f5ae2..07eab6a2f0 100644 --- a/src/test/java/org/kohsuke/github/WireMockStatusReporterTest.java +++ b/src/test/java/org/kohsuke/github/WireMockStatusReporterTest.java @@ -147,7 +147,7 @@ public void BasicBehaviors_whenProxying() throws Exception { assertThat(e, Matchers.instanceOf(GHFileNotFoundException.class)); assertThat(e.getMessage(), containsString( - "{\"message\":\"Not Found\",\"documentation_url\":\"https://docs.github.com/rest/reference/repos#get-a-repository\"}")); + "{\"message\":\"Not Found\",\"documentation_url\":\"https://docs.github.com/rest/repos/repos#get-a-repository\"}")); } /** diff --git a/src/test/resources/org/kohsuke/github/GHBranchProtectionTest/wiremock/testEnableBranchProtections/__files/repos_hub4j-test-org_temp-testenablebranchprotections_branches_main_protection-4.json b/src/test/resources/org/kohsuke/github/GHBranchProtectionTest/wiremock/testEnableBranchProtections/__files/repos_hub4j-test-org_temp-testenablebranchprotections_branches_main_protection-4.json index ee226bab75..a793b4cefa 100644 --- a/src/test/resources/org/kohsuke/github/GHBranchProtectionTest/wiremock/testEnableBranchProtections/__files/repos_hub4j-test-org_temp-testenablebranchprotections_branches_main_protection-4.json +++ b/src/test/resources/org/kohsuke/github/GHBranchProtectionTest/wiremock/testEnableBranchProtections/__files/repos_hub4j-test-org_temp-testenablebranchprotections_branches_main_protection-4.json @@ -12,19 +12,32 @@ "url": "https://api.github.com/repos/hub4j-test-org/temp-testEnableBranchProtections/branches/main/protection/required_pull_request_reviews", "dismiss_stale_reviews": true, "require_code_owner_reviews": true, - "required_approving_review_count": 2 + "required_approving_review_count": 2, + "require_last_push_approval": true + }, + "allow_deletions": { + "enabled": true + }, + "allow_force_pushes": { + "enabled": true + }, + "allow_fork_syncing": { + "enabled": true + }, + "block_creations": { + "enabled": true }, "enforce_admins": { "url": "https://api.github.com/repos/hub4j-test-org/temp-testEnableBranchProtections/branches/main/protection/enforce_admins", "enabled": true }, - "required_linear_history": { - "enabled": false + "lock_branch": { + "enabled": true }, - "allow_force_pushes": { - "enabled": false + "required_conversation_resolution": { + "enabled": true }, - "allow_deletions": { - "enabled": false + "required_linear_history": { + "enabled": true } -} \ No newline at end of file +} diff --git a/src/test/resources/org/kohsuke/github/GHBranchProtectionTest/wiremock/testEnableBranchProtections/__files/repos_hub4j-test-org_temp-testenablebranchprotections_branches_main_protection-5.json b/src/test/resources/org/kohsuke/github/GHBranchProtectionTest/wiremock/testEnableBranchProtections/__files/repos_hub4j-test-org_temp-testenablebranchprotections_branches_main_protection-5.json index ee226bab75..a793b4cefa 100644 --- a/src/test/resources/org/kohsuke/github/GHBranchProtectionTest/wiremock/testEnableBranchProtections/__files/repos_hub4j-test-org_temp-testenablebranchprotections_branches_main_protection-5.json +++ b/src/test/resources/org/kohsuke/github/GHBranchProtectionTest/wiremock/testEnableBranchProtections/__files/repos_hub4j-test-org_temp-testenablebranchprotections_branches_main_protection-5.json @@ -12,19 +12,32 @@ "url": "https://api.github.com/repos/hub4j-test-org/temp-testEnableBranchProtections/branches/main/protection/required_pull_request_reviews", "dismiss_stale_reviews": true, "require_code_owner_reviews": true, - "required_approving_review_count": 2 + "required_approving_review_count": 2, + "require_last_push_approval": true + }, + "allow_deletions": { + "enabled": true + }, + "allow_force_pushes": { + "enabled": true + }, + "allow_fork_syncing": { + "enabled": true + }, + "block_creations": { + "enabled": true }, "enforce_admins": { "url": "https://api.github.com/repos/hub4j-test-org/temp-testEnableBranchProtections/branches/main/protection/enforce_admins", "enabled": true }, - "required_linear_history": { - "enabled": false + "lock_branch": { + "enabled": true }, - "allow_force_pushes": { - "enabled": false + "required_conversation_resolution": { + "enabled": true }, - "allow_deletions": { - "enabled": false + "required_linear_history": { + "enabled": true } -} \ No newline at end of file +} diff --git a/src/test/resources/org/kohsuke/github/GHBranchProtectionTest/wiremock/testEnableBranchProtections/mappings/repos_hub4j-test-org_temp-testenablebranchprotections_branches_main_protection-4.json b/src/test/resources/org/kohsuke/github/GHBranchProtectionTest/wiremock/testEnableBranchProtections/mappings/repos_hub4j-test-org_temp-testenablebranchprotections_branches_main_protection-4.json index 31a205713a..3dfbbcf036 100644 --- a/src/test/resources/org/kohsuke/github/GHBranchProtectionTest/wiremock/testEnableBranchProtections/mappings/repos_hub4j-test-org_temp-testenablebranchprotections_branches_main_protection-4.json +++ b/src/test/resources/org/kohsuke/github/GHBranchProtectionTest/wiremock/testEnableBranchProtections/mappings/repos_hub4j-test-org_temp-testenablebranchprotections_branches_main_protection-4.json @@ -11,7 +11,7 @@ }, "bodyPatterns": [ { - "equalToJson": "{\"required_pull_request_reviews\":{\"required_approving_review_count\":2,\"require_code_owner_reviews\":true,\"dismiss_stale_reviews\":true},\"required_status_checks\":{\"contexts\":[\"test-status-check\"],\"strict\":true},\"restrictions\":null,\"enforce_admins\":true}", + "equalToJson": "{\"required_pull_request_reviews\":{\"required_approving_review_count\":2,\"require_code_owner_reviews\":true,\"dismiss_stale_reviews\":true,\"require_last_push_approval\":true},\"required_status_checks\":{\"contexts\":[\"test-status-check\"],\"strict\":true},\"restrictions\":null,\"allow_deletions\":true,\"allow_force_pushes\":true,\"allow_fork_syncing\":true,\"block_creations\":true,\"enforce_admins\":true,\"lock_branch\":true,\"required_conversation_resolution\":true,\"required_linear_history\":true}", "ignoreArrayOrder": true, "ignoreExtraElements": false } @@ -49,4 +49,4 @@ "uuid": "3cdd44cf-a62c-43f6-abad-de7c8b65bfe3", "persistent": true, "insertionIndex": 4 -} \ No newline at end of file +} diff --git a/src/test/resources/org/kohsuke/github/GHRepositoryTest/wiremock/testGetters/__files/repos_hub4j-test-org_temp-testgetters-2.json b/src/test/resources/org/kohsuke/github/GHRepositoryTest/wiremock/testGetters/__files/repos_hub4j-test-org_temp-testgetters-2.json index f8d16217fc..dac8e119fa 100644 --- a/src/test/resources/org/kohsuke/github/GHRepositoryTest/wiremock/testGetters/__files/repos_hub4j-test-org_temp-testgetters-2.json +++ b/src/test/resources/org/kohsuke/github/GHRepositoryTest/wiremock/testGetters/__files/repos_hub4j-test-org_temp-testgetters-2.json @@ -101,6 +101,7 @@ "allow_merge_commit": true, "allow_rebase_merge": true, "delete_branch_on_merge": false, + "allow_forking": false, "organization": { "login": "hub4j-test-org", "id": 7544739, @@ -123,4 +124,4 @@ }, "network_count": 0, "subscribers_count": 7 -} \ No newline at end of file +} diff --git a/src/test/resources/org/kohsuke/github/GHRepositoryTest/wiremock/testUpdateRepository/__files/repos_hub4j-test-org_temp-testupdaterepository-2.json b/src/test/resources/org/kohsuke/github/GHRepositoryTest/wiremock/testUpdateRepository/__files/repos_hub4j-test-org_temp-testupdaterepository-2.json index a6f5e84b2c..b35dc8ffd7 100644 --- a/src/test/resources/org/kohsuke/github/GHRepositoryTest/wiremock/testUpdateRepository/__files/repos_hub4j-test-org_temp-testupdaterepository-2.json +++ b/src/test/resources/org/kohsuke/github/GHRepositoryTest/wiremock/testUpdateRepository/__files/repos_hub4j-test-org_temp-testupdaterepository-2.json @@ -101,6 +101,7 @@ "allow_merge_commit": true, "allow_rebase_merge": true, "delete_branch_on_merge": false, + "allow_forking": false, "organization": { "login": "hub4j-test-org", "id": 7544739, @@ -123,4 +124,4 @@ }, "network_count": 0, "subscribers_count": 9 -} \ No newline at end of file +} diff --git a/src/test/resources/org/kohsuke/github/GHRepositoryTest/wiremock/testUpdateRepository/__files/repos_hub4j-test-org_temp-testupdaterepository-3.json b/src/test/resources/org/kohsuke/github/GHRepositoryTest/wiremock/testUpdateRepository/__files/repos_hub4j-test-org_temp-testupdaterepository-3.json index d62845bc50..ed4894e9e9 100644 --- a/src/test/resources/org/kohsuke/github/GHRepositoryTest/wiremock/testUpdateRepository/__files/repos_hub4j-test-org_temp-testupdaterepository-3.json +++ b/src/test/resources/org/kohsuke/github/GHRepositoryTest/wiremock/testUpdateRepository/__files/repos_hub4j-test-org_temp-testupdaterepository-3.json @@ -100,6 +100,7 @@ "allow_merge_commit": true, "allow_rebase_merge": false, "delete_branch_on_merge": true, + "allow_forking": true, "organization": { "login": "hub4j-test-org", "id": 7544739, @@ -122,4 +123,4 @@ }, "network_count": 0, "subscribers_count": 9 -} \ No newline at end of file +} diff --git a/src/test/resources/org/kohsuke/github/GHRepositoryTest/wiremock/testUpdateRepository/__files/repos_hub4j-test-org_temp-testupdaterepository-4.json b/src/test/resources/org/kohsuke/github/GHRepositoryTest/wiremock/testUpdateRepository/__files/repos_hub4j-test-org_temp-testupdaterepository-4.json index 8c2ad19854..8e4d6e85ba 100644 --- a/src/test/resources/org/kohsuke/github/GHRepositoryTest/wiremock/testUpdateRepository/__files/repos_hub4j-test-org_temp-testupdaterepository-4.json +++ b/src/test/resources/org/kohsuke/github/GHRepositoryTest/wiremock/testUpdateRepository/__files/repos_hub4j-test-org_temp-testupdaterepository-4.json @@ -100,6 +100,7 @@ "allow_merge_commit": false, "allow_rebase_merge": true, "delete_branch_on_merge": true, + "allow_forking": false, "organization": { "login": "hub4j-test-org", "id": 7544739, @@ -122,4 +123,4 @@ }, "network_count": 0, "subscribers_count": 9 -} \ No newline at end of file +} diff --git a/src/test/resources/org/kohsuke/github/GHRepositoryTest/wiremock/testUpdateRepository/__files/repos_hub4j-test-org_temp-testupdaterepository-5.json b/src/test/resources/org/kohsuke/github/GHRepositoryTest/wiremock/testUpdateRepository/__files/repos_hub4j-test-org_temp-testupdaterepository-5.json index 3ce310fccf..88ad46243c 100644 --- a/src/test/resources/org/kohsuke/github/GHRepositoryTest/wiremock/testUpdateRepository/__files/repos_hub4j-test-org_temp-testupdaterepository-5.json +++ b/src/test/resources/org/kohsuke/github/GHRepositoryTest/wiremock/testUpdateRepository/__files/repos_hub4j-test-org_temp-testupdaterepository-5.json @@ -100,6 +100,7 @@ "allow_merge_commit": false, "allow_rebase_merge": true, "delete_branch_on_merge": true, + "allow_forking": false, "organization": { "login": "hub4j-test-org", "id": 7544739, @@ -122,4 +123,4 @@ }, "network_count": 0, "subscribers_count": 9 -} \ No newline at end of file +} diff --git a/src/test/resources/org/kohsuke/github/GHRepositoryTest/wiremock/testUpdateRepository/mappings/repos_hub4j-test-org_temp-testupdaterepository-3.json b/src/test/resources/org/kohsuke/github/GHRepositoryTest/wiremock/testUpdateRepository/mappings/repos_hub4j-test-org_temp-testupdaterepository-3.json index 8596d7744c..38d758a008 100644 --- a/src/test/resources/org/kohsuke/github/GHRepositoryTest/wiremock/testUpdateRepository/mappings/repos_hub4j-test-org_temp-testupdaterepository-3.json +++ b/src/test/resources/org/kohsuke/github/GHRepositoryTest/wiremock/testUpdateRepository/mappings/repos_hub4j-test-org_temp-testupdaterepository-3.json @@ -11,7 +11,7 @@ }, "bodyPatterns": [ { - "equalToJson": "{\"name\":\"temp-testUpdateRepository\",\"has_projects\":false,\"allow_squash_merge\":false,\"private\":true,\"has_downloads\":false,\"has_wiki\":false,\"description\":\"A test repository for update testing via the github-api project\",\"delete_branch_on_merge\":true,\"allow_rebase_merge\":false,\"has_issues\":false,\"homepage\":\"https://github-api.kohsuke.org/apidocs/index.html\"}", + "equalToJson": "{\"name\":\"temp-testUpdateRepository\",\"has_projects\":false,\"allow_squash_merge\":false,\"allow_forking\":true,\"private\":true,\"has_downloads\":false,\"has_wiki\":false,\"description\":\"A test repository for update testing via the github-api project\",\"delete_branch_on_merge\":true,\"allow_rebase_merge\":false,\"has_issues\":false,\"homepage\":\"https://github-api.kohsuke.org/apidocs/index.html\"}", "ignoreArrayOrder": true, "ignoreExtraElements": false } @@ -51,4 +51,4 @@ "uuid": "d0036ebb-64a8-4c4c-bed3-697870892d5f", "persistent": true, "insertionIndex": 3 -} \ No newline at end of file +} diff --git a/src/test/resources/org/kohsuke/github/GHVerificationReasonTest/wiremock/testBadCert/__files/repos_hub4j_github-api-2.json b/src/test/resources/org/kohsuke/github/GHVerificationReasonTest/wiremock/testBadCert/__files/repos_hub4j_github-api-2.json new file mode 100644 index 0000000000..43ee270874 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHVerificationReasonTest/wiremock/testBadCert/__files/repos_hub4j_github-api-2.json @@ -0,0 +1,130 @@ +{ + "id": 617210, + "node_id": "MDEwOlJlcG9zaXRvcnk2MTcyMTA=", + "name": "github-api", + "full_name": "hub4j/github-api", + "private": false, + "owner": { + "login": "hub4j", + "id": 54909825, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjU0OTA5ODI1", + "avatar_url": "https://avatars3.githubusercontent.com/u/54909825?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/hub4j", + "html_url": "https://github.com/hub4j", + "followers_url": "https://api.github.com/users/hub4j/followers", + "following_url": "https://api.github.com/users/hub4j/following{/other_user}", + "gists_url": "https://api.github.com/users/hub4j/gists{/gist_id}", + "starred_url": "https://api.github.com/users/hub4j/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/hub4j/subscriptions", + "organizations_url": "https://api.github.com/users/hub4j/orgs", + "repos_url": "https://api.github.com/users/hub4j/repos", + "events_url": "https://api.github.com/users/hub4j/events{/privacy}", + "received_events_url": "https://api.github.com/users/hub4j/received_events", + "type": "Organization", + "site_admin": false + }, + "html_url": "https://github.com/hub4j/github-api", + "description": "Java API for GitHub", + "fork": false, + "url": "https://api.github.com/repos/hub4j/github-api", + "forks_url": "https://api.github.com/repos/hub4j/github-api/forks", + "keys_url": "https://api.github.com/repos/hub4j/github-api/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/hub4j/github-api/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/hub4j/github-api/teams", + "hooks_url": "https://api.github.com/repos/hub4j/github-api/hooks", + "issue_events_url": "https://api.github.com/repos/hub4j/github-api/issues/events{/number}", + "events_url": "https://api.github.com/repos/hub4j/github-api/events", + "assignees_url": "https://api.github.com/repos/hub4j/github-api/assignees{/user}", + "branches_url": "https://api.github.com/repos/hub4j/github-api/branches{/branch}", + "tags_url": "https://api.github.com/repos/hub4j/github-api/tags", + "blobs_url": "https://api.github.com/repos/hub4j/github-api/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/hub4j/github-api/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/hub4j/github-api/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/hub4j/github-api/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/hub4j/github-api/statuses/{sha}", + "languages_url": "https://api.github.com/repos/hub4j/github-api/languages", + "stargazers_url": "https://api.github.com/repos/hub4j/github-api/stargazers", + "contributors_url": "https://api.github.com/repos/hub4j/github-api/contributors", + "subscribers_url": "https://api.github.com/repos/hub4j/github-api/subscribers", + "subscription_url": "https://api.github.com/repos/hub4j/github-api/subscription", + "commits_url": "https://api.github.com/repos/hub4j/github-api/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/hub4j/github-api/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/hub4j/github-api/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/hub4j/github-api/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/hub4j/github-api/contents/{+path}", + "compare_url": "https://api.github.com/repos/hub4j/github-api/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/hub4j/github-api/merges", + "archive_url": "https://api.github.com/repos/hub4j/github-api/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/hub4j/github-api/downloads", + "issues_url": "https://api.github.com/repos/hub4j/github-api/issues{/number}", + "pulls_url": "https://api.github.com/repos/hub4j/github-api/pulls{/number}", + "milestones_url": "https://api.github.com/repos/hub4j/github-api/milestones{/number}", + "notifications_url": "https://api.github.com/repos/hub4j/github-api/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/hub4j/github-api/labels{/name}", + "releases_url": "https://api.github.com/repos/hub4j/github-api/releases{/id}", + "deployments_url": "https://api.github.com/repos/hub4j/github-api/deployments", + "created_at": "2010-04-19T04:13:03Z", + "updated_at": "2019-10-25T01:32:16Z", + "pushed_at": "2019-10-25T16:41:09Z", + "git_url": "git://github.com/hub4j/github-api.git", + "ssh_url": "git@github.com:hub4j/github-api.git", + "clone_url": "https://github.com/hub4j/github-api.git", + "svn_url": "https://github.com/hub4j/github-api", + "homepage": "http://github-api.kohsuke.org/", + "size": 13494, + "stargazers_count": 565, + "watchers_count": 565, + "language": "Java", + "has_issues": true, + "has_projects": true, + "has_downloads": true, + "has_wiki": true, + "has_pages": true, + "forks_count": 433, + "mirror_url": null, + "archived": false, + "disabled": false, + "open_issues_count": 64, + "license": { + "key": "mit", + "name": "MIT License", + "spdx_id": "MIT", + "url": "https://api.github.com/licenses/mit", + "node_id": "MDc6TGljZW5zZTEz" + }, + "forks": 433, + "open_issues": 64, + "watchers": 565, + "default_branch": "main", + "permissions": { + "admin": true, + "push": true, + "pull": true + }, + "allow_squash_merge": true, + "allow_merge_commit": true, + "allow_rebase_merge": true, + "organization": { + "login": "hub4j", + "id": 54909825, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjU0OTA5ODI1", + "avatar_url": "https://avatars3.githubusercontent.com/u/54909825?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/hub4j", + "html_url": "https://github.com/hub4j", + "followers_url": "https://api.github.com/users/hub4j/followers", + "following_url": "https://api.github.com/users/hub4j/following{/other_user}", + "gists_url": "https://api.github.com/users/hub4j/gists{/gist_id}", + "starred_url": "https://api.github.com/users/hub4j/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/hub4j/subscriptions", + "organizations_url": "https://api.github.com/users/hub4j/orgs", + "repos_url": "https://api.github.com/users/hub4j/repos", + "events_url": "https://api.github.com/users/hub4j/events{/privacy}", + "received_events_url": "https://api.github.com/users/hub4j/received_events", + "type": "Organization", + "site_admin": false + }, + "network_count": 433, + "subscribers_count": 48 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHVerificationReasonTest/wiremock/testBadCert/__files/repos_hub4j_github-api_commits_86a2e245aa6d71d54923655066049d9e21a15f01-3.json b/src/test/resources/org/kohsuke/github/GHVerificationReasonTest/wiremock/testBadCert/__files/repos_hub4j_github-api_commits_86a2e245aa6d71d54923655066049d9e21a15f01-3.json new file mode 100644 index 0000000000..77895afe2c --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHVerificationReasonTest/wiremock/testBadCert/__files/repos_hub4j_github-api_commits_86a2e245aa6d71d54923655066049d9e21a15f01-3.json @@ -0,0 +1,98 @@ +{ + "sha": "86a2e245aa6d71d54923655066049d9e21a15f01", + "node_id": "MDY6Q29tbWl0NjE3MjEwOjg2YTJlMjQ1YWE2ZDcxZDU0OTIzNjU1MDY2MDQ5ZDllMjFhMTVmMjM=", + "commit": { + "author": { + "name": "Sourabh Parkala", + "email": "sourabh.sarvotham.parkala@sap.com", + "date": "2010-04-19T04:12:41Z" + }, + "committer": { + "name": "Sourabh Parkala", + "email": "sourabh.sarvotham.parkala@sap.com", + "date": "2010-04-19T04:12:41Z" + }, + "message": "doc", + "tree": { + "sha": "17ed4173aeb2e98c93216e8b6e16138dc7f8cd91", + "url": "https://api.github.com/repos/hub4j/github-api/git/trees/17ed4173aeb2e98c93216e8b6e16138dc7f8cd91" + }, + "url": "https://api.github.com/repos/hub4j/github-api/git/commits/86a2e245aa6d71d54923655066049d9e21a15f01", + "comment_count": 0, + "verification": { + "verified": false, + "reason": "bad_cert", + "signature": "-----BEGIN SIGNED MESSAGE-----\nMIIFdQYJKoZIhvcNAQcCoIIFZjCCBWICAQExDTALBglghkgBZQMEAgEwCwYJKoZI\nhvcNAQcBoIIDejCCA3YwggJeoAMCAQICAQIwDQYJKoZIhvcNAQELBQAwKjEbMBkG\nA1UEAwwSQXN0cm9UbGFsb2PigJlzIENBMQswCQYDVQQGEwJVUzAeFw0yMzA5MTgy\nMzI2MDlaFw0yNDA5MTcyMzI2MDlaMEYxFDASBgNVBAMMC0FzdHJvVGxhbG9jMQsw\nCQYDVQQGEwJVUzEhMB8GCSqGSIb3DQEJARYSMHhUbGFsb2NAZ21haWwuY29tMIIB\nIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA+Zq+N5v68htABs4ZLPORns/F\nzixnI+6L+WaVGeQFzxIBs9zsm9IRGJ4xoMBPSg1BuoilRXzsQoCH6+5zyQ4jaHMa\nHBBEijVM7kor3Um+35KdYh79nIY7ZQoDRypLF02FiqfNjhN8Nm8ciNf2EUkiGIcj\n/+TPhVFMxnwlZ2SmSJoMBE5pkDBllb/8kfxgenSoVLXaOigYJ1It6AqH2L8Ju9pa\nJ1zJGu2edjN6xi/0yjzZ7CmPFbnWcY5flJfMqdaj0Po3dMwYKYK07rE7KQHc8wFT\ngAUtQNtJkGBjEcTBh1B7SUsnJ/x4XcSQwOMxPNSm4Esn2RWanJYunez75eCWlwID\nAQABo4GKMIGHMA4GA1UdDwEB/wQEAwIFoDAWBgNVHSUBAf8EDDAKBggrBgEFBQcD\nBDAdBgNVHQ4EFgQUSi5d7oqzSYNhpeG4I2VNF9j881UwHwYDVR0jBBgwFoAULCWl\nbibBiKOX/6M3RWgIlSPM7dcwHQYDVR0RBBYwFIESMHhUbGFsb2NAZ21haWwuY29t\nMA0GCSqGSIb3DQEBCwUAA4IBAQDSn3caORjlSXCSm8ZY1uAbG+IngvEooIJvbl+y\n0yglPA3pkWybXxLfvayJVRGtNgLambnPpulzZmdwjj7qSTzd9K/+OIsI2qjNrZZ+\napXJLhlfabNHzydj0y0DUWgbtKzQ1SVhWgglHaCp440UmVAi0PtsMy3F1S5S0HlZ\n80V1CE3r7UYsC64GG3CmyXVf5MB+pzPriE729Gglig5z6rq8F+GNk5hJW7tOKBRb\nCyXFkqbkMWHPJ/CP5wrFjrEITsn8fIhlJsYRIAGzTnffCOs9i3rMpUTXRBOwSVMB\nI1I3VPm+WxVE7O9NY7TGBDe7010D4DorTNUPYo8xsPtKYyrpMYIBwTCCAb0CAQEw\nLzAqMRswGQYDVQQDDBJBc3Ryb1RsYWxvY+KAmXMgQ0ExCzAJBgNVBAYTAlVTAgEC\nMAsGCWCGSAFlAwQCAaBpMBgGCSqGSIb3DQEJAzELBgkqhkiG9w0BBwEwHAYJKoZI\nhvcNAQkFMQ8XDTIzMDkxODIzMjg1MFowLwYJKoZIhvcNAQkEMSIEIIFHI8Ick3Tu\nBlnfTU6v24ls8D+jGkpQoDK+MF4rk5iTMAsGCSqGSIb3DQEBCwSCAQC4nIUEB/bR\ngeXnO7KdtqRFn/slCNTKZaQObsyL7C7cmNYAlgQAYj/qOBhKGMd3ZAFHRUroCiCy\n5GPs1sEnPKT1Bh7E7HJbpfdMXZINxoiRBrwQpAD/UKxk6etF5qvtAwDJaFMZiTMh\nd6tPNVBcThhUglSqqQFT3BKE9z5KTGwonMeqZlyf/EpXRBn0YcaoWvcAzaahMBQw\nUPwwEtU3FVyYBbLQee0SoYDsddEjdaNN/37auMVIltYmKNq/A4KhJWduTGFcaD/k\nfcXIzhzBi4vk1No6y2ftDgbivxP3MVQyf1tIfD1fv9cw/55JnDRA3IXkQRc+yyUG\nGmHXpKHhqNKm\n-----END SIGNED MESSAGE-----", + "payload": null + } + }, + "url": "https://api.github.com/repos/hub4j/github-api/commits/86a2e245aa6d71d54923655066049d9e21a15f01", + "html_url": "https://github.com/hub4j/github-api/commit/86a2e245aa6d71d54923655066049d9e21a15f01", + "comments_url": "https://api.github.com/repos/hub4j/github-api/commits/86a2e245aa6d71d54923655066049d9e21a15f01/comments", + "author": { + "login": "kohsuke", + "id": 50003, + "node_id": "MDQ6VXNlcjUwMDAz", + "avatar_url": "https://avatars1.githubusercontent.com/u/50003?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/kohsuke", + "html_url": "https://github.com/kohsuke", + "followers_url": "https://api.github.com/users/kohsuke/followers", + "following_url": "https://api.github.com/users/kohsuke/following{/other_user}", + "gists_url": "https://api.github.com/users/kohsuke/gists{/gist_id}", + "starred_url": "https://api.github.com/users/kohsuke/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/kohsuke/subscriptions", + "organizations_url": "https://api.github.com/users/kohsuke/orgs", + "repos_url": "https://api.github.com/users/kohsuke/repos", + "events_url": "https://api.github.com/users/kohsuke/events{/privacy}", + "received_events_url": "https://api.github.com/users/kohsuke/received_events", + "type": "User", + "site_admin": false + }, + "committer": { + "login": "kohsuke", + "id": 50003, + "node_id": "MDQ6VXNlcjUwMDAz", + "avatar_url": "https://avatars1.githubusercontent.com/u/50003?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/kohsuke", + "html_url": "https://github.com/kohsuke", + "followers_url": "https://api.github.com/users/kohsuke/followers", + "following_url": "https://api.github.com/users/kohsuke/following{/other_user}", + "gists_url": "https://api.github.com/users/kohsuke/gists{/gist_id}", + "starred_url": "https://api.github.com/users/kohsuke/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/kohsuke/subscriptions", + "organizations_url": "https://api.github.com/users/kohsuke/orgs", + "repos_url": "https://api.github.com/users/kohsuke/repos", + "events_url": "https://api.github.com/users/kohsuke/events{/privacy}", + "received_events_url": "https://api.github.com/users/kohsuke/received_events", + "type": "User", + "site_admin": false + }, + "parents": [ + { + "sha": "ecbfdd7315ef2cf04b2be7f11a072ce0bd00c396", + "url": "https://api.github.com/repos/hub4j/github-api/commits/ecbfdd7315ef2cf04b2be7f11a072ce0bd00c396", + "html_url": "https://github.com/hub4j/github-api/commit/ecbfdd7315ef2cf04b2be7f11a072ce0bd00c396" + } + ], + "stats": { + "total": 3, + "additions": 3, + "deletions": 0 + }, + "files": [ + { + "sha": "2a2e1f77fd77bd03273946d893d25a455f696be0", + "filename": "README", + "status": "added", + "additions": 3, + "deletions": 0, + "changes": 3, + "blob_url": "https://github.com/hub4j/github-api/blob/86a2e245aa6d71d54923655066049d9e21a15f01/README", + "raw_url": "https://github.com/hub4j/github-api/raw/86a2e245aa6d71d54923655066049d9e21a15f01/README", + "contents_url": "https://api.github.com/repos/hub4j/github-api/contents/README?ref=86a2e245aa6d71d54923655066049d9e21a15f01", + "patch": "@@ -0,0 +1,3 @@\n+Java API for GitHub\n+\n+See http://kohsuke.org/github-api/ for more details" + } + ] +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHVerificationReasonTest/wiremock/testBadCert/__files/user-1.json b/src/test/resources/org/kohsuke/github/GHVerificationReasonTest/wiremock/testBadCert/__files/user-1.json new file mode 100644 index 0000000000..a4b576e8a7 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHVerificationReasonTest/wiremock/testBadCert/__files/user-1.json @@ -0,0 +1,45 @@ +{ + "login": "bitwiseman", + "id": 1958953, + "node_id": "MDQ6VXNlcjE5NTg5NTM=", + "avatar_url": "https://avatars3.githubusercontent.com/u/1958953?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/bitwiseman", + "html_url": "https://github.com/bitwiseman", + "followers_url": "https://api.github.com/users/bitwiseman/followers", + "following_url": "https://api.github.com/users/bitwiseman/following{/other_user}", + "gists_url": "https://api.github.com/users/bitwiseman/gists{/gist_id}", + "starred_url": "https://api.github.com/users/bitwiseman/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/bitwiseman/subscriptions", + "organizations_url": "https://api.github.com/users/bitwiseman/orgs", + "repos_url": "https://api.github.com/users/bitwiseman/repos", + "events_url": "https://api.github.com/users/bitwiseman/events{/privacy}", + "received_events_url": "https://api.github.com/users/bitwiseman/received_events", + "type": "User", + "site_admin": false, + "name": "Liam Newman", + "company": "Cloudbees, Inc.", + "blog": "", + "location": "Seattle, WA, USA", + "email": "bitwiseman@gmail.com", + "hireable": null, + "bio": "https://twitter.com/bitwiseman", + "public_repos": 169, + "public_gists": 7, + "followers": 139, + "following": 9, + "created_at": "2012-07-11T20:38:33Z", + "updated_at": "2019-09-24T19:32:29Z", + "private_gists": 7, + "total_private_repos": 9, + "owned_private_repos": 0, + "disk_usage": 33697, + "collaborators": 0, + "two_factor_authentication": true, + "plan": { + "name": "free", + "space": 976562499, + "collaborators": 0, + "private_repos": 10000 + } +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHVerificationReasonTest/wiremock/testBadCert/mappings/repos_hub4j_github-api-2.json b/src/test/resources/org/kohsuke/github/GHVerificationReasonTest/wiremock/testBadCert/mappings/repos_hub4j_github-api-2.json new file mode 100644 index 0000000000..80fb7dfa4e --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHVerificationReasonTest/wiremock/testBadCert/mappings/repos_hub4j_github-api-2.json @@ -0,0 +1,48 @@ +{ + "id": "441cdfd7-a44a-42b4-b732-57e674227760", + "name": "repos_hub4j_github-api", + "request": { + "url": "/repos/hub4j/github-api", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "application/vnd.github.v3+json" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "repos_hub4j_github-api-2.json", + "headers": { + "Date": "Sat, 26 Oct 2019 01:28:40 GMT", + "Content-Type": "application/json; charset=utf-8", + "Server": "GitHub.com", + "Status": "200 OK", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4295", + "X-RateLimit-Reset": "1572055286", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": [ + "Accept, Authorization, Cookie, X-GitHub-OTP", + "Accept-Encoding" + ], + "ETag": "W/\"c1a01d01a6354d93b3cc6098e0b2d047\"", + "Last-Modified": "Fri, 25 Oct 2019 01:32:16 GMT", + "X-OAuth-Scopes": "admin:org, admin:org_hook, admin:public_key, admin:repo_hook, delete_repo, gist, notifications, repo, user, write:discussion", + "X-Accepted-OAuth-Scopes": "repo", + "X-GitHub-Media-Type": "unknown, github.v3", + "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type", + "Access-Control-Allow-Origin": "*", + "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", + "X-Frame-Options": "deny", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "1; mode=block", + "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", + "Content-Security-Policy": "default-src 'none'", + "X-GitHub-Request-Id": "CB01:05A2:A65B56:C4A050:5DB3A147" + } + }, + "uuid": "441cdfd7-a44a-42b4-b732-57e674227760", + "persistent": true, + "insertionIndex": 2 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHVerificationReasonTest/wiremock/testBadCert/mappings/repos_hub4j_github-api_commits_86a2e245aa6d71d54923655066049d9e21a15f01-3.json b/src/test/resources/org/kohsuke/github/GHVerificationReasonTest/wiremock/testBadCert/mappings/repos_hub4j_github-api_commits_86a2e245aa6d71d54923655066049d9e21a15f01-3.json new file mode 100644 index 0000000000..6b5904361c --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHVerificationReasonTest/wiremock/testBadCert/mappings/repos_hub4j_github-api_commits_86a2e245aa6d71d54923655066049d9e21a15f01-3.json @@ -0,0 +1,48 @@ +{ + "id": "d76abea9-c1be-430a-bbd0-28931c58e1e8", + "name": "repos_hub4j_github-api_commits_86a2e245aa6d71d54923655066049d9e21a15f01", + "request": { + "url": "/repos/hub4j/github-api/commits/86a2e245aa6d71d54923655066049d9e21a15f01", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "application/vnd.github.v3+json" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "repos_hub4j_github-api_commits_86a2e245aa6d71d54923655066049d9e21a15f01-3.json", + "headers": { + "Date": "Sat, 26 Oct 2019 01:28:40 GMT", + "Content-Type": "application/json; charset=utf-8", + "Server": "GitHub.com", + "Status": "200 OK", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4294", + "X-RateLimit-Reset": "1572055286", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": [ + "Accept, Authorization, Cookie, X-GitHub-OTP", + "Accept-Encoding" + ], + "ETag": "W/\"0a8c453e4290ce879ea09578e06a5961\"", + "Last-Modified": "Mon, 19 Apr 2010 04:12:41 GMT", + "X-OAuth-Scopes": "admin:org, admin:org_hook, admin:public_key, admin:repo_hook, delete_repo, gist, notifications, repo, user, write:discussion", + "X-Accepted-OAuth-Scopes": "", + "X-GitHub-Media-Type": "unknown, github.v3", + "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type", + "Access-Control-Allow-Origin": "*", + "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", + "X-Frame-Options": "deny", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "1; mode=block", + "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", + "Content-Security-Policy": "default-src 'none'", + "X-GitHub-Request-Id": "CB01:05A2:A65B5F:C4A064:5DB3A148" + } + }, + "uuid": "d76abea9-c1be-430a-bbd0-28931c58e1e8", + "persistent": true, + "insertionIndex": 3 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHVerificationReasonTest/wiremock/testBadCert/mappings/user-1.json b/src/test/resources/org/kohsuke/github/GHVerificationReasonTest/wiremock/testBadCert/mappings/user-1.json new file mode 100644 index 0000000000..7c0606ff2f --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHVerificationReasonTest/wiremock/testBadCert/mappings/user-1.json @@ -0,0 +1,48 @@ +{ + "id": "c247f81b-84b8-44e9-820a-0a91dc74ce98", + "name": "user", + "request": { + "url": "/user", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "application/vnd.github.v3+json" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "user-1.json", + "headers": { + "Date": "Sat, 26 Oct 2019 01:28:39 GMT", + "Content-Type": "application/json; charset=utf-8", + "Server": "GitHub.com", + "Status": "200 OK", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4297", + "X-RateLimit-Reset": "1572055286", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": [ + "Accept, Authorization, Cookie, X-GitHub-OTP", + "Accept-Encoding" + ], + "ETag": "W/\"8c3d3dcf6fc5f9edaf26c902295396e5\"", + "Last-Modified": "Tue, 24 Sep 2019 19:32:29 GMT", + "X-OAuth-Scopes": "admin:org, admin:org_hook, admin:public_key, admin:repo_hook, delete_repo, gist, notifications, repo, user, write:discussion", + "X-Accepted-OAuth-Scopes": "", + "X-GitHub-Media-Type": "unknown, github.v3", + "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type", + "Access-Control-Allow-Origin": "*", + "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", + "X-Frame-Options": "deny", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "1; mode=block", + "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", + "Content-Security-Policy": "default-src 'none'", + "X-GitHub-Request-Id": "CB01:05A2:A65B49:C4A046:5DB3A147" + } + }, + "uuid": "c247f81b-84b8-44e9-820a-0a91dc74ce98", + "persistent": true, + "insertionIndex": 1 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHVerificationReasonTest/wiremock/testMalformedSig/__files/repos_hub4j_github-api-2.json b/src/test/resources/org/kohsuke/github/GHVerificationReasonTest/wiremock/testMalformedSig/__files/repos_hub4j_github-api-2.json new file mode 100644 index 0000000000..43ee270874 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHVerificationReasonTest/wiremock/testMalformedSig/__files/repos_hub4j_github-api-2.json @@ -0,0 +1,130 @@ +{ + "id": 617210, + "node_id": "MDEwOlJlcG9zaXRvcnk2MTcyMTA=", + "name": "github-api", + "full_name": "hub4j/github-api", + "private": false, + "owner": { + "login": "hub4j", + "id": 54909825, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjU0OTA5ODI1", + "avatar_url": "https://avatars3.githubusercontent.com/u/54909825?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/hub4j", + "html_url": "https://github.com/hub4j", + "followers_url": "https://api.github.com/users/hub4j/followers", + "following_url": "https://api.github.com/users/hub4j/following{/other_user}", + "gists_url": "https://api.github.com/users/hub4j/gists{/gist_id}", + "starred_url": "https://api.github.com/users/hub4j/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/hub4j/subscriptions", + "organizations_url": "https://api.github.com/users/hub4j/orgs", + "repos_url": "https://api.github.com/users/hub4j/repos", + "events_url": "https://api.github.com/users/hub4j/events{/privacy}", + "received_events_url": "https://api.github.com/users/hub4j/received_events", + "type": "Organization", + "site_admin": false + }, + "html_url": "https://github.com/hub4j/github-api", + "description": "Java API for GitHub", + "fork": false, + "url": "https://api.github.com/repos/hub4j/github-api", + "forks_url": "https://api.github.com/repos/hub4j/github-api/forks", + "keys_url": "https://api.github.com/repos/hub4j/github-api/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/hub4j/github-api/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/hub4j/github-api/teams", + "hooks_url": "https://api.github.com/repos/hub4j/github-api/hooks", + "issue_events_url": "https://api.github.com/repos/hub4j/github-api/issues/events{/number}", + "events_url": "https://api.github.com/repos/hub4j/github-api/events", + "assignees_url": "https://api.github.com/repos/hub4j/github-api/assignees{/user}", + "branches_url": "https://api.github.com/repos/hub4j/github-api/branches{/branch}", + "tags_url": "https://api.github.com/repos/hub4j/github-api/tags", + "blobs_url": "https://api.github.com/repos/hub4j/github-api/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/hub4j/github-api/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/hub4j/github-api/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/hub4j/github-api/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/hub4j/github-api/statuses/{sha}", + "languages_url": "https://api.github.com/repos/hub4j/github-api/languages", + "stargazers_url": "https://api.github.com/repos/hub4j/github-api/stargazers", + "contributors_url": "https://api.github.com/repos/hub4j/github-api/contributors", + "subscribers_url": "https://api.github.com/repos/hub4j/github-api/subscribers", + "subscription_url": "https://api.github.com/repos/hub4j/github-api/subscription", + "commits_url": "https://api.github.com/repos/hub4j/github-api/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/hub4j/github-api/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/hub4j/github-api/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/hub4j/github-api/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/hub4j/github-api/contents/{+path}", + "compare_url": "https://api.github.com/repos/hub4j/github-api/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/hub4j/github-api/merges", + "archive_url": "https://api.github.com/repos/hub4j/github-api/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/hub4j/github-api/downloads", + "issues_url": "https://api.github.com/repos/hub4j/github-api/issues{/number}", + "pulls_url": "https://api.github.com/repos/hub4j/github-api/pulls{/number}", + "milestones_url": "https://api.github.com/repos/hub4j/github-api/milestones{/number}", + "notifications_url": "https://api.github.com/repos/hub4j/github-api/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/hub4j/github-api/labels{/name}", + "releases_url": "https://api.github.com/repos/hub4j/github-api/releases{/id}", + "deployments_url": "https://api.github.com/repos/hub4j/github-api/deployments", + "created_at": "2010-04-19T04:13:03Z", + "updated_at": "2019-10-25T01:32:16Z", + "pushed_at": "2019-10-25T16:41:09Z", + "git_url": "git://github.com/hub4j/github-api.git", + "ssh_url": "git@github.com:hub4j/github-api.git", + "clone_url": "https://github.com/hub4j/github-api.git", + "svn_url": "https://github.com/hub4j/github-api", + "homepage": "http://github-api.kohsuke.org/", + "size": 13494, + "stargazers_count": 565, + "watchers_count": 565, + "language": "Java", + "has_issues": true, + "has_projects": true, + "has_downloads": true, + "has_wiki": true, + "has_pages": true, + "forks_count": 433, + "mirror_url": null, + "archived": false, + "disabled": false, + "open_issues_count": 64, + "license": { + "key": "mit", + "name": "MIT License", + "spdx_id": "MIT", + "url": "https://api.github.com/licenses/mit", + "node_id": "MDc6TGljZW5zZTEz" + }, + "forks": 433, + "open_issues": 64, + "watchers": 565, + "default_branch": "main", + "permissions": { + "admin": true, + "push": true, + "pull": true + }, + "allow_squash_merge": true, + "allow_merge_commit": true, + "allow_rebase_merge": true, + "organization": { + "login": "hub4j", + "id": 54909825, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjU0OTA5ODI1", + "avatar_url": "https://avatars3.githubusercontent.com/u/54909825?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/hub4j", + "html_url": "https://github.com/hub4j", + "followers_url": "https://api.github.com/users/hub4j/followers", + "following_url": "https://api.github.com/users/hub4j/following{/other_user}", + "gists_url": "https://api.github.com/users/hub4j/gists{/gist_id}", + "starred_url": "https://api.github.com/users/hub4j/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/hub4j/subscriptions", + "organizations_url": "https://api.github.com/users/hub4j/orgs", + "repos_url": "https://api.github.com/users/hub4j/repos", + "events_url": "https://api.github.com/users/hub4j/events{/privacy}", + "received_events_url": "https://api.github.com/users/hub4j/received_events", + "type": "Organization", + "site_admin": false + }, + "network_count": 433, + "subscribers_count": 48 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHVerificationReasonTest/wiremock/testMalformedSig/__files/repos_hub4j_github-api_commits_86a2e245aa6d71d54923655066049d9e21a15f01-3.json b/src/test/resources/org/kohsuke/github/GHVerificationReasonTest/wiremock/testMalformedSig/__files/repos_hub4j_github-api_commits_86a2e245aa6d71d54923655066049d9e21a15f01-3.json new file mode 100644 index 0000000000..8ec18c631d --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHVerificationReasonTest/wiremock/testMalformedSig/__files/repos_hub4j_github-api_commits_86a2e245aa6d71d54923655066049d9e21a15f01-3.json @@ -0,0 +1,98 @@ +{ + "sha": "86a2e245aa6d71d54923655066049d9e21a15f01", + "node_id": "MDY6Q29tbWl0NjE3MjEwOjg2YTJlMjQ1YWE2ZDcxZDU0OTIzNjU1MDY2MDQ5ZDllMjFhMTVmMjM=", + "commit": { + "author": { + "name": "Sourabh Parkala", + "email": "sourabh.sarvotham.parkala@sap.com", + "date": "2010-04-19T04:12:41Z" + }, + "committer": { + "name": "Sourabh Parkala", + "email": "sourabh.sarvotham.parkala@sap.com", + "date": "2010-04-19T04:12:41Z" + }, + "message": "doc", + "tree": { + "sha": "17ed4173aeb2e98c93216e8b6e16138dc7f8cd91", + "url": "https://api.github.com/repos/hub4j/github-api/git/trees/17ed4173aeb2e98c93216e8b6e16138dc7f8cd91" + }, + "url": "https://api.github.com/repos/hub4j/github-api/git/commits/86a2e245aa6d71d54923655066049d9e21a15f01", + "comment_count": 0, + "verification": { + "verified": false, + "reason": "malformed_sig", + "signature": "-----BEGIN SIGNED MESSAGE-----\nMIIFdQYJKoZIhvcNAQcCoIIFZjCCBWICAQExDTALBglghkgBZQMEAgEwCwYJKoZI\nhvcNAQcBoIIDejCCA3YwggJeoAMCAQICAQIwDQYJKoZIhvcNAQELBQAwKjEbMBkG\nA1UEAwwSQXN0cm9UbGFsb2PigJlzIENBMQswCQYDVQQGEwJVUzAeFw0yMzA5MTgy\nMzI2MDlaFw0yNDA5MTcyMzI2MDlaMEYxFDASBgNVBAMMC0FzdHJvVGxhbG9jMQsw\nCQYDVQQGEwJVUzEhMB8GCSqGSIb3DQEJARYSMHhUbGFsb2NAZ21haWwuY29tMIIB\nIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA+Zq+N5v68htABs4ZLPORns/F\nzixnI+6L+WaVGeQFzxIBs9zsm9IRGJ4xoMBPSg1BuoilRXzsQoCH6+5zyQ4jaHMa\nHBBEijVM7kor3Um+35KdYh79nIY7ZQoDRypLF02FiqfNjhN8Nm8ciNf2EUkiGIcj\n/+TPhVFMxnwlZ2SmSJoMBE5pkDBllb/8kfxgenSoVLXaOigYJ1It6AqH2L8Ju9pa\nJ1zJGu2edjN6xi/0yjzZ7CmPFbnWcY5flJfMqdaj0Po3dMwYKYK07rE7KQHc8wFT\ngAUtQNtJkGBjEcTBh1B7SUsnJ/x4XcSQwOMxPNSm4Esn2RWanJYunez75eCWlwID\nAQABo4GKMIGHMA4GA1UdDwEB/wQEAwIFoDAWBgNVHSUBAf8EDDAKBggrBgEFBQcD\nBDAdBgNVHQ4EFgQUSi5d7oqzSYNhpeG4I2VNF9j881UwHwYDVR0jBBgwFoAULCWl\nbibBiKOX/6M3RWgIlSPM7dcwHQYDVR0RBBYwFIESMHhUbGFsb2NAZ21haWwuY29t\nMA0GCSqGSIb3DQEBCwUAA4IBAQDSn3caORjlSXCSm8ZY1uAbG+IngvEooIJvbl+y\n0yglPA3pkWybXxLfvayJVRGtNgLambnPpulzZmdwjj7qSTzd9K/+OIsI2qjNrZZ+\napXJLhlfabNHzydj0y0DUWgbtKzQ1SVhWgglHaCp440UmVAi0PtsMy3F1S5S0HlZ\n80V1CE3r7UYsC64GG3CmyXVf5MB+pzPriE729Gglig5z6rq8F+GNk5hJW7tOKBRb\nCyXFkqbkMWHPJ/CP5wrFjrEITsn8fIhlJsYRIAGzTnffCOs9i3rMpUTXRBOwSVMB\nI1I3VPm+WxVE7O9NY7TGBDe7010D4DorTNUPYo8xsPtKYyrpMYIBwTCCAb0CAQEw\nLzAqMRswGQYDVQQDDBJBc3Ryb1RsYWxvY+KAmXMgQ0ExCzAJBgNVBAYTAlVTAgEC\nMAsGCWCGSAFlAwQCAaBpMBgGCSqGSIb3DQEJAzELBgkqhkiG9w0BBwEwHAYJKoZI\nhvcNAQkFMQ8XDTIzMDkxODIzMjg1MFowLwYJKoZIhvcNAQkEMSIEIIFHI8Ick3Tu\nBlnfTU6v24ls8D+jGkpQoDK+MF4rk5iTMAsGCSqGSIb3DQEBCwSCAQC4nIUEB/bR\ngeXnO7KdtqRFn/slCNTKZaQObsyL7C7cmNYAlgQAYj/qOBhKGMd3ZAFHRUroCiCy\n5GPs1sEnPKT1Bh7E7HJbpfdMXZINxoiRBrwQpAD/UKxk6etF5qvtAwDJaFMZiTMh\nd6tPNVBcThhUglSqqQFT3BKE9z5KTGwonMeqZlyf/EpXRBn0YcaoWvcAzaahMBQw\nUPwwEtU3FVyYBbLQee0SoYDsddEjdaNN/37auMVIltYmKNq/A4KhJWduTGFcaD/k\nfcXIzhzBi4vk1No6y2ftDgbivxP3MVQyf1tIfD1fv9cw/55JnDRA3IXkQRc+yyUG\nGmHXpKHhqNKm\n-----END SIGNED MESSAGE-----", + "payload": null + } + }, + "url": "https://api.github.com/repos/hub4j/github-api/commits/86a2e245aa6d71d54923655066049d9e21a15f01", + "html_url": "https://github.com/hub4j/github-api/commit/86a2e245aa6d71d54923655066049d9e21a15f01", + "comments_url": "https://api.github.com/repos/hub4j/github-api/commits/86a2e245aa6d71d54923655066049d9e21a15f01/comments", + "author": { + "login": "kohsuke", + "id": 50003, + "node_id": "MDQ6VXNlcjUwMDAz", + "avatar_url": "https://avatars1.githubusercontent.com/u/50003?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/kohsuke", + "html_url": "https://github.com/kohsuke", + "followers_url": "https://api.github.com/users/kohsuke/followers", + "following_url": "https://api.github.com/users/kohsuke/following{/other_user}", + "gists_url": "https://api.github.com/users/kohsuke/gists{/gist_id}", + "starred_url": "https://api.github.com/users/kohsuke/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/kohsuke/subscriptions", + "organizations_url": "https://api.github.com/users/kohsuke/orgs", + "repos_url": "https://api.github.com/users/kohsuke/repos", + "events_url": "https://api.github.com/users/kohsuke/events{/privacy}", + "received_events_url": "https://api.github.com/users/kohsuke/received_events", + "type": "User", + "site_admin": false + }, + "committer": { + "login": "kohsuke", + "id": 50003, + "node_id": "MDQ6VXNlcjUwMDAz", + "avatar_url": "https://avatars1.githubusercontent.com/u/50003?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/kohsuke", + "html_url": "https://github.com/kohsuke", + "followers_url": "https://api.github.com/users/kohsuke/followers", + "following_url": "https://api.github.com/users/kohsuke/following{/other_user}", + "gists_url": "https://api.github.com/users/kohsuke/gists{/gist_id}", + "starred_url": "https://api.github.com/users/kohsuke/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/kohsuke/subscriptions", + "organizations_url": "https://api.github.com/users/kohsuke/orgs", + "repos_url": "https://api.github.com/users/kohsuke/repos", + "events_url": "https://api.github.com/users/kohsuke/events{/privacy}", + "received_events_url": "https://api.github.com/users/kohsuke/received_events", + "type": "User", + "site_admin": false + }, + "parents": [ + { + "sha": "ecbfdd7315ef2cf04b2be7f11a072ce0bd00c396", + "url": "https://api.github.com/repos/hub4j/github-api/commits/ecbfdd7315ef2cf04b2be7f11a072ce0bd00c396", + "html_url": "https://github.com/hub4j/github-api/commit/ecbfdd7315ef2cf04b2be7f11a072ce0bd00c396" + } + ], + "stats": { + "total": 3, + "additions": 3, + "deletions": 0 + }, + "files": [ + { + "sha": "2a2e1f77fd77bd03273946d893d25a455f696be0", + "filename": "README", + "status": "added", + "additions": 3, + "deletions": 0, + "changes": 3, + "blob_url": "https://github.com/hub4j/github-api/blob/86a2e245aa6d71d54923655066049d9e21a15f01/README", + "raw_url": "https://github.com/hub4j/github-api/raw/86a2e245aa6d71d54923655066049d9e21a15f01/README", + "contents_url": "https://api.github.com/repos/hub4j/github-api/contents/README?ref=86a2e245aa6d71d54923655066049d9e21a15f01", + "patch": "@@ -0,0 +1,3 @@\n+Java API for GitHub\n+\n+See http://kohsuke.org/github-api/ for more details" + } + ] +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHVerificationReasonTest/wiremock/testMalformedSig/__files/user-1.json b/src/test/resources/org/kohsuke/github/GHVerificationReasonTest/wiremock/testMalformedSig/__files/user-1.json new file mode 100644 index 0000000000..a4b576e8a7 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHVerificationReasonTest/wiremock/testMalformedSig/__files/user-1.json @@ -0,0 +1,45 @@ +{ + "login": "bitwiseman", + "id": 1958953, + "node_id": "MDQ6VXNlcjE5NTg5NTM=", + "avatar_url": "https://avatars3.githubusercontent.com/u/1958953?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/bitwiseman", + "html_url": "https://github.com/bitwiseman", + "followers_url": "https://api.github.com/users/bitwiseman/followers", + "following_url": "https://api.github.com/users/bitwiseman/following{/other_user}", + "gists_url": "https://api.github.com/users/bitwiseman/gists{/gist_id}", + "starred_url": "https://api.github.com/users/bitwiseman/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/bitwiseman/subscriptions", + "organizations_url": "https://api.github.com/users/bitwiseman/orgs", + "repos_url": "https://api.github.com/users/bitwiseman/repos", + "events_url": "https://api.github.com/users/bitwiseman/events{/privacy}", + "received_events_url": "https://api.github.com/users/bitwiseman/received_events", + "type": "User", + "site_admin": false, + "name": "Liam Newman", + "company": "Cloudbees, Inc.", + "blog": "", + "location": "Seattle, WA, USA", + "email": "bitwiseman@gmail.com", + "hireable": null, + "bio": "https://twitter.com/bitwiseman", + "public_repos": 169, + "public_gists": 7, + "followers": 139, + "following": 9, + "created_at": "2012-07-11T20:38:33Z", + "updated_at": "2019-09-24T19:32:29Z", + "private_gists": 7, + "total_private_repos": 9, + "owned_private_repos": 0, + "disk_usage": 33697, + "collaborators": 0, + "two_factor_authentication": true, + "plan": { + "name": "free", + "space": 976562499, + "collaborators": 0, + "private_repos": 10000 + } +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHVerificationReasonTest/wiremock/testMalformedSig/mappings/repos_hub4j_github-api-2.json b/src/test/resources/org/kohsuke/github/GHVerificationReasonTest/wiremock/testMalformedSig/mappings/repos_hub4j_github-api-2.json new file mode 100644 index 0000000000..80fb7dfa4e --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHVerificationReasonTest/wiremock/testMalformedSig/mappings/repos_hub4j_github-api-2.json @@ -0,0 +1,48 @@ +{ + "id": "441cdfd7-a44a-42b4-b732-57e674227760", + "name": "repos_hub4j_github-api", + "request": { + "url": "/repos/hub4j/github-api", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "application/vnd.github.v3+json" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "repos_hub4j_github-api-2.json", + "headers": { + "Date": "Sat, 26 Oct 2019 01:28:40 GMT", + "Content-Type": "application/json; charset=utf-8", + "Server": "GitHub.com", + "Status": "200 OK", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4295", + "X-RateLimit-Reset": "1572055286", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": [ + "Accept, Authorization, Cookie, X-GitHub-OTP", + "Accept-Encoding" + ], + "ETag": "W/\"c1a01d01a6354d93b3cc6098e0b2d047\"", + "Last-Modified": "Fri, 25 Oct 2019 01:32:16 GMT", + "X-OAuth-Scopes": "admin:org, admin:org_hook, admin:public_key, admin:repo_hook, delete_repo, gist, notifications, repo, user, write:discussion", + "X-Accepted-OAuth-Scopes": "repo", + "X-GitHub-Media-Type": "unknown, github.v3", + "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type", + "Access-Control-Allow-Origin": "*", + "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", + "X-Frame-Options": "deny", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "1; mode=block", + "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", + "Content-Security-Policy": "default-src 'none'", + "X-GitHub-Request-Id": "CB01:05A2:A65B56:C4A050:5DB3A147" + } + }, + "uuid": "441cdfd7-a44a-42b4-b732-57e674227760", + "persistent": true, + "insertionIndex": 2 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHVerificationReasonTest/wiremock/testMalformedSig/mappings/repos_hub4j_github-api_commits_86a2e245aa6d71d54923655066049d9e21a15f01-3.json b/src/test/resources/org/kohsuke/github/GHVerificationReasonTest/wiremock/testMalformedSig/mappings/repos_hub4j_github-api_commits_86a2e245aa6d71d54923655066049d9e21a15f01-3.json new file mode 100644 index 0000000000..6b5904361c --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHVerificationReasonTest/wiremock/testMalformedSig/mappings/repos_hub4j_github-api_commits_86a2e245aa6d71d54923655066049d9e21a15f01-3.json @@ -0,0 +1,48 @@ +{ + "id": "d76abea9-c1be-430a-bbd0-28931c58e1e8", + "name": "repos_hub4j_github-api_commits_86a2e245aa6d71d54923655066049d9e21a15f01", + "request": { + "url": "/repos/hub4j/github-api/commits/86a2e245aa6d71d54923655066049d9e21a15f01", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "application/vnd.github.v3+json" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "repos_hub4j_github-api_commits_86a2e245aa6d71d54923655066049d9e21a15f01-3.json", + "headers": { + "Date": "Sat, 26 Oct 2019 01:28:40 GMT", + "Content-Type": "application/json; charset=utf-8", + "Server": "GitHub.com", + "Status": "200 OK", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4294", + "X-RateLimit-Reset": "1572055286", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": [ + "Accept, Authorization, Cookie, X-GitHub-OTP", + "Accept-Encoding" + ], + "ETag": "W/\"0a8c453e4290ce879ea09578e06a5961\"", + "Last-Modified": "Mon, 19 Apr 2010 04:12:41 GMT", + "X-OAuth-Scopes": "admin:org, admin:org_hook, admin:public_key, admin:repo_hook, delete_repo, gist, notifications, repo, user, write:discussion", + "X-Accepted-OAuth-Scopes": "", + "X-GitHub-Media-Type": "unknown, github.v3", + "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type", + "Access-Control-Allow-Origin": "*", + "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", + "X-Frame-Options": "deny", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "1; mode=block", + "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", + "Content-Security-Policy": "default-src 'none'", + "X-GitHub-Request-Id": "CB01:05A2:A65B5F:C4A064:5DB3A148" + } + }, + "uuid": "d76abea9-c1be-430a-bbd0-28931c58e1e8", + "persistent": true, + "insertionIndex": 3 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHVerificationReasonTest/wiremock/testMalformedSig/mappings/user-1.json b/src/test/resources/org/kohsuke/github/GHVerificationReasonTest/wiremock/testMalformedSig/mappings/user-1.json new file mode 100644 index 0000000000..7c0606ff2f --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHVerificationReasonTest/wiremock/testMalformedSig/mappings/user-1.json @@ -0,0 +1,48 @@ +{ + "id": "c247f81b-84b8-44e9-820a-0a91dc74ce98", + "name": "user", + "request": { + "url": "/user", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "application/vnd.github.v3+json" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "user-1.json", + "headers": { + "Date": "Sat, 26 Oct 2019 01:28:39 GMT", + "Content-Type": "application/json; charset=utf-8", + "Server": "GitHub.com", + "Status": "200 OK", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4297", + "X-RateLimit-Reset": "1572055286", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": [ + "Accept, Authorization, Cookie, X-GitHub-OTP", + "Accept-Encoding" + ], + "ETag": "W/\"8c3d3dcf6fc5f9edaf26c902295396e5\"", + "Last-Modified": "Tue, 24 Sep 2019 19:32:29 GMT", + "X-OAuth-Scopes": "admin:org, admin:org_hook, admin:public_key, admin:repo_hook, delete_repo, gist, notifications, repo, user, write:discussion", + "X-Accepted-OAuth-Scopes": "", + "X-GitHub-Media-Type": "unknown, github.v3", + "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type", + "Access-Control-Allow-Origin": "*", + "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", + "X-Frame-Options": "deny", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "1; mode=block", + "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", + "Content-Security-Policy": "default-src 'none'", + "X-GitHub-Request-Id": "CB01:05A2:A65B49:C4A046:5DB3A147" + } + }, + "uuid": "c247f81b-84b8-44e9-820a-0a91dc74ce98", + "persistent": true, + "insertionIndex": 1 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHVerificationReasonTest/wiremock/testOcspError/__files/repos_hub4j_github-api-2.json b/src/test/resources/org/kohsuke/github/GHVerificationReasonTest/wiremock/testOcspError/__files/repos_hub4j_github-api-2.json new file mode 100644 index 0000000000..43ee270874 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHVerificationReasonTest/wiremock/testOcspError/__files/repos_hub4j_github-api-2.json @@ -0,0 +1,130 @@ +{ + "id": 617210, + "node_id": "MDEwOlJlcG9zaXRvcnk2MTcyMTA=", + "name": "github-api", + "full_name": "hub4j/github-api", + "private": false, + "owner": { + "login": "hub4j", + "id": 54909825, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjU0OTA5ODI1", + "avatar_url": "https://avatars3.githubusercontent.com/u/54909825?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/hub4j", + "html_url": "https://github.com/hub4j", + "followers_url": "https://api.github.com/users/hub4j/followers", + "following_url": "https://api.github.com/users/hub4j/following{/other_user}", + "gists_url": "https://api.github.com/users/hub4j/gists{/gist_id}", + "starred_url": "https://api.github.com/users/hub4j/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/hub4j/subscriptions", + "organizations_url": "https://api.github.com/users/hub4j/orgs", + "repos_url": "https://api.github.com/users/hub4j/repos", + "events_url": "https://api.github.com/users/hub4j/events{/privacy}", + "received_events_url": "https://api.github.com/users/hub4j/received_events", + "type": "Organization", + "site_admin": false + }, + "html_url": "https://github.com/hub4j/github-api", + "description": "Java API for GitHub", + "fork": false, + "url": "https://api.github.com/repos/hub4j/github-api", + "forks_url": "https://api.github.com/repos/hub4j/github-api/forks", + "keys_url": "https://api.github.com/repos/hub4j/github-api/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/hub4j/github-api/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/hub4j/github-api/teams", + "hooks_url": "https://api.github.com/repos/hub4j/github-api/hooks", + "issue_events_url": "https://api.github.com/repos/hub4j/github-api/issues/events{/number}", + "events_url": "https://api.github.com/repos/hub4j/github-api/events", + "assignees_url": "https://api.github.com/repos/hub4j/github-api/assignees{/user}", + "branches_url": "https://api.github.com/repos/hub4j/github-api/branches{/branch}", + "tags_url": "https://api.github.com/repos/hub4j/github-api/tags", + "blobs_url": "https://api.github.com/repos/hub4j/github-api/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/hub4j/github-api/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/hub4j/github-api/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/hub4j/github-api/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/hub4j/github-api/statuses/{sha}", + "languages_url": "https://api.github.com/repos/hub4j/github-api/languages", + "stargazers_url": "https://api.github.com/repos/hub4j/github-api/stargazers", + "contributors_url": "https://api.github.com/repos/hub4j/github-api/contributors", + "subscribers_url": "https://api.github.com/repos/hub4j/github-api/subscribers", + "subscription_url": "https://api.github.com/repos/hub4j/github-api/subscription", + "commits_url": "https://api.github.com/repos/hub4j/github-api/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/hub4j/github-api/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/hub4j/github-api/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/hub4j/github-api/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/hub4j/github-api/contents/{+path}", + "compare_url": "https://api.github.com/repos/hub4j/github-api/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/hub4j/github-api/merges", + "archive_url": "https://api.github.com/repos/hub4j/github-api/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/hub4j/github-api/downloads", + "issues_url": "https://api.github.com/repos/hub4j/github-api/issues{/number}", + "pulls_url": "https://api.github.com/repos/hub4j/github-api/pulls{/number}", + "milestones_url": "https://api.github.com/repos/hub4j/github-api/milestones{/number}", + "notifications_url": "https://api.github.com/repos/hub4j/github-api/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/hub4j/github-api/labels{/name}", + "releases_url": "https://api.github.com/repos/hub4j/github-api/releases{/id}", + "deployments_url": "https://api.github.com/repos/hub4j/github-api/deployments", + "created_at": "2010-04-19T04:13:03Z", + "updated_at": "2019-10-25T01:32:16Z", + "pushed_at": "2019-10-25T16:41:09Z", + "git_url": "git://github.com/hub4j/github-api.git", + "ssh_url": "git@github.com:hub4j/github-api.git", + "clone_url": "https://github.com/hub4j/github-api.git", + "svn_url": "https://github.com/hub4j/github-api", + "homepage": "http://github-api.kohsuke.org/", + "size": 13494, + "stargazers_count": 565, + "watchers_count": 565, + "language": "Java", + "has_issues": true, + "has_projects": true, + "has_downloads": true, + "has_wiki": true, + "has_pages": true, + "forks_count": 433, + "mirror_url": null, + "archived": false, + "disabled": false, + "open_issues_count": 64, + "license": { + "key": "mit", + "name": "MIT License", + "spdx_id": "MIT", + "url": "https://api.github.com/licenses/mit", + "node_id": "MDc6TGljZW5zZTEz" + }, + "forks": 433, + "open_issues": 64, + "watchers": 565, + "default_branch": "main", + "permissions": { + "admin": true, + "push": true, + "pull": true + }, + "allow_squash_merge": true, + "allow_merge_commit": true, + "allow_rebase_merge": true, + "organization": { + "login": "hub4j", + "id": 54909825, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjU0OTA5ODI1", + "avatar_url": "https://avatars3.githubusercontent.com/u/54909825?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/hub4j", + "html_url": "https://github.com/hub4j", + "followers_url": "https://api.github.com/users/hub4j/followers", + "following_url": "https://api.github.com/users/hub4j/following{/other_user}", + "gists_url": "https://api.github.com/users/hub4j/gists{/gist_id}", + "starred_url": "https://api.github.com/users/hub4j/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/hub4j/subscriptions", + "organizations_url": "https://api.github.com/users/hub4j/orgs", + "repos_url": "https://api.github.com/users/hub4j/repos", + "events_url": "https://api.github.com/users/hub4j/events{/privacy}", + "received_events_url": "https://api.github.com/users/hub4j/received_events", + "type": "Organization", + "site_admin": false + }, + "network_count": 433, + "subscribers_count": 48 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHVerificationReasonTest/wiremock/testOcspError/__files/repos_hub4j_github-api_commits_86a2e245aa6d71d54923655066049d9e21a15f01-3.json b/src/test/resources/org/kohsuke/github/GHVerificationReasonTest/wiremock/testOcspError/__files/repos_hub4j_github-api_commits_86a2e245aa6d71d54923655066049d9e21a15f01-3.json new file mode 100644 index 0000000000..4f60cb235f --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHVerificationReasonTest/wiremock/testOcspError/__files/repos_hub4j_github-api_commits_86a2e245aa6d71d54923655066049d9e21a15f01-3.json @@ -0,0 +1,98 @@ +{ + "sha": "86a2e245aa6d71d54923655066049d9e21a15f01", + "node_id": "MDY6Q29tbWl0NjE3MjEwOjg2YTJlMjQ1YWE2ZDcxZDU0OTIzNjU1MDY2MDQ5ZDllMjFhMTVmMjM=", + "commit": { + "author": { + "name": "Sourabh Parkala", + "email": "sourabh.sarvotham.parkala@sap.com", + "date": "2010-04-19T04:12:41Z" + }, + "committer": { + "name": "Sourabh Parkala", + "email": "sourabh.sarvotham.parkala@sap.com", + "date": "2010-04-19T04:12:41Z" + }, + "message": "doc", + "tree": { + "sha": "17ed4173aeb2e98c93216e8b6e16138dc7f8cd91", + "url": "https://api.github.com/repos/hub4j/github-api/git/trees/17ed4173aeb2e98c93216e8b6e16138dc7f8cd91" + }, + "url": "https://api.github.com/repos/hub4j/github-api/git/commits/86a2e245aa6d71d54923655066049d9e21a15f01", + "comment_count": 0, + "verification": { + "verified": false, + "reason": "ocsp_error", + "signature": "-----BEGIN SIGNED MESSAGE-----\nMIIFdQYJKoZIhvcNAQcCoIIFZjCCBWICAQExDTALBglghkgBZQMEAgEwCwYJKoZI\nhvcNAQcBoIIDejCCA3YwggJeoAMCAQICAQIwDQYJKoZIhvcNAQELBQAwKjEbMBkG\nA1UEAwwSQXN0cm9UbGFsb2PigJlzIENBMQswCQYDVQQGEwJVUzAeFw0yMzA5MTgy\nMzI2MDlaFw0yNDA5MTcyMzI2MDlaMEYxFDASBgNVBAMMC0FzdHJvVGxhbG9jMQsw\nCQYDVQQGEwJVUzEhMB8GCSqGSIb3DQEJARYSMHhUbGFsb2NAZ21haWwuY29tMIIB\nIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA+Zq+N5v68htABs4ZLPORns/F\nzixnI+6L+WaVGeQFzxIBs9zsm9IRGJ4xoMBPSg1BuoilRXzsQoCH6+5zyQ4jaHMa\nHBBEijVM7kor3Um+35KdYh79nIY7ZQoDRypLF02FiqfNjhN8Nm8ciNf2EUkiGIcj\n/+TPhVFMxnwlZ2SmSJoMBE5pkDBllb/8kfxgenSoVLXaOigYJ1It6AqH2L8Ju9pa\nJ1zJGu2edjN6xi/0yjzZ7CmPFbnWcY5flJfMqdaj0Po3dMwYKYK07rE7KQHc8wFT\ngAUtQNtJkGBjEcTBh1B7SUsnJ/x4XcSQwOMxPNSm4Esn2RWanJYunez75eCWlwID\nAQABo4GKMIGHMA4GA1UdDwEB/wQEAwIFoDAWBgNVHSUBAf8EDDAKBggrBgEFBQcD\nBDAdBgNVHQ4EFgQUSi5d7oqzSYNhpeG4I2VNF9j881UwHwYDVR0jBBgwFoAULCWl\nbibBiKOX/6M3RWgIlSPM7dcwHQYDVR0RBBYwFIESMHhUbGFsb2NAZ21haWwuY29t\nMA0GCSqGSIb3DQEBCwUAA4IBAQDSn3caORjlSXCSm8ZY1uAbG+IngvEooIJvbl+y\n0yglPA3pkWybXxLfvayJVRGtNgLambnPpulzZmdwjj7qSTzd9K/+OIsI2qjNrZZ+\napXJLhlfabNHzydj0y0DUWgbtKzQ1SVhWgglHaCp440UmVAi0PtsMy3F1S5S0HlZ\n80V1CE3r7UYsC64GG3CmyXVf5MB+pzPriE729Gglig5z6rq8F+GNk5hJW7tOKBRb\nCyXFkqbkMWHPJ/CP5wrFjrEITsn8fIhlJsYRIAGzTnffCOs9i3rMpUTXRBOwSVMB\nI1I3VPm+WxVE7O9NY7TGBDe7010D4DorTNUPYo8xsPtKYyrpMYIBwTCCAb0CAQEw\nLzAqMRswGQYDVQQDDBJBc3Ryb1RsYWxvY+KAmXMgQ0ExCzAJBgNVBAYTAlVTAgEC\nMAsGCWCGSAFlAwQCAaBpMBgGCSqGSIb3DQEJAzELBgkqhkiG9w0BBwEwHAYJKoZI\nhvcNAQkFMQ8XDTIzMDkxODIzMjg1MFowLwYJKoZIhvcNAQkEMSIEIIFHI8Ick3Tu\nBlnfTU6v24ls8D+jGkpQoDK+MF4rk5iTMAsGCSqGSIb3DQEBCwSCAQC4nIUEB/bR\ngeXnO7KdtqRFn/slCNTKZaQObsyL7C7cmNYAlgQAYj/qOBhKGMd3ZAFHRUroCiCy\n5GPs1sEnPKT1Bh7E7HJbpfdMXZINxoiRBrwQpAD/UKxk6etF5qvtAwDJaFMZiTMh\nd6tPNVBcThhUglSqqQFT3BKE9z5KTGwonMeqZlyf/EpXRBn0YcaoWvcAzaahMBQw\nUPwwEtU3FVyYBbLQee0SoYDsddEjdaNN/37auMVIltYmKNq/A4KhJWduTGFcaD/k\nfcXIzhzBi4vk1No6y2ftDgbivxP3MVQyf1tIfD1fv9cw/55JnDRA3IXkQRc+yyUG\nGmHXpKHhqNKm\n-----END SIGNED MESSAGE-----", + "payload": null + } + }, + "url": "https://api.github.com/repos/hub4j/github-api/commits/86a2e245aa6d71d54923655066049d9e21a15f01", + "html_url": "https://github.com/hub4j/github-api/commit/86a2e245aa6d71d54923655066049d9e21a15f01", + "comments_url": "https://api.github.com/repos/hub4j/github-api/commits/86a2e245aa6d71d54923655066049d9e21a15f01/comments", + "author": { + "login": "kohsuke", + "id": 50003, + "node_id": "MDQ6VXNlcjUwMDAz", + "avatar_url": "https://avatars1.githubusercontent.com/u/50003?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/kohsuke", + "html_url": "https://github.com/kohsuke", + "followers_url": "https://api.github.com/users/kohsuke/followers", + "following_url": "https://api.github.com/users/kohsuke/following{/other_user}", + "gists_url": "https://api.github.com/users/kohsuke/gists{/gist_id}", + "starred_url": "https://api.github.com/users/kohsuke/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/kohsuke/subscriptions", + "organizations_url": "https://api.github.com/users/kohsuke/orgs", + "repos_url": "https://api.github.com/users/kohsuke/repos", + "events_url": "https://api.github.com/users/kohsuke/events{/privacy}", + "received_events_url": "https://api.github.com/users/kohsuke/received_events", + "type": "User", + "site_admin": false + }, + "committer": { + "login": "kohsuke", + "id": 50003, + "node_id": "MDQ6VXNlcjUwMDAz", + "avatar_url": "https://avatars1.githubusercontent.com/u/50003?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/kohsuke", + "html_url": "https://github.com/kohsuke", + "followers_url": "https://api.github.com/users/kohsuke/followers", + "following_url": "https://api.github.com/users/kohsuke/following{/other_user}", + "gists_url": "https://api.github.com/users/kohsuke/gists{/gist_id}", + "starred_url": "https://api.github.com/users/kohsuke/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/kohsuke/subscriptions", + "organizations_url": "https://api.github.com/users/kohsuke/orgs", + "repos_url": "https://api.github.com/users/kohsuke/repos", + "events_url": "https://api.github.com/users/kohsuke/events{/privacy}", + "received_events_url": "https://api.github.com/users/kohsuke/received_events", + "type": "User", + "site_admin": false + }, + "parents": [ + { + "sha": "ecbfdd7315ef2cf04b2be7f11a072ce0bd00c396", + "url": "https://api.github.com/repos/hub4j/github-api/commits/ecbfdd7315ef2cf04b2be7f11a072ce0bd00c396", + "html_url": "https://github.com/hub4j/github-api/commit/ecbfdd7315ef2cf04b2be7f11a072ce0bd00c396" + } + ], + "stats": { + "total": 3, + "additions": 3, + "deletions": 0 + }, + "files": [ + { + "sha": "2a2e1f77fd77bd03273946d893d25a455f696be0", + "filename": "README", + "status": "added", + "additions": 3, + "deletions": 0, + "changes": 3, + "blob_url": "https://github.com/hub4j/github-api/blob/86a2e245aa6d71d54923655066049d9e21a15f01/README", + "raw_url": "https://github.com/hub4j/github-api/raw/86a2e245aa6d71d54923655066049d9e21a15f01/README", + "contents_url": "https://api.github.com/repos/hub4j/github-api/contents/README?ref=86a2e245aa6d71d54923655066049d9e21a15f01", + "patch": "@@ -0,0 +1,3 @@\n+Java API for GitHub\n+\n+See http://kohsuke.org/github-api/ for more details" + } + ] +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHVerificationReasonTest/wiremock/testOcspError/__files/user-1.json b/src/test/resources/org/kohsuke/github/GHVerificationReasonTest/wiremock/testOcspError/__files/user-1.json new file mode 100644 index 0000000000..a4b576e8a7 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHVerificationReasonTest/wiremock/testOcspError/__files/user-1.json @@ -0,0 +1,45 @@ +{ + "login": "bitwiseman", + "id": 1958953, + "node_id": "MDQ6VXNlcjE5NTg5NTM=", + "avatar_url": "https://avatars3.githubusercontent.com/u/1958953?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/bitwiseman", + "html_url": "https://github.com/bitwiseman", + "followers_url": "https://api.github.com/users/bitwiseman/followers", + "following_url": "https://api.github.com/users/bitwiseman/following{/other_user}", + "gists_url": "https://api.github.com/users/bitwiseman/gists{/gist_id}", + "starred_url": "https://api.github.com/users/bitwiseman/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/bitwiseman/subscriptions", + "organizations_url": "https://api.github.com/users/bitwiseman/orgs", + "repos_url": "https://api.github.com/users/bitwiseman/repos", + "events_url": "https://api.github.com/users/bitwiseman/events{/privacy}", + "received_events_url": "https://api.github.com/users/bitwiseman/received_events", + "type": "User", + "site_admin": false, + "name": "Liam Newman", + "company": "Cloudbees, Inc.", + "blog": "", + "location": "Seattle, WA, USA", + "email": "bitwiseman@gmail.com", + "hireable": null, + "bio": "https://twitter.com/bitwiseman", + "public_repos": 169, + "public_gists": 7, + "followers": 139, + "following": 9, + "created_at": "2012-07-11T20:38:33Z", + "updated_at": "2019-09-24T19:32:29Z", + "private_gists": 7, + "total_private_repos": 9, + "owned_private_repos": 0, + "disk_usage": 33697, + "collaborators": 0, + "two_factor_authentication": true, + "plan": { + "name": "free", + "space": 976562499, + "collaborators": 0, + "private_repos": 10000 + } +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHVerificationReasonTest/wiremock/testOcspError/mappings/repos_hub4j_github-api-2.json b/src/test/resources/org/kohsuke/github/GHVerificationReasonTest/wiremock/testOcspError/mappings/repos_hub4j_github-api-2.json new file mode 100644 index 0000000000..80fb7dfa4e --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHVerificationReasonTest/wiremock/testOcspError/mappings/repos_hub4j_github-api-2.json @@ -0,0 +1,48 @@ +{ + "id": "441cdfd7-a44a-42b4-b732-57e674227760", + "name": "repos_hub4j_github-api", + "request": { + "url": "/repos/hub4j/github-api", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "application/vnd.github.v3+json" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "repos_hub4j_github-api-2.json", + "headers": { + "Date": "Sat, 26 Oct 2019 01:28:40 GMT", + "Content-Type": "application/json; charset=utf-8", + "Server": "GitHub.com", + "Status": "200 OK", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4295", + "X-RateLimit-Reset": "1572055286", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": [ + "Accept, Authorization, Cookie, X-GitHub-OTP", + "Accept-Encoding" + ], + "ETag": "W/\"c1a01d01a6354d93b3cc6098e0b2d047\"", + "Last-Modified": "Fri, 25 Oct 2019 01:32:16 GMT", + "X-OAuth-Scopes": "admin:org, admin:org_hook, admin:public_key, admin:repo_hook, delete_repo, gist, notifications, repo, user, write:discussion", + "X-Accepted-OAuth-Scopes": "repo", + "X-GitHub-Media-Type": "unknown, github.v3", + "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type", + "Access-Control-Allow-Origin": "*", + "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", + "X-Frame-Options": "deny", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "1; mode=block", + "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", + "Content-Security-Policy": "default-src 'none'", + "X-GitHub-Request-Id": "CB01:05A2:A65B56:C4A050:5DB3A147" + } + }, + "uuid": "441cdfd7-a44a-42b4-b732-57e674227760", + "persistent": true, + "insertionIndex": 2 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHVerificationReasonTest/wiremock/testOcspError/mappings/repos_hub4j_github-api_commits_86a2e245aa6d71d54923655066049d9e21a15f01-3.json b/src/test/resources/org/kohsuke/github/GHVerificationReasonTest/wiremock/testOcspError/mappings/repos_hub4j_github-api_commits_86a2e245aa6d71d54923655066049d9e21a15f01-3.json new file mode 100644 index 0000000000..6b5904361c --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHVerificationReasonTest/wiremock/testOcspError/mappings/repos_hub4j_github-api_commits_86a2e245aa6d71d54923655066049d9e21a15f01-3.json @@ -0,0 +1,48 @@ +{ + "id": "d76abea9-c1be-430a-bbd0-28931c58e1e8", + "name": "repos_hub4j_github-api_commits_86a2e245aa6d71d54923655066049d9e21a15f01", + "request": { + "url": "/repos/hub4j/github-api/commits/86a2e245aa6d71d54923655066049d9e21a15f01", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "application/vnd.github.v3+json" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "repos_hub4j_github-api_commits_86a2e245aa6d71d54923655066049d9e21a15f01-3.json", + "headers": { + "Date": "Sat, 26 Oct 2019 01:28:40 GMT", + "Content-Type": "application/json; charset=utf-8", + "Server": "GitHub.com", + "Status": "200 OK", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4294", + "X-RateLimit-Reset": "1572055286", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": [ + "Accept, Authorization, Cookie, X-GitHub-OTP", + "Accept-Encoding" + ], + "ETag": "W/\"0a8c453e4290ce879ea09578e06a5961\"", + "Last-Modified": "Mon, 19 Apr 2010 04:12:41 GMT", + "X-OAuth-Scopes": "admin:org, admin:org_hook, admin:public_key, admin:repo_hook, delete_repo, gist, notifications, repo, user, write:discussion", + "X-Accepted-OAuth-Scopes": "", + "X-GitHub-Media-Type": "unknown, github.v3", + "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type", + "Access-Control-Allow-Origin": "*", + "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", + "X-Frame-Options": "deny", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "1; mode=block", + "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", + "Content-Security-Policy": "default-src 'none'", + "X-GitHub-Request-Id": "CB01:05A2:A65B5F:C4A064:5DB3A148" + } + }, + "uuid": "d76abea9-c1be-430a-bbd0-28931c58e1e8", + "persistent": true, + "insertionIndex": 3 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHVerificationReasonTest/wiremock/testOcspError/mappings/user-1.json b/src/test/resources/org/kohsuke/github/GHVerificationReasonTest/wiremock/testOcspError/mappings/user-1.json new file mode 100644 index 0000000000..7c0606ff2f --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHVerificationReasonTest/wiremock/testOcspError/mappings/user-1.json @@ -0,0 +1,48 @@ +{ + "id": "c247f81b-84b8-44e9-820a-0a91dc74ce98", + "name": "user", + "request": { + "url": "/user", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "application/vnd.github.v3+json" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "user-1.json", + "headers": { + "Date": "Sat, 26 Oct 2019 01:28:39 GMT", + "Content-Type": "application/json; charset=utf-8", + "Server": "GitHub.com", + "Status": "200 OK", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4297", + "X-RateLimit-Reset": "1572055286", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": [ + "Accept, Authorization, Cookie, X-GitHub-OTP", + "Accept-Encoding" + ], + "ETag": "W/\"8c3d3dcf6fc5f9edaf26c902295396e5\"", + "Last-Modified": "Tue, 24 Sep 2019 19:32:29 GMT", + "X-OAuth-Scopes": "admin:org, admin:org_hook, admin:public_key, admin:repo_hook, delete_repo, gist, notifications, repo, user, write:discussion", + "X-Accepted-OAuth-Scopes": "", + "X-GitHub-Media-Type": "unknown, github.v3", + "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type", + "Access-Control-Allow-Origin": "*", + "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", + "X-Frame-Options": "deny", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "1; mode=block", + "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", + "Content-Security-Policy": "default-src 'none'", + "X-GitHub-Request-Id": "CB01:05A2:A65B49:C4A046:5DB3A147" + } + }, + "uuid": "c247f81b-84b8-44e9-820a-0a91dc74ce98", + "persistent": true, + "insertionIndex": 1 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHVerificationReasonTest/wiremock/testOscpPending/__files/repos_hub4j_github-api-2.json b/src/test/resources/org/kohsuke/github/GHVerificationReasonTest/wiremock/testOscpPending/__files/repos_hub4j_github-api-2.json new file mode 100644 index 0000000000..43ee270874 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHVerificationReasonTest/wiremock/testOscpPending/__files/repos_hub4j_github-api-2.json @@ -0,0 +1,130 @@ +{ + "id": 617210, + "node_id": "MDEwOlJlcG9zaXRvcnk2MTcyMTA=", + "name": "github-api", + "full_name": "hub4j/github-api", + "private": false, + "owner": { + "login": "hub4j", + "id": 54909825, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjU0OTA5ODI1", + "avatar_url": "https://avatars3.githubusercontent.com/u/54909825?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/hub4j", + "html_url": "https://github.com/hub4j", + "followers_url": "https://api.github.com/users/hub4j/followers", + "following_url": "https://api.github.com/users/hub4j/following{/other_user}", + "gists_url": "https://api.github.com/users/hub4j/gists{/gist_id}", + "starred_url": "https://api.github.com/users/hub4j/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/hub4j/subscriptions", + "organizations_url": "https://api.github.com/users/hub4j/orgs", + "repos_url": "https://api.github.com/users/hub4j/repos", + "events_url": "https://api.github.com/users/hub4j/events{/privacy}", + "received_events_url": "https://api.github.com/users/hub4j/received_events", + "type": "Organization", + "site_admin": false + }, + "html_url": "https://github.com/hub4j/github-api", + "description": "Java API for GitHub", + "fork": false, + "url": "https://api.github.com/repos/hub4j/github-api", + "forks_url": "https://api.github.com/repos/hub4j/github-api/forks", + "keys_url": "https://api.github.com/repos/hub4j/github-api/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/hub4j/github-api/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/hub4j/github-api/teams", + "hooks_url": "https://api.github.com/repos/hub4j/github-api/hooks", + "issue_events_url": "https://api.github.com/repos/hub4j/github-api/issues/events{/number}", + "events_url": "https://api.github.com/repos/hub4j/github-api/events", + "assignees_url": "https://api.github.com/repos/hub4j/github-api/assignees{/user}", + "branches_url": "https://api.github.com/repos/hub4j/github-api/branches{/branch}", + "tags_url": "https://api.github.com/repos/hub4j/github-api/tags", + "blobs_url": "https://api.github.com/repos/hub4j/github-api/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/hub4j/github-api/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/hub4j/github-api/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/hub4j/github-api/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/hub4j/github-api/statuses/{sha}", + "languages_url": "https://api.github.com/repos/hub4j/github-api/languages", + "stargazers_url": "https://api.github.com/repos/hub4j/github-api/stargazers", + "contributors_url": "https://api.github.com/repos/hub4j/github-api/contributors", + "subscribers_url": "https://api.github.com/repos/hub4j/github-api/subscribers", + "subscription_url": "https://api.github.com/repos/hub4j/github-api/subscription", + "commits_url": "https://api.github.com/repos/hub4j/github-api/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/hub4j/github-api/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/hub4j/github-api/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/hub4j/github-api/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/hub4j/github-api/contents/{+path}", + "compare_url": "https://api.github.com/repos/hub4j/github-api/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/hub4j/github-api/merges", + "archive_url": "https://api.github.com/repos/hub4j/github-api/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/hub4j/github-api/downloads", + "issues_url": "https://api.github.com/repos/hub4j/github-api/issues{/number}", + "pulls_url": "https://api.github.com/repos/hub4j/github-api/pulls{/number}", + "milestones_url": "https://api.github.com/repos/hub4j/github-api/milestones{/number}", + "notifications_url": "https://api.github.com/repos/hub4j/github-api/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/hub4j/github-api/labels{/name}", + "releases_url": "https://api.github.com/repos/hub4j/github-api/releases{/id}", + "deployments_url": "https://api.github.com/repos/hub4j/github-api/deployments", + "created_at": "2010-04-19T04:13:03Z", + "updated_at": "2019-10-25T01:32:16Z", + "pushed_at": "2019-10-25T16:41:09Z", + "git_url": "git://github.com/hub4j/github-api.git", + "ssh_url": "git@github.com:hub4j/github-api.git", + "clone_url": "https://github.com/hub4j/github-api.git", + "svn_url": "https://github.com/hub4j/github-api", + "homepage": "http://github-api.kohsuke.org/", + "size": 13494, + "stargazers_count": 565, + "watchers_count": 565, + "language": "Java", + "has_issues": true, + "has_projects": true, + "has_downloads": true, + "has_wiki": true, + "has_pages": true, + "forks_count": 433, + "mirror_url": null, + "archived": false, + "disabled": false, + "open_issues_count": 64, + "license": { + "key": "mit", + "name": "MIT License", + "spdx_id": "MIT", + "url": "https://api.github.com/licenses/mit", + "node_id": "MDc6TGljZW5zZTEz" + }, + "forks": 433, + "open_issues": 64, + "watchers": 565, + "default_branch": "main", + "permissions": { + "admin": true, + "push": true, + "pull": true + }, + "allow_squash_merge": true, + "allow_merge_commit": true, + "allow_rebase_merge": true, + "organization": { + "login": "hub4j", + "id": 54909825, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjU0OTA5ODI1", + "avatar_url": "https://avatars3.githubusercontent.com/u/54909825?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/hub4j", + "html_url": "https://github.com/hub4j", + "followers_url": "https://api.github.com/users/hub4j/followers", + "following_url": "https://api.github.com/users/hub4j/following{/other_user}", + "gists_url": "https://api.github.com/users/hub4j/gists{/gist_id}", + "starred_url": "https://api.github.com/users/hub4j/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/hub4j/subscriptions", + "organizations_url": "https://api.github.com/users/hub4j/orgs", + "repos_url": "https://api.github.com/users/hub4j/repos", + "events_url": "https://api.github.com/users/hub4j/events{/privacy}", + "received_events_url": "https://api.github.com/users/hub4j/received_events", + "type": "Organization", + "site_admin": false + }, + "network_count": 433, + "subscribers_count": 48 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHVerificationReasonTest/wiremock/testOscpPending/__files/repos_hub4j_github-api_commits_86a2e245aa6d71d54923655066049d9e21a15f01-3.json b/src/test/resources/org/kohsuke/github/GHVerificationReasonTest/wiremock/testOscpPending/__files/repos_hub4j_github-api_commits_86a2e245aa6d71d54923655066049d9e21a15f01-3.json new file mode 100644 index 0000000000..c5e2c3995c --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHVerificationReasonTest/wiremock/testOscpPending/__files/repos_hub4j_github-api_commits_86a2e245aa6d71d54923655066049d9e21a15f01-3.json @@ -0,0 +1,98 @@ +{ + "sha": "86a2e245aa6d71d54923655066049d9e21a15f01", + "node_id": "MDY6Q29tbWl0NjE3MjEwOjg2YTJlMjQ1YWE2ZDcxZDU0OTIzNjU1MDY2MDQ5ZDllMjFhMTVmMjM=", + "commit": { + "author": { + "name": "Sourabh Parkala", + "email": "sourabh.sarvotham.parkala@sap.com", + "date": "2010-04-19T04:12:41Z" + }, + "committer": { + "name": "Sourabh Parkala", + "email": "sourabh.sarvotham.parkala@sap.com", + "date": "2010-04-19T04:12:41Z" + }, + "message": "doc", + "tree": { + "sha": "17ed4173aeb2e98c93216e8b6e16138dc7f8cd91", + "url": "https://api.github.com/repos/hub4j/github-api/git/trees/17ed4173aeb2e98c93216e8b6e16138dc7f8cd91" + }, + "url": "https://api.github.com/repos/hub4j/github-api/git/commits/86a2e245aa6d71d54923655066049d9e21a15f01", + "comment_count": 0, + "verification": { + "verified": false, + "reason": "ocsp_pending", + "signature": "-----BEGIN SIGNED MESSAGE-----\nMIIFdQYJKoZIhvcNAQcCoIIFZjCCBWICAQExDTALBglghkgBZQMEAgEwCwYJKoZI\nhvcNAQcBoIIDejCCA3YwggJeoAMCAQICAQIwDQYJKoZIhvcNAQELBQAwKjEbMBkG\nA1UEAwwSQXN0cm9UbGFsb2PigJlzIENBMQswCQYDVQQGEwJVUzAeFw0yMzA5MTgy\nMzI2MDlaFw0yNDA5MTcyMzI2MDlaMEYxFDASBgNVBAMMC0FzdHJvVGxhbG9jMQsw\nCQYDVQQGEwJVUzEhMB8GCSqGSIb3DQEJARYSMHhUbGFsb2NAZ21haWwuY29tMIIB\nIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA+Zq+N5v68htABs4ZLPORns/F\nzixnI+6L+WaVGeQFzxIBs9zsm9IRGJ4xoMBPSg1BuoilRXzsQoCH6+5zyQ4jaHMa\nHBBEijVM7kor3Um+35KdYh79nIY7ZQoDRypLF02FiqfNjhN8Nm8ciNf2EUkiGIcj\n/+TPhVFMxnwlZ2SmSJoMBE5pkDBllb/8kfxgenSoVLXaOigYJ1It6AqH2L8Ju9pa\nJ1zJGu2edjN6xi/0yjzZ7CmPFbnWcY5flJfMqdaj0Po3dMwYKYK07rE7KQHc8wFT\ngAUtQNtJkGBjEcTBh1B7SUsnJ/x4XcSQwOMxPNSm4Esn2RWanJYunez75eCWlwID\nAQABo4GKMIGHMA4GA1UdDwEB/wQEAwIFoDAWBgNVHSUBAf8EDDAKBggrBgEFBQcD\nBDAdBgNVHQ4EFgQUSi5d7oqzSYNhpeG4I2VNF9j881UwHwYDVR0jBBgwFoAULCWl\nbibBiKOX/6M3RWgIlSPM7dcwHQYDVR0RBBYwFIESMHhUbGFsb2NAZ21haWwuY29t\nMA0GCSqGSIb3DQEBCwUAA4IBAQDSn3caORjlSXCSm8ZY1uAbG+IngvEooIJvbl+y\n0yglPA3pkWybXxLfvayJVRGtNgLambnPpulzZmdwjj7qSTzd9K/+OIsI2qjNrZZ+\napXJLhlfabNHzydj0y0DUWgbtKzQ1SVhWgglHaCp440UmVAi0PtsMy3F1S5S0HlZ\n80V1CE3r7UYsC64GG3CmyXVf5MB+pzPriE729Gglig5z6rq8F+GNk5hJW7tOKBRb\nCyXFkqbkMWHPJ/CP5wrFjrEITsn8fIhlJsYRIAGzTnffCOs9i3rMpUTXRBOwSVMB\nI1I3VPm+WxVE7O9NY7TGBDe7010D4DorTNUPYo8xsPtKYyrpMYIBwTCCAb0CAQEw\nLzAqMRswGQYDVQQDDBJBc3Ryb1RsYWxvY+KAmXMgQ0ExCzAJBgNVBAYTAlVTAgEC\nMAsGCWCGSAFlAwQCAaBpMBgGCSqGSIb3DQEJAzELBgkqhkiG9w0BBwEwHAYJKoZI\nhvcNAQkFMQ8XDTIzMDkxODIzMjg1MFowLwYJKoZIhvcNAQkEMSIEIIFHI8Ick3Tu\nBlnfTU6v24ls8D+jGkpQoDK+MF4rk5iTMAsGCSqGSIb3DQEBCwSCAQC4nIUEB/bR\ngeXnO7KdtqRFn/slCNTKZaQObsyL7C7cmNYAlgQAYj/qOBhKGMd3ZAFHRUroCiCy\n5GPs1sEnPKT1Bh7E7HJbpfdMXZINxoiRBrwQpAD/UKxk6etF5qvtAwDJaFMZiTMh\nd6tPNVBcThhUglSqqQFT3BKE9z5KTGwonMeqZlyf/EpXRBn0YcaoWvcAzaahMBQw\nUPwwEtU3FVyYBbLQee0SoYDsddEjdaNN/37auMVIltYmKNq/A4KhJWduTGFcaD/k\nfcXIzhzBi4vk1No6y2ftDgbivxP3MVQyf1tIfD1fv9cw/55JnDRA3IXkQRc+yyUG\nGmHXpKHhqNKm\n-----END SIGNED MESSAGE-----", + "payload": null + } + }, + "url": "https://api.github.com/repos/hub4j/github-api/commits/86a2e245aa6d71d54923655066049d9e21a15f01", + "html_url": "https://github.com/hub4j/github-api/commit/86a2e245aa6d71d54923655066049d9e21a15f01", + "comments_url": "https://api.github.com/repos/hub4j/github-api/commits/86a2e245aa6d71d54923655066049d9e21a15f01/comments", + "author": { + "login": "kohsuke", + "id": 50003, + "node_id": "MDQ6VXNlcjUwMDAz", + "avatar_url": "https://avatars1.githubusercontent.com/u/50003?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/kohsuke", + "html_url": "https://github.com/kohsuke", + "followers_url": "https://api.github.com/users/kohsuke/followers", + "following_url": "https://api.github.com/users/kohsuke/following{/other_user}", + "gists_url": "https://api.github.com/users/kohsuke/gists{/gist_id}", + "starred_url": "https://api.github.com/users/kohsuke/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/kohsuke/subscriptions", + "organizations_url": "https://api.github.com/users/kohsuke/orgs", + "repos_url": "https://api.github.com/users/kohsuke/repos", + "events_url": "https://api.github.com/users/kohsuke/events{/privacy}", + "received_events_url": "https://api.github.com/users/kohsuke/received_events", + "type": "User", + "site_admin": false + }, + "committer": { + "login": "kohsuke", + "id": 50003, + "node_id": "MDQ6VXNlcjUwMDAz", + "avatar_url": "https://avatars1.githubusercontent.com/u/50003?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/kohsuke", + "html_url": "https://github.com/kohsuke", + "followers_url": "https://api.github.com/users/kohsuke/followers", + "following_url": "https://api.github.com/users/kohsuke/following{/other_user}", + "gists_url": "https://api.github.com/users/kohsuke/gists{/gist_id}", + "starred_url": "https://api.github.com/users/kohsuke/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/kohsuke/subscriptions", + "organizations_url": "https://api.github.com/users/kohsuke/orgs", + "repos_url": "https://api.github.com/users/kohsuke/repos", + "events_url": "https://api.github.com/users/kohsuke/events{/privacy}", + "received_events_url": "https://api.github.com/users/kohsuke/received_events", + "type": "User", + "site_admin": false + }, + "parents": [ + { + "sha": "ecbfdd7315ef2cf04b2be7f11a072ce0bd00c396", + "url": "https://api.github.com/repos/hub4j/github-api/commits/ecbfdd7315ef2cf04b2be7f11a072ce0bd00c396", + "html_url": "https://github.com/hub4j/github-api/commit/ecbfdd7315ef2cf04b2be7f11a072ce0bd00c396" + } + ], + "stats": { + "total": 3, + "additions": 3, + "deletions": 0 + }, + "files": [ + { + "sha": "2a2e1f77fd77bd03273946d893d25a455f696be0", + "filename": "README", + "status": "added", + "additions": 3, + "deletions": 0, + "changes": 3, + "blob_url": "https://github.com/hub4j/github-api/blob/86a2e245aa6d71d54923655066049d9e21a15f01/README", + "raw_url": "https://github.com/hub4j/github-api/raw/86a2e245aa6d71d54923655066049d9e21a15f01/README", + "contents_url": "https://api.github.com/repos/hub4j/github-api/contents/README?ref=86a2e245aa6d71d54923655066049d9e21a15f01", + "patch": "@@ -0,0 +1,3 @@\n+Java API for GitHub\n+\n+See http://kohsuke.org/github-api/ for more details" + } + ] +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHVerificationReasonTest/wiremock/testOscpPending/__files/user-1.json b/src/test/resources/org/kohsuke/github/GHVerificationReasonTest/wiremock/testOscpPending/__files/user-1.json new file mode 100644 index 0000000000..a4b576e8a7 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHVerificationReasonTest/wiremock/testOscpPending/__files/user-1.json @@ -0,0 +1,45 @@ +{ + "login": "bitwiseman", + "id": 1958953, + "node_id": "MDQ6VXNlcjE5NTg5NTM=", + "avatar_url": "https://avatars3.githubusercontent.com/u/1958953?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/bitwiseman", + "html_url": "https://github.com/bitwiseman", + "followers_url": "https://api.github.com/users/bitwiseman/followers", + "following_url": "https://api.github.com/users/bitwiseman/following{/other_user}", + "gists_url": "https://api.github.com/users/bitwiseman/gists{/gist_id}", + "starred_url": "https://api.github.com/users/bitwiseman/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/bitwiseman/subscriptions", + "organizations_url": "https://api.github.com/users/bitwiseman/orgs", + "repos_url": "https://api.github.com/users/bitwiseman/repos", + "events_url": "https://api.github.com/users/bitwiseman/events{/privacy}", + "received_events_url": "https://api.github.com/users/bitwiseman/received_events", + "type": "User", + "site_admin": false, + "name": "Liam Newman", + "company": "Cloudbees, Inc.", + "blog": "", + "location": "Seattle, WA, USA", + "email": "bitwiseman@gmail.com", + "hireable": null, + "bio": "https://twitter.com/bitwiseman", + "public_repos": 169, + "public_gists": 7, + "followers": 139, + "following": 9, + "created_at": "2012-07-11T20:38:33Z", + "updated_at": "2019-09-24T19:32:29Z", + "private_gists": 7, + "total_private_repos": 9, + "owned_private_repos": 0, + "disk_usage": 33697, + "collaborators": 0, + "two_factor_authentication": true, + "plan": { + "name": "free", + "space": 976562499, + "collaborators": 0, + "private_repos": 10000 + } +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHVerificationReasonTest/wiremock/testOscpPending/mappings/repos_hub4j_github-api-2.json b/src/test/resources/org/kohsuke/github/GHVerificationReasonTest/wiremock/testOscpPending/mappings/repos_hub4j_github-api-2.json new file mode 100644 index 0000000000..80fb7dfa4e --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHVerificationReasonTest/wiremock/testOscpPending/mappings/repos_hub4j_github-api-2.json @@ -0,0 +1,48 @@ +{ + "id": "441cdfd7-a44a-42b4-b732-57e674227760", + "name": "repos_hub4j_github-api", + "request": { + "url": "/repos/hub4j/github-api", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "application/vnd.github.v3+json" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "repos_hub4j_github-api-2.json", + "headers": { + "Date": "Sat, 26 Oct 2019 01:28:40 GMT", + "Content-Type": "application/json; charset=utf-8", + "Server": "GitHub.com", + "Status": "200 OK", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4295", + "X-RateLimit-Reset": "1572055286", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": [ + "Accept, Authorization, Cookie, X-GitHub-OTP", + "Accept-Encoding" + ], + "ETag": "W/\"c1a01d01a6354d93b3cc6098e0b2d047\"", + "Last-Modified": "Fri, 25 Oct 2019 01:32:16 GMT", + "X-OAuth-Scopes": "admin:org, admin:org_hook, admin:public_key, admin:repo_hook, delete_repo, gist, notifications, repo, user, write:discussion", + "X-Accepted-OAuth-Scopes": "repo", + "X-GitHub-Media-Type": "unknown, github.v3", + "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type", + "Access-Control-Allow-Origin": "*", + "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", + "X-Frame-Options": "deny", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "1; mode=block", + "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", + "Content-Security-Policy": "default-src 'none'", + "X-GitHub-Request-Id": "CB01:05A2:A65B56:C4A050:5DB3A147" + } + }, + "uuid": "441cdfd7-a44a-42b4-b732-57e674227760", + "persistent": true, + "insertionIndex": 2 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHVerificationReasonTest/wiremock/testOscpPending/mappings/repos_hub4j_github-api_commits_86a2e245aa6d71d54923655066049d9e21a15f01-3.json b/src/test/resources/org/kohsuke/github/GHVerificationReasonTest/wiremock/testOscpPending/mappings/repos_hub4j_github-api_commits_86a2e245aa6d71d54923655066049d9e21a15f01-3.json new file mode 100644 index 0000000000..6b5904361c --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHVerificationReasonTest/wiremock/testOscpPending/mappings/repos_hub4j_github-api_commits_86a2e245aa6d71d54923655066049d9e21a15f01-3.json @@ -0,0 +1,48 @@ +{ + "id": "d76abea9-c1be-430a-bbd0-28931c58e1e8", + "name": "repos_hub4j_github-api_commits_86a2e245aa6d71d54923655066049d9e21a15f01", + "request": { + "url": "/repos/hub4j/github-api/commits/86a2e245aa6d71d54923655066049d9e21a15f01", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "application/vnd.github.v3+json" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "repos_hub4j_github-api_commits_86a2e245aa6d71d54923655066049d9e21a15f01-3.json", + "headers": { + "Date": "Sat, 26 Oct 2019 01:28:40 GMT", + "Content-Type": "application/json; charset=utf-8", + "Server": "GitHub.com", + "Status": "200 OK", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4294", + "X-RateLimit-Reset": "1572055286", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": [ + "Accept, Authorization, Cookie, X-GitHub-OTP", + "Accept-Encoding" + ], + "ETag": "W/\"0a8c453e4290ce879ea09578e06a5961\"", + "Last-Modified": "Mon, 19 Apr 2010 04:12:41 GMT", + "X-OAuth-Scopes": "admin:org, admin:org_hook, admin:public_key, admin:repo_hook, delete_repo, gist, notifications, repo, user, write:discussion", + "X-Accepted-OAuth-Scopes": "", + "X-GitHub-Media-Type": "unknown, github.v3", + "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type", + "Access-Control-Allow-Origin": "*", + "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", + "X-Frame-Options": "deny", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "1; mode=block", + "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", + "Content-Security-Policy": "default-src 'none'", + "X-GitHub-Request-Id": "CB01:05A2:A65B5F:C4A064:5DB3A148" + } + }, + "uuid": "d76abea9-c1be-430a-bbd0-28931c58e1e8", + "persistent": true, + "insertionIndex": 3 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHVerificationReasonTest/wiremock/testOscpPending/mappings/user-1.json b/src/test/resources/org/kohsuke/github/GHVerificationReasonTest/wiremock/testOscpPending/mappings/user-1.json new file mode 100644 index 0000000000..7c0606ff2f --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHVerificationReasonTest/wiremock/testOscpPending/mappings/user-1.json @@ -0,0 +1,48 @@ +{ + "id": "c247f81b-84b8-44e9-820a-0a91dc74ce98", + "name": "user", + "request": { + "url": "/user", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "application/vnd.github.v3+json" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "user-1.json", + "headers": { + "Date": "Sat, 26 Oct 2019 01:28:39 GMT", + "Content-Type": "application/json; charset=utf-8", + "Server": "GitHub.com", + "Status": "200 OK", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4297", + "X-RateLimit-Reset": "1572055286", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": [ + "Accept, Authorization, Cookie, X-GitHub-OTP", + "Accept-Encoding" + ], + "ETag": "W/\"8c3d3dcf6fc5f9edaf26c902295396e5\"", + "Last-Modified": "Tue, 24 Sep 2019 19:32:29 GMT", + "X-OAuth-Scopes": "admin:org, admin:org_hook, admin:public_key, admin:repo_hook, delete_repo, gist, notifications, repo, user, write:discussion", + "X-Accepted-OAuth-Scopes": "", + "X-GitHub-Media-Type": "unknown, github.v3", + "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type", + "Access-Control-Allow-Origin": "*", + "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", + "X-Frame-Options": "deny", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "1; mode=block", + "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", + "Content-Security-Policy": "default-src 'none'", + "X-GitHub-Request-Id": "CB01:05A2:A65B49:C4A046:5DB3A147" + } + }, + "uuid": "c247f81b-84b8-44e9-820a-0a91dc74ce98", + "persistent": true, + "insertionIndex": 1 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHVerificationReasonTest/wiremock/testOscpRevoked/__files/repos_hub4j_github-api-2.json b/src/test/resources/org/kohsuke/github/GHVerificationReasonTest/wiremock/testOscpRevoked/__files/repos_hub4j_github-api-2.json new file mode 100644 index 0000000000..43ee270874 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHVerificationReasonTest/wiremock/testOscpRevoked/__files/repos_hub4j_github-api-2.json @@ -0,0 +1,130 @@ +{ + "id": 617210, + "node_id": "MDEwOlJlcG9zaXRvcnk2MTcyMTA=", + "name": "github-api", + "full_name": "hub4j/github-api", + "private": false, + "owner": { + "login": "hub4j", + "id": 54909825, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjU0OTA5ODI1", + "avatar_url": "https://avatars3.githubusercontent.com/u/54909825?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/hub4j", + "html_url": "https://github.com/hub4j", + "followers_url": "https://api.github.com/users/hub4j/followers", + "following_url": "https://api.github.com/users/hub4j/following{/other_user}", + "gists_url": "https://api.github.com/users/hub4j/gists{/gist_id}", + "starred_url": "https://api.github.com/users/hub4j/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/hub4j/subscriptions", + "organizations_url": "https://api.github.com/users/hub4j/orgs", + "repos_url": "https://api.github.com/users/hub4j/repos", + "events_url": "https://api.github.com/users/hub4j/events{/privacy}", + "received_events_url": "https://api.github.com/users/hub4j/received_events", + "type": "Organization", + "site_admin": false + }, + "html_url": "https://github.com/hub4j/github-api", + "description": "Java API for GitHub", + "fork": false, + "url": "https://api.github.com/repos/hub4j/github-api", + "forks_url": "https://api.github.com/repos/hub4j/github-api/forks", + "keys_url": "https://api.github.com/repos/hub4j/github-api/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/hub4j/github-api/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/hub4j/github-api/teams", + "hooks_url": "https://api.github.com/repos/hub4j/github-api/hooks", + "issue_events_url": "https://api.github.com/repos/hub4j/github-api/issues/events{/number}", + "events_url": "https://api.github.com/repos/hub4j/github-api/events", + "assignees_url": "https://api.github.com/repos/hub4j/github-api/assignees{/user}", + "branches_url": "https://api.github.com/repos/hub4j/github-api/branches{/branch}", + "tags_url": "https://api.github.com/repos/hub4j/github-api/tags", + "blobs_url": "https://api.github.com/repos/hub4j/github-api/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/hub4j/github-api/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/hub4j/github-api/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/hub4j/github-api/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/hub4j/github-api/statuses/{sha}", + "languages_url": "https://api.github.com/repos/hub4j/github-api/languages", + "stargazers_url": "https://api.github.com/repos/hub4j/github-api/stargazers", + "contributors_url": "https://api.github.com/repos/hub4j/github-api/contributors", + "subscribers_url": "https://api.github.com/repos/hub4j/github-api/subscribers", + "subscription_url": "https://api.github.com/repos/hub4j/github-api/subscription", + "commits_url": "https://api.github.com/repos/hub4j/github-api/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/hub4j/github-api/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/hub4j/github-api/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/hub4j/github-api/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/hub4j/github-api/contents/{+path}", + "compare_url": "https://api.github.com/repos/hub4j/github-api/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/hub4j/github-api/merges", + "archive_url": "https://api.github.com/repos/hub4j/github-api/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/hub4j/github-api/downloads", + "issues_url": "https://api.github.com/repos/hub4j/github-api/issues{/number}", + "pulls_url": "https://api.github.com/repos/hub4j/github-api/pulls{/number}", + "milestones_url": "https://api.github.com/repos/hub4j/github-api/milestones{/number}", + "notifications_url": "https://api.github.com/repos/hub4j/github-api/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/hub4j/github-api/labels{/name}", + "releases_url": "https://api.github.com/repos/hub4j/github-api/releases{/id}", + "deployments_url": "https://api.github.com/repos/hub4j/github-api/deployments", + "created_at": "2010-04-19T04:13:03Z", + "updated_at": "2019-10-25T01:32:16Z", + "pushed_at": "2019-10-25T16:41:09Z", + "git_url": "git://github.com/hub4j/github-api.git", + "ssh_url": "git@github.com:hub4j/github-api.git", + "clone_url": "https://github.com/hub4j/github-api.git", + "svn_url": "https://github.com/hub4j/github-api", + "homepage": "http://github-api.kohsuke.org/", + "size": 13494, + "stargazers_count": 565, + "watchers_count": 565, + "language": "Java", + "has_issues": true, + "has_projects": true, + "has_downloads": true, + "has_wiki": true, + "has_pages": true, + "forks_count": 433, + "mirror_url": null, + "archived": false, + "disabled": false, + "open_issues_count": 64, + "license": { + "key": "mit", + "name": "MIT License", + "spdx_id": "MIT", + "url": "https://api.github.com/licenses/mit", + "node_id": "MDc6TGljZW5zZTEz" + }, + "forks": 433, + "open_issues": 64, + "watchers": 565, + "default_branch": "main", + "permissions": { + "admin": true, + "push": true, + "pull": true + }, + "allow_squash_merge": true, + "allow_merge_commit": true, + "allow_rebase_merge": true, + "organization": { + "login": "hub4j", + "id": 54909825, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjU0OTA5ODI1", + "avatar_url": "https://avatars3.githubusercontent.com/u/54909825?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/hub4j", + "html_url": "https://github.com/hub4j", + "followers_url": "https://api.github.com/users/hub4j/followers", + "following_url": "https://api.github.com/users/hub4j/following{/other_user}", + "gists_url": "https://api.github.com/users/hub4j/gists{/gist_id}", + "starred_url": "https://api.github.com/users/hub4j/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/hub4j/subscriptions", + "organizations_url": "https://api.github.com/users/hub4j/orgs", + "repos_url": "https://api.github.com/users/hub4j/repos", + "events_url": "https://api.github.com/users/hub4j/events{/privacy}", + "received_events_url": "https://api.github.com/users/hub4j/received_events", + "type": "Organization", + "site_admin": false + }, + "network_count": 433, + "subscribers_count": 48 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHVerificationReasonTest/wiremock/testOscpRevoked/__files/repos_hub4j_github-api_commits_86a2e245aa6d71d54923655066049d9e21a15f01-3.json b/src/test/resources/org/kohsuke/github/GHVerificationReasonTest/wiremock/testOscpRevoked/__files/repos_hub4j_github-api_commits_86a2e245aa6d71d54923655066049d9e21a15f01-3.json new file mode 100644 index 0000000000..26aa4fc983 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHVerificationReasonTest/wiremock/testOscpRevoked/__files/repos_hub4j_github-api_commits_86a2e245aa6d71d54923655066049d9e21a15f01-3.json @@ -0,0 +1,98 @@ +{ + "sha": "86a2e245aa6d71d54923655066049d9e21a15f01", + "node_id": "MDY6Q29tbWl0NjE3MjEwOjg2YTJlMjQ1YWE2ZDcxZDU0OTIzNjU1MDY2MDQ5ZDllMjFhMTVmMjM=", + "commit": { + "author": { + "name": "Sourabh Parkala", + "email": "sourabh.sarvotham.parkala@sap.com", + "date": "2010-04-19T04:12:41Z" + }, + "committer": { + "name": "Sourabh Parkala", + "email": "sourabh.sarvotham.parkala@sap.com", + "date": "2010-04-19T04:12:41Z" + }, + "message": "doc", + "tree": { + "sha": "17ed4173aeb2e98c93216e8b6e16138dc7f8cd91", + "url": "https://api.github.com/repos/hub4j/github-api/git/trees/17ed4173aeb2e98c93216e8b6e16138dc7f8cd91" + }, + "url": "https://api.github.com/repos/hub4j/github-api/git/commits/86a2e245aa6d71d54923655066049d9e21a15f01", + "comment_count": 0, + "verification": { + "verified": false, + "reason": "ocsp_revoked", + "signature": "-----BEGIN SIGNED MESSAGE-----\nMIIFdQYJKoZIhvcNAQcCoIIFZjCCBWICAQExDTALBglghkgBZQMEAgEwCwYJKoZI\nhvcNAQcBoIIDejCCA3YwggJeoAMCAQICAQIwDQYJKoZIhvcNAQELBQAwKjEbMBkG\nA1UEAwwSQXN0cm9UbGFsb2PigJlzIENBMQswCQYDVQQGEwJVUzAeFw0yMzA5MTgy\nMzI2MDlaFw0yNDA5MTcyMzI2MDlaMEYxFDASBgNVBAMMC0FzdHJvVGxhbG9jMQsw\nCQYDVQQGEwJVUzEhMB8GCSqGSIb3DQEJARYSMHhUbGFsb2NAZ21haWwuY29tMIIB\nIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA+Zq+N5v68htABs4ZLPORns/F\nzixnI+6L+WaVGeQFzxIBs9zsm9IRGJ4xoMBPSg1BuoilRXzsQoCH6+5zyQ4jaHMa\nHBBEijVM7kor3Um+35KdYh79nIY7ZQoDRypLF02FiqfNjhN8Nm8ciNf2EUkiGIcj\n/+TPhVFMxnwlZ2SmSJoMBE5pkDBllb/8kfxgenSoVLXaOigYJ1It6AqH2L8Ju9pa\nJ1zJGu2edjN6xi/0yjzZ7CmPFbnWcY5flJfMqdaj0Po3dMwYKYK07rE7KQHc8wFT\ngAUtQNtJkGBjEcTBh1B7SUsnJ/x4XcSQwOMxPNSm4Esn2RWanJYunez75eCWlwID\nAQABo4GKMIGHMA4GA1UdDwEB/wQEAwIFoDAWBgNVHSUBAf8EDDAKBggrBgEFBQcD\nBDAdBgNVHQ4EFgQUSi5d7oqzSYNhpeG4I2VNF9j881UwHwYDVR0jBBgwFoAULCWl\nbibBiKOX/6M3RWgIlSPM7dcwHQYDVR0RBBYwFIESMHhUbGFsb2NAZ21haWwuY29t\nMA0GCSqGSIb3DQEBCwUAA4IBAQDSn3caORjlSXCSm8ZY1uAbG+IngvEooIJvbl+y\n0yglPA3pkWybXxLfvayJVRGtNgLambnPpulzZmdwjj7qSTzd9K/+OIsI2qjNrZZ+\napXJLhlfabNHzydj0y0DUWgbtKzQ1SVhWgglHaCp440UmVAi0PtsMy3F1S5S0HlZ\n80V1CE3r7UYsC64GG3CmyXVf5MB+pzPriE729Gglig5z6rq8F+GNk5hJW7tOKBRb\nCyXFkqbkMWHPJ/CP5wrFjrEITsn8fIhlJsYRIAGzTnffCOs9i3rMpUTXRBOwSVMB\nI1I3VPm+WxVE7O9NY7TGBDe7010D4DorTNUPYo8xsPtKYyrpMYIBwTCCAb0CAQEw\nLzAqMRswGQYDVQQDDBJBc3Ryb1RsYWxvY+KAmXMgQ0ExCzAJBgNVBAYTAlVTAgEC\nMAsGCWCGSAFlAwQCAaBpMBgGCSqGSIb3DQEJAzELBgkqhkiG9w0BBwEwHAYJKoZI\nhvcNAQkFMQ8XDTIzMDkxODIzMjg1MFowLwYJKoZIhvcNAQkEMSIEIIFHI8Ick3Tu\nBlnfTU6v24ls8D+jGkpQoDK+MF4rk5iTMAsGCSqGSIb3DQEBCwSCAQC4nIUEB/bR\ngeXnO7KdtqRFn/slCNTKZaQObsyL7C7cmNYAlgQAYj/qOBhKGMd3ZAFHRUroCiCy\n5GPs1sEnPKT1Bh7E7HJbpfdMXZINxoiRBrwQpAD/UKxk6etF5qvtAwDJaFMZiTMh\nd6tPNVBcThhUglSqqQFT3BKE9z5KTGwonMeqZlyf/EpXRBn0YcaoWvcAzaahMBQw\nUPwwEtU3FVyYBbLQee0SoYDsddEjdaNN/37auMVIltYmKNq/A4KhJWduTGFcaD/k\nfcXIzhzBi4vk1No6y2ftDgbivxP3MVQyf1tIfD1fv9cw/55JnDRA3IXkQRc+yyUG\nGmHXpKHhqNKm\n-----END SIGNED MESSAGE-----", + "payload": null + } + }, + "url": "https://api.github.com/repos/hub4j/github-api/commits/86a2e245aa6d71d54923655066049d9e21a15f01", + "html_url": "https://github.com/hub4j/github-api/commit/86a2e245aa6d71d54923655066049d9e21a15f01", + "comments_url": "https://api.github.com/repos/hub4j/github-api/commits/86a2e245aa6d71d54923655066049d9e21a15f01/comments", + "author": { + "login": "kohsuke", + "id": 50003, + "node_id": "MDQ6VXNlcjUwMDAz", + "avatar_url": "https://avatars1.githubusercontent.com/u/50003?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/kohsuke", + "html_url": "https://github.com/kohsuke", + "followers_url": "https://api.github.com/users/kohsuke/followers", + "following_url": "https://api.github.com/users/kohsuke/following{/other_user}", + "gists_url": "https://api.github.com/users/kohsuke/gists{/gist_id}", + "starred_url": "https://api.github.com/users/kohsuke/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/kohsuke/subscriptions", + "organizations_url": "https://api.github.com/users/kohsuke/orgs", + "repos_url": "https://api.github.com/users/kohsuke/repos", + "events_url": "https://api.github.com/users/kohsuke/events{/privacy}", + "received_events_url": "https://api.github.com/users/kohsuke/received_events", + "type": "User", + "site_admin": false + }, + "committer": { + "login": "kohsuke", + "id": 50003, + "node_id": "MDQ6VXNlcjUwMDAz", + "avatar_url": "https://avatars1.githubusercontent.com/u/50003?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/kohsuke", + "html_url": "https://github.com/kohsuke", + "followers_url": "https://api.github.com/users/kohsuke/followers", + "following_url": "https://api.github.com/users/kohsuke/following{/other_user}", + "gists_url": "https://api.github.com/users/kohsuke/gists{/gist_id}", + "starred_url": "https://api.github.com/users/kohsuke/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/kohsuke/subscriptions", + "organizations_url": "https://api.github.com/users/kohsuke/orgs", + "repos_url": "https://api.github.com/users/kohsuke/repos", + "events_url": "https://api.github.com/users/kohsuke/events{/privacy}", + "received_events_url": "https://api.github.com/users/kohsuke/received_events", + "type": "User", + "site_admin": false + }, + "parents": [ + { + "sha": "ecbfdd7315ef2cf04b2be7f11a072ce0bd00c396", + "url": "https://api.github.com/repos/hub4j/github-api/commits/ecbfdd7315ef2cf04b2be7f11a072ce0bd00c396", + "html_url": "https://github.com/hub4j/github-api/commit/ecbfdd7315ef2cf04b2be7f11a072ce0bd00c396" + } + ], + "stats": { + "total": 3, + "additions": 3, + "deletions": 0 + }, + "files": [ + { + "sha": "2a2e1f77fd77bd03273946d893d25a455f696be0", + "filename": "README", + "status": "added", + "additions": 3, + "deletions": 0, + "changes": 3, + "blob_url": "https://github.com/hub4j/github-api/blob/86a2e245aa6d71d54923655066049d9e21a15f01/README", + "raw_url": "https://github.com/hub4j/github-api/raw/86a2e245aa6d71d54923655066049d9e21a15f01/README", + "contents_url": "https://api.github.com/repos/hub4j/github-api/contents/README?ref=86a2e245aa6d71d54923655066049d9e21a15f01", + "patch": "@@ -0,0 +1,3 @@\n+Java API for GitHub\n+\n+See http://kohsuke.org/github-api/ for more details" + } + ] +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHVerificationReasonTest/wiremock/testOscpRevoked/__files/user-1.json b/src/test/resources/org/kohsuke/github/GHVerificationReasonTest/wiremock/testOscpRevoked/__files/user-1.json new file mode 100644 index 0000000000..a4b576e8a7 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHVerificationReasonTest/wiremock/testOscpRevoked/__files/user-1.json @@ -0,0 +1,45 @@ +{ + "login": "bitwiseman", + "id": 1958953, + "node_id": "MDQ6VXNlcjE5NTg5NTM=", + "avatar_url": "https://avatars3.githubusercontent.com/u/1958953?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/bitwiseman", + "html_url": "https://github.com/bitwiseman", + "followers_url": "https://api.github.com/users/bitwiseman/followers", + "following_url": "https://api.github.com/users/bitwiseman/following{/other_user}", + "gists_url": "https://api.github.com/users/bitwiseman/gists{/gist_id}", + "starred_url": "https://api.github.com/users/bitwiseman/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/bitwiseman/subscriptions", + "organizations_url": "https://api.github.com/users/bitwiseman/orgs", + "repos_url": "https://api.github.com/users/bitwiseman/repos", + "events_url": "https://api.github.com/users/bitwiseman/events{/privacy}", + "received_events_url": "https://api.github.com/users/bitwiseman/received_events", + "type": "User", + "site_admin": false, + "name": "Liam Newman", + "company": "Cloudbees, Inc.", + "blog": "", + "location": "Seattle, WA, USA", + "email": "bitwiseman@gmail.com", + "hireable": null, + "bio": "https://twitter.com/bitwiseman", + "public_repos": 169, + "public_gists": 7, + "followers": 139, + "following": 9, + "created_at": "2012-07-11T20:38:33Z", + "updated_at": "2019-09-24T19:32:29Z", + "private_gists": 7, + "total_private_repos": 9, + "owned_private_repos": 0, + "disk_usage": 33697, + "collaborators": 0, + "two_factor_authentication": true, + "plan": { + "name": "free", + "space": 976562499, + "collaborators": 0, + "private_repos": 10000 + } +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHVerificationReasonTest/wiremock/testOscpRevoked/mappings/repos_hub4j_github-api-2.json b/src/test/resources/org/kohsuke/github/GHVerificationReasonTest/wiremock/testOscpRevoked/mappings/repos_hub4j_github-api-2.json new file mode 100644 index 0000000000..80fb7dfa4e --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHVerificationReasonTest/wiremock/testOscpRevoked/mappings/repos_hub4j_github-api-2.json @@ -0,0 +1,48 @@ +{ + "id": "441cdfd7-a44a-42b4-b732-57e674227760", + "name": "repos_hub4j_github-api", + "request": { + "url": "/repos/hub4j/github-api", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "application/vnd.github.v3+json" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "repos_hub4j_github-api-2.json", + "headers": { + "Date": "Sat, 26 Oct 2019 01:28:40 GMT", + "Content-Type": "application/json; charset=utf-8", + "Server": "GitHub.com", + "Status": "200 OK", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4295", + "X-RateLimit-Reset": "1572055286", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": [ + "Accept, Authorization, Cookie, X-GitHub-OTP", + "Accept-Encoding" + ], + "ETag": "W/\"c1a01d01a6354d93b3cc6098e0b2d047\"", + "Last-Modified": "Fri, 25 Oct 2019 01:32:16 GMT", + "X-OAuth-Scopes": "admin:org, admin:org_hook, admin:public_key, admin:repo_hook, delete_repo, gist, notifications, repo, user, write:discussion", + "X-Accepted-OAuth-Scopes": "repo", + "X-GitHub-Media-Type": "unknown, github.v3", + "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type", + "Access-Control-Allow-Origin": "*", + "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", + "X-Frame-Options": "deny", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "1; mode=block", + "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", + "Content-Security-Policy": "default-src 'none'", + "X-GitHub-Request-Id": "CB01:05A2:A65B56:C4A050:5DB3A147" + } + }, + "uuid": "441cdfd7-a44a-42b4-b732-57e674227760", + "persistent": true, + "insertionIndex": 2 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHVerificationReasonTest/wiremock/testOscpRevoked/mappings/repos_hub4j_github-api_commits_86a2e245aa6d71d54923655066049d9e21a15f01-3.json b/src/test/resources/org/kohsuke/github/GHVerificationReasonTest/wiremock/testOscpRevoked/mappings/repos_hub4j_github-api_commits_86a2e245aa6d71d54923655066049d9e21a15f01-3.json new file mode 100644 index 0000000000..6b5904361c --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHVerificationReasonTest/wiremock/testOscpRevoked/mappings/repos_hub4j_github-api_commits_86a2e245aa6d71d54923655066049d9e21a15f01-3.json @@ -0,0 +1,48 @@ +{ + "id": "d76abea9-c1be-430a-bbd0-28931c58e1e8", + "name": "repos_hub4j_github-api_commits_86a2e245aa6d71d54923655066049d9e21a15f01", + "request": { + "url": "/repos/hub4j/github-api/commits/86a2e245aa6d71d54923655066049d9e21a15f01", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "application/vnd.github.v3+json" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "repos_hub4j_github-api_commits_86a2e245aa6d71d54923655066049d9e21a15f01-3.json", + "headers": { + "Date": "Sat, 26 Oct 2019 01:28:40 GMT", + "Content-Type": "application/json; charset=utf-8", + "Server": "GitHub.com", + "Status": "200 OK", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4294", + "X-RateLimit-Reset": "1572055286", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": [ + "Accept, Authorization, Cookie, X-GitHub-OTP", + "Accept-Encoding" + ], + "ETag": "W/\"0a8c453e4290ce879ea09578e06a5961\"", + "Last-Modified": "Mon, 19 Apr 2010 04:12:41 GMT", + "X-OAuth-Scopes": "admin:org, admin:org_hook, admin:public_key, admin:repo_hook, delete_repo, gist, notifications, repo, user, write:discussion", + "X-Accepted-OAuth-Scopes": "", + "X-GitHub-Media-Type": "unknown, github.v3", + "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type", + "Access-Control-Allow-Origin": "*", + "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", + "X-Frame-Options": "deny", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "1; mode=block", + "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", + "Content-Security-Policy": "default-src 'none'", + "X-GitHub-Request-Id": "CB01:05A2:A65B5F:C4A064:5DB3A148" + } + }, + "uuid": "d76abea9-c1be-430a-bbd0-28931c58e1e8", + "persistent": true, + "insertionIndex": 3 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHVerificationReasonTest/wiremock/testOscpRevoked/mappings/user-1.json b/src/test/resources/org/kohsuke/github/GHVerificationReasonTest/wiremock/testOscpRevoked/mappings/user-1.json new file mode 100644 index 0000000000..7c0606ff2f --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHVerificationReasonTest/wiremock/testOscpRevoked/mappings/user-1.json @@ -0,0 +1,48 @@ +{ + "id": "c247f81b-84b8-44e9-820a-0a91dc74ce98", + "name": "user", + "request": { + "url": "/user", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "application/vnd.github.v3+json" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "user-1.json", + "headers": { + "Date": "Sat, 26 Oct 2019 01:28:39 GMT", + "Content-Type": "application/json; charset=utf-8", + "Server": "GitHub.com", + "Status": "200 OK", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4297", + "X-RateLimit-Reset": "1572055286", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": [ + "Accept, Authorization, Cookie, X-GitHub-OTP", + "Accept-Encoding" + ], + "ETag": "W/\"8c3d3dcf6fc5f9edaf26c902295396e5\"", + "Last-Modified": "Tue, 24 Sep 2019 19:32:29 GMT", + "X-OAuth-Scopes": "admin:org, admin:org_hook, admin:public_key, admin:repo_hook, delete_repo, gist, notifications, repo, user, write:discussion", + "X-Accepted-OAuth-Scopes": "", + "X-GitHub-Media-Type": "unknown, github.v3", + "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type", + "Access-Control-Allow-Origin": "*", + "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", + "X-Frame-Options": "deny", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "1; mode=block", + "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", + "Content-Security-Policy": "default-src 'none'", + "X-GitHub-Request-Id": "CB01:05A2:A65B49:C4A046:5DB3A147" + } + }, + "uuid": "c247f81b-84b8-44e9-820a-0a91dc74ce98", + "persistent": true, + "insertionIndex": 1 +} \ No newline at end of file diff --git a/src/test/resources/slow-or-flaky-tests.txt b/src/test/resources/slow-or-flaky-tests.txt index e0aa93a72e..6b1b48fe7b 100644 --- a/src/test/resources/slow-or-flaky-tests.txt +++ b/src/test/resources/slow-or-flaky-tests.txt @@ -1,5 +1,6 @@ **/extras/** **/GHRateLimitTest +**/GHPullRequestTest **/RequesterRetryTest **/RateLimitCheckerTest **/RateLimitHandlerTest