Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
7c4833c
Fix jackson version security vulnerability (#407)
bhanurp Jul 24, 2025
19e148e
Multiple security fixes
bhanurp Jul 25, 2025
bce211d
Revert the version which is not available for java8
bhanurp Jul 25, 2025
443bbd9
"adding script to ensure artifactory running"
nitinp19 Jul 28, 2025
68e1a02
"fix for the failed test cases"
nitinp19 Aug 4, 2025
027d5b6
Revert ""adding script to ensure artifactory running""
nitinp19 Aug 4, 2025
d54df2e
Revert ""fix for the failed test cases""
nitinp19 Aug 4, 2025
3b01c28
"adding wait for artifactory"
nitinp19 Aug 4, 2025
f815c7d
"check with new implementation"
nitinp19 Aug 4, 2025
674d609
"disable remote indexing for gems for bypassing lock"
nitinp19 Aug 5, 2025
e61b761
"fixing the slf4j warning"
nitinp19 Aug 5, 2025
21da70c
"removing commons-logging from the exclusion"
nitinp19 Aug 5, 2025
bddb412
"making it list remote item false for all the repository for gems"
nitinp19 Aug 5, 2025
6215d5c
"only using remote item false for remote repository in gems"
nitinp19 Aug 5, 2025
c263cba
"defining different artifactory home for all the os"
nitinp19 Aug 5, 2025
a2d697c
"removing unused import"
nitinp19 Aug 5, 2025
48fe2b8
"deleting the repository with retries"
nitinp19 Aug 5, 2025
dd84324
"fixing the vulnerable dependencies"
nitinp19 Aug 7, 2025
ad74e92
"adding the loggers as mentioned in the pr "
nitinp19 Aug 7, 2025
264fa46
Fix jackson version security vulnerability (#407)
bhanurp Jul 24, 2025
42aeed4
"fixing vulnerability for jetty"
nitinp19 Aug 13, 2025
8c6a32b
"introducing the environmental variable for jf audit"
nitinp19 Aug 13, 2025
12036a8
"updating the workflow"
nitinp19 Aug 13, 2025
2b59c8f
Fix jackson version security vulnerability (#407)
bhanurp Jul 24, 2025
e26d917
"fixing vulnerability for jetty"
nitinp19 Aug 13, 2025
01f4caa
"Introduce AUDIT_FAIL environment variable for jf audit"
nitinp19 Aug 13, 2025
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
15 changes: 15 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ jobs:
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}

- name: Setup Go with cache
uses: jfrog/.github/actions/install-go-with-cache@main

Expand All @@ -43,5 +44,19 @@ jobs:
java-version: "8"
distribution: "zulu"

- name: Wait for Artifactory
shell: bash
run: |
for i in {1..30}; do
if curl -sf http://localhost:8081/artifactory/api/system/ping; then
echo "Artifactory is up!"
exit 0
fi
echo "Waiting for Artifactory..."
sleep 10
done
echo "Artifactory did not start in time"
exit 1

- name: Run tests
run: ./gradlew${{ matrix.gradlewSuffix }} clean test
42 changes: 37 additions & 5 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -58,16 +58,48 @@ subprojects {
sourceCompatibility = 1.8
targetCompatibility = 1.8

// Force secure versions to fix vulnerabilities
configurations.all {
resolutionStrategy {
// Use latest confirmed available Jetty 9.4.x versions
force 'org.eclipse.jetty:jetty-server:9.4.56.v20240826'
force 'org.eclipse.jetty:jetty-servlets:9.4.56.v20240826'
force 'org.eclipse.jetty:jetty-http:9.4.56.v20240826'
force 'org.eclipse.jetty:jetty-util:9.4.56.v20240826'
force 'org.eclipse.jetty:jetty-io:9.4.56.v20240826'
force 'org.eclipse.jetty:jetty-client:9.4.56.v20240826'
force 'org.eclipse.jetty:jetty-security:9.4.56.v20240826'
force 'org.eclipse.jetty:jetty-servlet:9.4.56.v20240826'
force 'org.eclipse.jetty:jetty-webapp:9.4.56.v20240826'
force 'org.eclipse.jetty:jetty-proxy:9.4.56.v20240826'
force 'org.eclipse.jetty:jetty-continuation:9.4.56.v20240826'
force 'org.eclipse.jetty:jetty-util-ajax:9.4.56.v20240826'
force 'org.eclipse.jetty:jetty-xml:9.4.56.v20240826'
force 'org.eclipse.jetty.http2:http2-server:9.4.56.v20240826'
force 'org.eclipse.jetty.http2:http2-common:9.4.56.v20240826'
force 'org.eclipse.jetty.http2:http2-hpack:9.4.56.v20240826'
// Latest secure versions
force 'commons-io:commons-io:2.18.0'
force 'net.minidev:json-smart:2.5.2'
force 'com.jayway.jsonpath:json-path:2.9.0'
force 'com.google.guava:guava:33.4.0-jre'
force 'org.xmlunit:xmlunit-core:2.10.0'
}

// Exclude problematic dependencies
exclude group: 'commons-fileupload', module: 'commons-fileupload'
}

dependencies {
implementation('org.apache.httpcomponents:httpclient:4.5.13') {
exclude group: 'commons-codec', module: 'commons-codec'
}
implementation 'commons-codec:commons-codec:1.13'
implementation 'org.apache.commons:commons-lang3:3.12.0'
implementation 'com.fasterxml.jackson.core:jackson-core:2.14.1'
implementation 'com.fasterxml.jackson.core:jackson-databind:2.14.1'
implementation 'com.fasterxml.jackson.core:jackson-annotations:2.14.1'
api 'org.jfrog.filespecs:file-specs-java:1.1.1'
implementation 'org.apache.commons:commons-lang3:3.18.0'
implementation 'com.fasterxml.jackson.core:jackson-core:2.19.1'
implementation 'com.fasterxml.jackson.core:jackson-databind:2.19.1'
implementation 'com.fasterxml.jackson.core:jackson-annotations:2.19.1'
api 'org.jfrog.filespecs:file-specs-java:1.1.2'
}

task sourcesJar(type: Jar, dependsOn: classes) {
Expand Down
2 changes: 1 addition & 1 deletion httpClient/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ repositories {

dependencies {
testImplementation group: 'org.testng', name: 'testng', version: '7.5.1'
testImplementation group: 'com.github.tomakehurst', name: 'wiremock-jre8', version: '2.35.1'
testImplementation group: 'com.github.tomakehurst', name: 'wiremock-jre8', version: '2.35.0'
}
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,7 @@ private SSLContext buildSslContext() {
sslContext = sslBuilder.build();
}
} catch (Exception e) {
e.printStackTrace();
throw new RuntimeException("Error building SSLContext: " + e.getMessage(), e);
}
return sslContext != null ? sslContext : SSLContexts.createDefault();
}
Expand Down
3 changes: 2 additions & 1 deletion release/pipelines.release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ pipelines:
readOnly:
NEXT_VERSION: 0.0.0
NEXT_DEVELOPMENT_VERSION: 0.0.x-SNAPSHOT
AUDIT_FAIL: false

steps:
- name: Release
Expand Down Expand Up @@ -54,7 +55,7 @@ pipelines:
- git merge origin/dev

# Run audit
- jf audit
- jf audit --fail=${AUDIT_FAIL:-false}

# Update version
- sed -i "s/\(currentVersion=\).*\$/\1${NEXT_VERSION}/" gradle.properties
Expand Down
4 changes: 2 additions & 2 deletions services/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ dependencies {
implementation addSlf4J('slf4j-api')
implementation addSlf4J('log4j-over-slf4j')
implementation addSlf4J('jcl-over-slf4j')
implementation 'commons-io:commons-io:2.17.0'
implementation 'commons-io:commons-io:2.18.0'
testImplementation group: 'org.hamcrest', name: 'hamcrest-core', version: '2.2'
testImplementation group: 'org.testng', name: 'testng', version: '7.5.1'
/*
* Don't depend upon a specific logging implementation as a compile or runtime dependency.
* https://github.com/jfrog/artifactory-client-java/issues/43
* https://github.com/jfrog/artifactory-client-java/issues/232
*/
testRuntimeOnly group: 'ch.qos.logback', name: 'logback-classic', version: '1.2.9'
testRuntimeOnly group: 'ch.qos.logback', name: 'logback-classic', version: '1.3.15'
}

task createReleasePropertiesFile(type: Exec) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ abstract class BaseRepositoryTests extends ArtifactoryTestsBase {
@BeforeMethod
protected void setUp() {
String id = Long.toString(repoUniqueId)
println "[SETUP] Starting test setup for repo id: $id at ${new Date()}"
if (prepareGenericRepo) {
RepositorySettings settings = getRepositorySettings(RepositoryTypeImpl.LOCAL)

Expand Down Expand Up @@ -174,12 +175,12 @@ abstract class BaseRepositoryTests extends ArtifactoryTestsBase {

@AfterMethod
protected void tearDown() {
// Invoking sequence is important!
deleteRepoIfExists(genericRepo?.getKey())
deleteRepoIfExists(localRepo?.getKey())
deleteRepoIfExists(remoteRepo?.getKey())
deleteRepoIfExists(federatedRepo?.getKey())
deleteRepoIfExists(virtualRepo?.getKey())
// Invoking sequence is important! Delete in reverse dependency order
deleteRepoWithRetry(virtualRepo?.getKey()) // Delete virtual repo first (depends on generic)
deleteRepoWithRetry(federatedRepo?.getKey())
deleteRepoWithRetry(remoteRepo?.getKey())
deleteRepoWithRetry(localRepo?.getKey())
deleteRepoWithRetry(genericRepo?.getKey()) // Delete generic repo last (after dependents)
repoUniqueId++
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ class TerraformPackageTypeRepositoryTests extends BaseRepositoryTests {

TerraformPackageTypeRepositoryTests() {
remoteRepoUrl = "https://github.com"
storeArtifactsLocallyInRemoteRepo = true
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import java.util.Arrays;
import java.util.Collection;
import java.util.Properties;
import java.util.logging.Logger;

import static org.apache.commons.codec.binary.Base64.encodeBase64;
import static org.apache.commons.lang3.StringUtils.isEmpty;
Expand Down Expand Up @@ -55,6 +56,7 @@ public abstract class ArtifactoryTestsBase {
protected VirtualRepository virtualRepository;
protected RemoteRepository remoteRepository;
protected String federationUrl;
private static final Logger logger = Logger.getLogger(ArtifactoryTestsBase.class.getName());

@BeforeClass
public void init() throws IOException {
Expand Down Expand Up @@ -208,6 +210,40 @@ protected String textFrom(InputStream is) throws IOException {
}
}

protected void deleteRepoWithRetry(String repoKey) {
for (int attempt = 1; attempt <= 3; attempt++) {
try {
logger.info("Attempt " + attempt + " to delete repo: " + repoKey);
deleteRepoIfExists(repoKey);
logger.info("Successfully deleted repo: " + repoKey + " on attempt " + attempt);
return;
} catch (RuntimeException e) {
Throwable cause = e.getCause();
logger.warning("Attempt " + attempt + " failed to delete repo: " + repoKey + ". Reason: " + e.getMessage());
if (cause instanceof HttpResponseException &&
((HttpResponseException) cause).getStatusCode() == 500 &&
cause.getMessage() != null && cause.getMessage().contains("Lock on LockEntryId")) {

if (attempt < 3) {
logger.info("Lock detected. Retrying after 5 seconds...");
try {
Thread.sleep(5000);
} catch (InterruptedException ie) {
Thread.currentThread().interrupt();
logger.warning("Retry interrupted while waiting to retry repo deletion: " + repoKey);
return;
}
} else {
logger.severe("Failed to delete repo after 3 attempts due to lock: " + repoKey);
}
} else {
logger.severe("Non-lock error occurred. Not retrying. Repo: " + repoKey);
return; // Non-lock error, don't retry
}
}
}
}

protected String deleteRepoIfExists(String repoName) {
if (isEmpty(repoName)) {
return null;
Expand All @@ -220,7 +256,8 @@ protected String deleteRepoIfExists(String repoName) {
//if repo wasn't found - that's ok.
return e.getMessage();
} else {
throw e;
// Wrap checked exception in a RuntimeException to avoid signature changes
throw new RuntimeException(e);
}
}
}
Expand Down