Skip to content

Fix Security Violation#438

Merged
agrasth merged 14 commits intomasterfrom
violationFix
Apr 1, 2026
Merged

Fix Security Violation#438
agrasth merged 14 commits intomasterfrom
violationFix

Conversation

@agrasth
Copy link
Copy Markdown
Contributor

@agrasth agrasth commented Mar 18, 2026

  • All tests passed. If this feature is not already covered by the tests, I added new tests.
  • This pull request is on the dev branch.

Title: Fix security audit violations - upgrade jackson and netty

Description:
Upgrade vulnerable dependencies to resolve jf audit security violations.

Note on Jackson versions: Using jackson-core/databind 2.21.1 with jackson-annotations 2.21 (mixed patch versions). Both build and audit pass successfully. The 2.15.0 nesting depth fix (CVE-2025-52999/GHSA-h46c-h94j-95f3 from Issue #405) is included in all 2.21.x versions.

agrasth added 12 commits March 30, 2026 17:46
…p-go

The jfrog/.github/actions/install-go-with-cache action requires a go.mod file
which doesn't exist in this Java project. Replace it with actions/setup-go@v5
with explicit Go version 1.22.x, matching the pattern used in other JFrog plugins.

Made-with: Cursor
…rtual repo

The testVirtualRepo test was failing because it was creating a virtual repository
with Composer package type (inferred from enableComposerSupport custom property)
but trying to include a Generic repository. Artifactory now enforces strict package
type matching for virtual repositories.

Fix by explicitly setting the virtual repository to use Generic package type,
which matches the generic repository it includes.

Error: "Virtual repository has package type 'Composer' but includes non-matching
repository with package type 'Generic'"
… property

The test was failing because enableComposerSupport custom property was causing
Artifactory to infer the virtual repository as Composer type, which cannot include
Generic repositories due to package type mismatch validation.

Since this test is about custom properties on repositories (not specifically about
Composer), remove the enableComposerSupport property from the virtual repo test
to avoid the package type conflict. The other tests (local, remote) still validate
that custom properties work correctly.
… property

The test was failing with error: "Virtual repository has package type 'Composer'
but includes non-matching repository with package type 'Generic'"

The enableComposerSupport custom property was causing Artifactory to infer the
virtual repository as Composer type, which cannot include Generic repositories
due to strict package type matching validation.

Fix by removing the custom property from the virtual repo test, since this test
is about validating that custom properties work on repositories in general, not
specifically about Composer functionality. The local and remote repo tests still
validate that custom properties are properly set and retrieved.
Fixed test failures caused by Artifactory's strict package type validation for
virtual repositories. Virtual repositories can only include repositories with
matching package types.

Changes:
1. BaseRepositoryTests: Modified to include localRepo (same package type) instead
   of genericRepo when creating virtual repos for package-specific tests
2. CustomPropertiesRepositoryTests: Removed enableComposerSupport from virtual
   repo test to avoid package type conflicts

This fixes errors like: "Virtual repository has package type 'Composer' but
includes non-matching repository with package type 'Generic'"
Fix the package type comparison to properly check for generic type using
toString() since PackageType is an enum, not a string.
The genericRepo should always use GenericRepositorySettingsImpl, not the
package-specific settings from getRepositorySettings(). This ensures that
genericRepo always has package type 'Generic', which is required when it's
included in virtual repositories of any package type.

This fixes the root cause of package type mismatch errors across all
package-specific test suites.
Added a cleanup step before running tests to delete any leftover test
repositories from previous runs. This prevents "repository key already exists"
errors that occur when the same timestamp-based IDs are reused across runs.

The cleanup step:
1. Lists all repositories
2. Finds repositories with the test prefix "rt-client-java-"
3. Deletes them before running tests

This ensures a clean state for each test run.
Fixed the cleanup script to properly extract repository keys from the JSON
response. The previous grep pattern wasn't matching the JSON format correctly.

The improved script:
1. Uses a simpler grep pattern to extract repo keys
2. Checks if any repos were found before attempting deletion
3. Provides better logging of what's being cleaned up
…sion

Fixed repository key collision by creating a dedicated repository for virtual
repo inclusion instead of reusing localRepo or genericRepo.

The issue was that:
1. setUp() created localRepo for virtual repo inclusion
2. Individual tests (e.g., testBowerLocalRepo) also tried to create localRepo
3. This caused "repository key already exists" errors

Solution:
- Created virtualRepoIncludedRepo as a separate repository specifically for
  virtual repo inclusion
- This repository uses the same package type as the virtual repo (via settings)
- Avoids conflicts with localRepo and genericRepo used by individual tests
- Updated tearDown to properly clean up the new repository
…al repos

Fixed P2PackageTypeRepositoryTests failure by checking if the package type
supports local repositories before creating virtualRepoIncludedRepo.

For package types that don't support local repos (like P2), we now fall back
to using GenericRepositorySettingsImpl. This ensures virtualRepoIncludedRepo
can always be created as a local repository.

This fixes: "Package type 'p2' is not supported in local repositories"
Fixed P2 and Terraform virtual repo tests by creating a remote repository
instead of a local repository for virtual repo inclusion when the package
type doesn't support local repositories.

Logic:
1. Try to get LOCAL settings for the package type
2. If LOCAL is not supported (null), try REMOTE settings and create remote repo
3. If REMOTE is also not supported, fall back to Generic local repo

This fixes:
- P2PackageTypeRepositoryTests > testP2VirtualRepo
- TerraformPackageTypeRepositoryTests > testTerraformVirtualRepo

Both were failing with: "Virtual repository has package type 'X' but includes
non-matching repository with package type 'Generic'"
@agrasth agrasth merged commit 70eda4a into master Apr 1, 2026
2 of 4 checks passed
agrasth added a commit that referenced this pull request Apr 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants