Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ jobs:

- name: Ensure sigstore-java self signing still works
if: ${{ !github.event.pull_request.head.repo.fork }}
run: ./gradlew -Porg.gradle.java.installations.auto-download=false sigstore-java:publishToMavenLocal -Prelease -PskipPgpSigning
run: ./gradlew -Porg.gradle.java.installations.auto-download=false nmcpPublishAggregationToMavenLocal -Prelease -PskipPgpSigning

- name: Test sigstore-java/sandbox
run: |
Expand Down
1 change: 1 addition & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ repositories {
}

dependencies {
nmcpAggregation(project(":sigstore-common"))
nmcpAggregation(project(":sigstore-java"))
nmcpAggregation(project(":sigstore-maven-plugin"))
}
3 changes: 3 additions & 0 deletions config/forbiddenApis-common.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
dev.sigstore.common.http.HttpClients#newHttpTransport(dev.sigstore.common.http.HttpParams) @ Use dev.sigstore.common.http.HttpClients#newRequestFactory(...) instead
java.net.URI#resolve(java.lang.String) @ Use dev.sigstore.common.http.URIFormat#appendPath(java.net.URI, java.lang.String) instead
java.net.URI#resolve(java.net.URI) @ Use dev.sigstore.common.http.URIFormat#appendPath(java.net.URI, java.lang.String) instead
3 changes: 0 additions & 3 deletions config/forbiddenApis.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,2 @@
com.google.protobuf.util.JsonFormat#parser() @ Use dev.sigstore.json.ProtoJson#parser() instead
dev.sigstore.http.HttpClients#newHttpTransport(dev.sigstore.http.HttpParams) @ Use dev.sigstore.http.HttpClients#newRequestFactory(...) instead
com.google.gson.GsonBuilder @ Use dev.sigstore.json.GsonSupplier.GSON instead
java.net.URI#resolve(java.lang.String) @ Use dev.sigstore.http.URIFormat#appendPath(java.net.URI, java.lang.String) instead
java.net.URI#resolve(java.net.URI) @ Use dev.sigstore.http.URIFormat#appendPath(java.net.URI, java.lang.String) instead
4 changes: 2 additions & 2 deletions fuzzing/src/main/java/fuzzing/JsonCanonicalizerFuzzer.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
package fuzzing;

import com.code_intelligence.jazzer.api.FuzzedDataProvider;
import dev.sigstore.json.canonicalizer.JsonCanonicalizer;
import dev.sigstore.json.canonicalizer.NumberToJSON;
import dev.sigstore.common.json.canonicalizer.JsonCanonicalizer;
import dev.sigstore.common.json.canonicalizer.NumberToJSON;
import java.io.IOException;
import java.nio.charset.StandardCharsets;

Expand Down
27 changes: 27 additions & 0 deletions sandbox/module-test/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
plugins {
`java-base`
id("java")
}

group = "com.example.sigstore-gradle-sandbox"
version = "1.0.0"

repositories {
mavenLocal()
mavenCentral()
}

val sigstoreVersion = "2.4.0-SNAPSHOT"

dependencies {
implementation("dev.sigstore:sigstore-common:$sigstoreVersion")

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we check that this actually fails? like if we add a conflicting package somewhere and then checking for failure?

implementation("dev.sigstore:sigstore-java:$sigstoreVersion")
}

tasks.compileJava {
options.compilerArgumentProviders.add(CommandLineArgumentProvider {
listOf(
"--module-path", classpath.asPath,
)
})
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*
* Copyright 2026 The Sigstore Authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package dev.sigstore.sandbox.modular;

import dev.sigstore.KeylessSigner;
import dev.sigstore.common.json.GsonChecked;

public class Main {
public static void main(String[] args) {
System.out.println(KeylessSigner.class.getName());
System.out.println(GsonChecked.class.getName());
}
}
19 changes: 19 additions & 0 deletions sandbox/module-test/src/main/java/module-info.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/*
* Copyright 2026 The Sigstore Authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
module dev.sigstore.sandbox.modular {
requires dev.sigstore;
requires dev.sigstore.common;
}
1 change: 1 addition & 0 deletions sandbox/settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ rootProject.name = "sigstore-sandbox"
include("gradle-sign-file")
include("gradle-sign-java-library")
include("gradle-precompiled-plugin")
include("module-test")

// Include dev.sigstore.sign plugin
includeBuild("../")
1 change: 1 addition & 0 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ if (!System.getenv("CIFUZZ").equals("true", ignoreCase = true) && JavaVersion.cu
includeBuild("build-logic-commons")
includeBuild("build-logic")

include("sigstore-common")
include("sigstore-java")
include("sigstore-gradle:sigstore-gradle-sign-base-plugin")
include("sigstore-gradle:sigstore-gradle-sign-plugin")
Expand Down
52 changes: 52 additions & 0 deletions sigstore-common/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
plugins {
id("build-logic.java-published-library")
id("build-logic.test-junit5")
id("build-logic.build-info")
}

description = "Common utilities for Sigstore Java"

tasks.jar {
manifest {
attributes["Automatic-Module-Name"] = "dev.sigstore.common"
}
}

dependencies {
compileOnly("org.immutables:value-annotations:2.12.2")
annotationProcessor("org.immutables:value:2.12.2")
api(platform("com.google.http-client:google-http-client-bom:2.2.0"))
api("com.google.http-client:google-http-client-apache-v5")
api("com.google.http-client:google-http-client-gson")
api("com.google.code.gson:gson:2.14.0")

testImplementation(platform("org.junit:junit-bom:5.14.4"))
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine")
testImplementation("org.assertj:assertj-core:3.27.7")
testImplementation(platform("org.mockito:mockito-bom:5.23.0"))
testImplementation("org.mockito:mockito-core")
testImplementation("org.mockito:mockito-junit-jupiter")
}

forbiddenApis {
signaturesFiles = files("$rootDir/config/forbiddenApis-common.txt")
suppressAnnotations = setOf("dev.sigstore.common.forbidden.SuppressForbidden")
}

tasks.generateBuildInfo {
packageName.set("dev.sigstore.common.buildinfo")
}

spotless {
java {
targetExclude(
"build/**/*.java",
"src/*/java/dev/sigstore/common/json/canonicalizer/*.java",
)
}
format("webPki", com.diffplug.gradle.spotless.JavaExtension::class.java) {
googleJavaFormat("1.35.0")
licenseHeaderFile("$rootDir/config/webPKILicenseHeader")
target("src/*/java/dev/sigstore/common/json/canonicalizer/*.java")
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package dev.sigstore.forbidden;
package dev.sigstore.common.forbidden;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package dev.sigstore.http;
package dev.sigstore.common.http;

import com.google.api.client.http.HttpBackOffIOExceptionHandler;
import com.google.api.client.http.HttpRequestFactory;
import com.google.api.client.http.HttpTransport;
import com.google.api.client.http.apache.v5.Apache5HttpTransport;
import com.google.api.client.util.ExponentialBackOff;
import com.google.api.client.util.ObjectParser;
import dev.sigstore.forbidden.SuppressForbidden;
import dev.sigstore.common.forbidden.SuppressForbidden;
import javax.annotation.Nullable;
import org.apache.hc.client5.http.config.ConnectionConfig;
import org.apache.hc.client5.http.impl.io.PoolingHttpClientConnectionManagerBuilder;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package dev.sigstore.http;
package dev.sigstore.common.http;

import com.google.api.client.util.Preconditions;
import dev.sigstore.buildinfo.BuildInfo;
import dev.sigstore.common.buildinfo.BuildInfo;
import org.immutables.value.Value;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package dev.sigstore.http;
package dev.sigstore.common.http;

import dev.sigstore.forbidden.SuppressForbidden;
import dev.sigstore.common.forbidden.SuppressForbidden;
import java.net.URI;
import java.net.URISyntaxException;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package dev.sigstore.http;
package dev.sigstore.common.http;

import com.google.api.client.http.HttpRequest;
import com.google.api.client.http.HttpResponse;
Expand All @@ -22,7 +22,6 @@
import com.google.api.client.util.BackOffUtils;
import com.google.api.client.util.ExponentialBackOff;
import com.google.api.client.util.Sleeper;
import com.google.common.annotations.VisibleForTesting;
import java.io.IOException;
import java.time.Instant;
import java.util.logging.Logger;
Expand Down Expand Up @@ -50,7 +49,7 @@ public static UnsuccessfulResponseHandler newUnsuccessfulResponseHandler() {
return new UnsuccessfulResponseHandler(Sleeper.DEFAULT, new ExponentialBackOff());
}

@VisibleForTesting

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

perhaps a comment here if we're removing the annotation

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a comment.

// package-private for testing
UnsuccessfulResponseHandler(Sleeper sleeper, ExponentialBackOff exponentialBackOff) {
this.sleeper = sleeper;
this.exponentialBackOff = exponentialBackOff;
Expand Down Expand Up @@ -110,7 +109,6 @@ private boolean handleRetryAfter(String retryAfter) throws InterruptedException,
}

// backoff in milliseconds
@VisibleForTesting
long calculateBackoff(String retryAfter, Instant now) throws NumberFormatException {
// parse as httpdate
var date = DateUtils.parseDate(retryAfter);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package dev.sigstore.json;
package dev.sigstore.common.json;

import com.google.gson.JsonParseException;
import com.google.gson.TypeAdapter;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package dev.sigstore.json;
package dev.sigstore.common.json;

import com.google.gson.Gson;
import com.google.gson.JsonElement;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package dev.sigstore.json;
package dev.sigstore.common.json;

public class JsonParseException extends Exception {
public JsonParseException(Throwable cause) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package dev.sigstore.json.canonicalizer;
package dev.sigstore.common.json.canonicalizer;

import java.io.IOException;
import java.nio.charset.StandardCharsets;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package dev.sigstore.json.canonicalizer;
package dev.sigstore.common.json.canonicalizer;

import java.io.IOException;
import java.math.BigInteger;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* thread</a> and <a href="https://github.com/theupdateframework/python-tuf/issues/457">related
* issue</a>.
*
* <p>There is just a minor edit to {@link dev.sigstore.json.canonicalizer.JsonCanonicalizer} line
* 43.
* <p>There is just a minor edit to {@link dev.sigstore.common.json.canonicalizer.JsonCanonicalizer}
* line 43.
*/
package dev.sigstore.json.canonicalizer;
package dev.sigstore.common.json.canonicalizer;
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package dev.sigstore.http;
package dev.sigstore.common.http;

import static org.junit.jupiter.api.Assertions.assertEquals;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package dev.sigstore.http;
package dev.sigstore.common.http;

import com.google.api.client.http.HttpHeaders;
import com.google.api.client.http.HttpResponse;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ description = "Gradle plugin with the base set of tasks and configurations for S
dependencies {
compileOnly(project(":sigstore-java"))

sigstoreJavaRuntime(project(":sigstore-common"))
sigstoreJavaRuntime(project(":sigstore-java")) {
because("Test code needs access locally-built sigstore-java as a Maven repository")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ description = "Gradle plugin to that automatically signs all Publications in Sig
dependencies {
api(project(":sigstore-gradle:sigstore-gradle-sign-base-plugin"))

sigstoreJavaRuntime(project(":sigstore-common"))
sigstoreJavaRuntime(project(":sigstore-java")) {
because("Test code needs access locally-built sigstore-java as a Maven repository")
}
Expand Down
Loading
Loading