diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml index da8162b5..384080fe 100644 --- a/.github/ISSUE_TEMPLATE/config.yml +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -2,5 +2,5 @@ blank_issues_enabled: false contact_links: - name: GitHub Discussions - url: https://github.com/trustification/exhort-java-api/discussions/ + url: https://github.com/guacsec/trustify-da-java-client/discussions/ about: You can also use Discussions for questions and ideas. diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 065f749d..afa368bc 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -49,8 +49,8 @@ jobs: echo "python-bin-location=$(echo $pythonLocation)/bin" >> $GITHUB_OUTPUT - name: Verify the project and create coverage report env: - EXHORT_PYTHON3_PATH: "${{steps.python-location.outputs.python-bin-location}}/python3" - EXHORT_PIP3_PATH: "${{steps.python-location.outputs.python-bin-location}}/pip3" + TRUSTIFY_DA_PYTHON3_PATH: "${{steps.python-location.outputs.python-bin-location}}/python3" + TRUSTIFY_DA_PIP3_PATH: "${{steps.python-location.outputs.python-bin-location}}/pip3" GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | mvn verify -Pits,cov -B -ff diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c3cdc8a0..c24d45e3 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -19,7 +19,7 @@ jobs: name: Deploy release environment: staging # only trigger the workflow on the base repository and if the merged branch name starts with release. - if: (github.repository_owner == 'trustification' && github.event.pull_request.merged == true && startsWith(github.head_ref, 'release/') ) || (github.repository_owner == 'trustification' && github.ref_name == 'main' && contains(github.event.commits[0].message, 'release/directly')) + if: (github.repository_owner == 'guacsec' && github.event.pull_request.merged == true && startsWith(github.head_ref, 'release/') ) || (github.repository_owner == 'guacsec' && github.ref_name == 'main' && contains(github.event.commits[0].message, 'release/directly')) outputs: project_version: ${{ steps.project.outputs.version }} last_release_tag: ${{ steps.last-release.outputs.tag-name }} @@ -72,7 +72,7 @@ jobs: release: runs-on: ubuntu-latest name: Release - if: (github.repository_owner == 'trustification' && startsWith(github.head_ref, 'release/')) || (github.repository_owner == 'trustification' && github.ref_name == 'main' && contains(github.event.commits[0].message, 'release/directly')) + if: (github.repository_owner == 'guacsec' && startsWith(github.head_ref, 'release/')) || (github.repository_owner == 'guacsec' && github.ref_name == 'main' && contains(github.event.commits[0].message, 'release/directly')) environment: staging needs: deploy steps: diff --git a/.github/workflows/stage.yml b/.github/workflows/stage.yml index ca85f36e..afc56e24 100644 --- a/.github/workflows/stage.yml +++ b/.github/workflows/stage.yml @@ -18,7 +18,7 @@ jobs: name: Deploy snapshot env: RUN_PYTHON_BIN: ${{ vars.RUN_PYTHON_BIN }} - if: github.repository_owner == 'trustification' && github.event.pull_request.merged == true && !startsWith(github.head_ref, 'release/') + if: github.repository_owner == 'guacsec' && github.event.pull_request.merged == true && !startsWith(github.head_ref, 'release/') outputs: project_version: ${{ steps.project.outputs.version }} steps: @@ -40,7 +40,7 @@ jobs: - name: Deploy snapshot to GitHub if: | contains(steps.project.outputs.version, 'SNAPSHOT') && - github.repository == 'trustification/exhort-java-api' + github.repository == 'guacsec/trustify-da-java-client' env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: mvn deploy -Pprepare-deployment,deploy-github -B -ff -DskipTests=true -Dskip.junit_platform=true @@ -52,7 +52,7 @@ jobs: needs: deploy if: | contains(needs.deploy.outputs.project_version, 'SNAPSHOT') && - github.repository_owner == 'trustification' && github.event.pull_request.merged == true && !startsWith(github.head_ref, 'release/') + github.repository_owner == 'guacsec' && github.event.pull_request.merged == true && !startsWith(github.head_ref, 'release/') steps: - name: Check for existing ${{ needs.deploy.outputs.project_version }} release id: existing_release diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index cf4691b4..f0465012 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,4 +1,4 @@ -# Contributing to *exhort-java-api*
![java-version][10] +# Contributing to *trustify-da-java-client*
![java-version][10] * Fork the repository * Create a new branch @@ -37,17 +37,17 @@ ### Good to know -* You can override the default backend url by setting the `EXHORT_DEV_MODE` environment variable/system property to true: - * In case environment variable/System Property `EXHORT_DEV_MODE=true` - You can Override the default exhort backend by setting - `DEV_EXHORT_BACKEND_URL` env variable/system property to the desired exhort backend instance address ( useful for tests). - * In case `DEV_EXHORT_BACKEND_URL` is not set via environment variable/system property, then the default DEV exhort backend is picked. - * In case `EXHORT_DEV_MODE=false` or not set at all levels, then default backend url ( exhort prod) is picked, regardless of the value of `DEV_EXHORT_BACKEND_URL`. - * Environment variables takes precedence over System properties - for example, if System property `EXHORT_DEV_MODE=true` - but environment variable `EXHORT_DEV_MODE=false` , then default exhort prod will be used anyway. +* You can override the default backend url by setting the `TRUSTIFY_DA_DEV_MODE` environment variable/system property to true: + * In case environment variable/System Property `TRUSTIFY_DA_DEV_MODE=true` - You can Override the default trustify-dependency-analytics backend by setting + `DEV_TRUSTIFY_DA_BACKEND_URL` env variable/system property to the desired trustify-dependency-analytics backend instance address ( useful for tests). + * In case `DEV_TRUSTIFY_DA_BACKEND_URL` is not set via environment variable/system property, then the default DEV trustify-dependency-analytics backend is picked. + * In case `TRUSTIFY_DA_DEV_MODE=false` or not set at all levels, then default backend url ( trustify-dependency-analytics prod) is picked, regardless of the value of `DEV_TRUSTIFY_DA_BACKEND_URL`. + * Environment variables takes precedence over System properties - for example, if System property `TRUSTIFY_DA_DEV_MODE=true` + but environment variable `TRUSTIFY_DA_DEV_MODE=false` , then default trustify-dependency-analytics prod will be used anyway. ### OpenAPI Specifications -We use the Java generated library for the [Exhort OpenAPI spec][1] for deserialization of the Backend's +We use the Java generated library for the [Trustify Dependency Analytics API Specification][1] for deserialization of the Backend's API responses.
When the [Backend's spec file][1] is modified, a new @@ -97,10 +97,10 @@ $ mvn clean verify -Pits,dev ``` Integration tests are executed against a mocked _Backend_ server.
-If you need to run against the actual _Backend_ server, use the _EXHORT_ITS_USE_REAL_API_ environment variable: +If you need to run against the actual _Backend_ server, use the _TRUSTIFY_DA_ITS_USE_REAL_API_ environment variable: ```shell -EXHORT_ITS_USE_REAL_API=true mvn clean verify -Pits +TRUSTIFY_DA_ITS_USE_REAL_API=true mvn clean verify -Pits ``` > TIP: When working on a new integration test project, it's helpful opening the IDE directly in the test project folder. @@ -114,7 +114,7 @@ contribution. See the [DCO](DCO) file for details. [0]: https://www.conventionalcommits.org/en/v1.0.0/ -[1]: https://github.com/guacsec/trustify-da-api-spec/blob/main/api/v4/openapi.yaml +[1]: https://github.com/guacsec/trustify-da-api-spec/blob/main/api/v5/openapi.yaml [10]: https://badgen.net/badge/Java%20Version/11/5382a1 diff --git a/README.md b/README.md index 8d58a2fd..1b3f80c4 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,9 @@ -# CodeReady Dependency Analytics Java API
![latest-no-snapshot][0] ![latest-snapshot][1] +# Trustify DA Java Client
![latest-no-snapshot][0] ![latest-snapshot][1] -* Looking for our JavaScript/TypeScript API? Try [Exhort JavaScript API](https://github.com/trustification/exhort-javascript-api). -* Looking for our Backend implementation? Try [Exhort](https://github.com/trustification/exhort). +* Looking for our JavaScript/TypeScript API? Try [Trustify DA JavaScript Client](https://github.com/guacsec/trustify-da-javascript-client). +* Looking for our Backend implementation? Try [Trustify Dependency Analytics](https://github.com/guacsec/trustify-dependency-analytics). -The _Exhort Java API_ module is deployed to _GitHub Package Registry_. +The _Trustify DA Java Client_ module is deployed to _GitHub Package Registry_.
Click here for configuring GHPR registry access. @@ -69,7 +69,7 @@ encrypted-token-will-appear-here ... github - https://maven.pkg.github.com/trustification/exhort-java-api + https://maven.pkg.github.com/guacsec/trustify-da-java-client ... @@ -83,7 +83,7 @@ encrypted-token-will-appear-here repositories { ... maven { - url 'https://maven.pkg.github.com/trustification/exhort-java-api' + url 'https://maven.pkg.github.com/guacsec/trustify-da-java-client' credentials { username System.getenv("GITHUB_USERNAME") password System.getenv("GITHUB_TOKEN") @@ -102,8 +102,8 @@ repositories { ```xml - com.redhat.exhort - exhort-java-api + io.github.guacsec + trustify-da-java-client 0.0.9-SNAPSHOT ``` @@ -113,7 +113,7 @@ repositories { Gradle users, add a dependency in build.gradle ```groovy -implementation 'com.redhat.exhort:exhort-java-api:${exhort-java-api.version}' +implementation 'io.github.guacsec:trustify-da-java-client:${trustify-da-java-client.version}' ``` @@ -124,7 +124,7 @@ If working with modules, configure module read ```java module x { // module-info.java - requires com.redhat.exhort; + requires io.github.guacsec; } ``` @@ -133,16 +133,16 @@ module x { // module-info.java Code example ```java -import com.redhat.exhort.Api.MixedReport; -import com.redhat.exhort.impl.ExhortApi; -import com.redhat.exhort.AnalysisReport; +import io.github.guacsec.trustifyda.Api.MixedReport; +import io.github.guacsec.trustifyda.impl.ExhortApi; +import io.github.guacsec.trustifyda.AnalysisReport; import java.nio.file.Files; import java.nio.file.Paths; import java.util.concurrent.CompletableFuture; -public class ExhortExample { +public class TrustifyExample { public static void main(String... args) throws Exception { - // instantiate the Exhort API implementation + // instantiate the Trustify DA Java Client implementation var exhortApi = new ExhortApi(); // get a byte array future holding a html Stack Analysis report @@ -299,7 +299,7 @@ test { All of the 5 above examples are valid for marking a package to be ignored #### Ignore Strategies - experimental - You can specify the method to ignore dependencies in manifest (globally), by setting the environment variable `EXHORT_IGNORE_METHOD` to one of the following values: \ + You can specify the method to ignore dependencies in manifest (globally), by setting the environment variable `TRUSTIFY_DA_IGNORE_METHOD` to one of the following values: \ **_Possible values:_** - `insensitive` - ignoring the dependency and all of its subtree(all transitives) - default. - `sensitive` - ignoring the dependency but let its transitives remain if they are also transitive of another dependency in the tree or if they're direct dependency of root in the dependency tree. @@ -311,26 +311,26 @@ All of the 5 above examples are valid for marking a package to be ignored

Customization

-There are 2 approaches for customizing Exhort Java API. Using Environment Variables or +There are 2 approaches for customizing Trustify DA Java Client. Using Environment Variables or Java Properties: ```java -System.setProperty("EXHORT_MVN_PATH", "/path/to/custom/mvn"); -System.setProperty("EXHORT_NPM_PATH", "/path/to/custom/npm"); -System.setProperty("EXHORT_PNPM_PATH", "/path/to/custom/pnpm"); -System.setProperty("EXHORT_YARN_PATH", "/path/to/custom/yarn"); -System.setProperty("EXHORT_GO_PATH", "/path/to/custom/go"); -System.setProperty("EXHORT_GRADLE_PATH", "/path/to/custom/gradle"); +System.setProperty("TRUSTIFY_DA_MVN_PATH", "/path/to/custom/mvn"); +System.setProperty("TRUSTIFY_DA_NPM_PATH", "/path/to/custom/npm"); +System.setProperty("TRUSTIFY_DA_PNPM_PATH", "/path/to/custom/pnpm"); +System.setProperty("TRUSTIFY_DA_YARN_PATH", "/path/to/custom/yarn"); +System.setProperty("TRUSTIFY_DA_GO_PATH", "/path/to/custom/go"); +System.setProperty("TRUSTIFY_DA_GRADLE_PATH", "/path/to/custom/gradle"); //python - python3, pip3 take precedence if python version > 3 installed -System.setProperty("EXHORT_PYTHON3_PATH", "/path/to/python3"); -System.setProperty("EXHORT_PIP3_PATH", "/path/to/pip3"); -System.setProperty("EXHORT_PYTHON_PATH", "/path/to/python"); -System.setProperty("EXHORT_PIP_PATH", "/path/to/pip"); +System.setProperty("TRUSTIFY_DA_PYTHON3_PATH", "/path/to/python3"); +System.setProperty("TRUSTIFY_DA_PIP3_PATH", "/path/to/pip3"); +System.setProperty("TRUSTIFY_DA_PYTHON_PATH", "/path/to/python"); +System.setProperty("TRUSTIFY_DA_PIP_PATH", "/path/to/pip"); // Configure proxy for all requests -System.setProperty("EXHORT_PROXY_URL", "http://proxy.example.com:8080"); +System.setProperty("TRUSTIFY_DA_PROXY_URL", "http://proxy.example.com:8080"); // Configure Maven settings and repository -System.setProperty("EXHORT_MVN_USER_SETTINGS", "/path/to/custom/settings.xml"); -System.setProperty("EXHORT_MVN_LOCAL_REPO", "/path/to/custom/local/repository"); +System.setProperty("TRUSTIFY_DA_MVN_USER_SETTINGS", "/path/to/custom/settings.xml"); +System.setProperty("TRUSTIFY_DA_MVN_LOCAL_REPO", "/path/to/custom/local/repository"); ``` > Environment variables takes precedence. @@ -350,7 +350,7 @@ The HTTP Client Library can be configured to use HTTP Protocol version through e -HTTP_VERSION_EXHORT_CLIENT +HTTP_VERSION_TRUSTIFY_DA_CLIENT [HTTP_1_1 , HTTP_2] HTTP_1_1 @@ -364,12 +364,12 @@ You can set the proxy URL in two ways: 1. Using environment variable: ``` -export EXHORT_PROXY_URL=http://proxy.example.com:8080 +export TRUSTIFY_DA_PROXY_URL=http://proxy.example.com:8080 ``` 2. Using Java Properties when calling the API programmatically: ``` -System.setProperty("EXHORT_PROXY_URL", "http://proxy.example.com:8080"); +System.setProperty("TRUSTIFY_DA_PROXY_URL", "http://proxy.example.com:8080"); ```

@@ -389,52 +389,52 @@ following keys for setting custom paths for the said executables. Maven mvn -EXHORT_MVN_PATH +TRUSTIFY_DA_MVN_PATH Node Package Manager (npm) npm -EXHORT_NPM_PATH +TRUSTIFY_DA_NPM_PATH pnpm pnpm -EXHORT_PNPM_PATH +TRUSTIFY_DA_PNPM_PATH Yarn (Classic) / Yarn (Berry) yarn -EXHORT_YARN_PATH +TRUSTIFY_DA_YARN_PATH Go Modules go -EXHORT_GO_PATH +TRUSTIFY_DA_GO_PATH Gradle gradle -EXHORT_GRADLE_PATH +TRUSTIFY_DA_GRADLE_PATH Python programming language python3 -EXHORT_PYTHON3_PATH +TRUSTIFY_DA_PYTHON3_PATH Python pip Package Installer pip3 -EXHORT_PIP3_PATH +TRUSTIFY_DA_PIP3_PATH Python programming language python -EXHORT_PYTHON_PATH +TRUSTIFY_DA_PYTHON_PATH Python pip Package Installer pip -EXHORT_PIP_PATH +TRUSTIFY_DA_PIP_PATH @@ -452,13 +452,13 @@ You can customize Maven behavior by setting additional environment variables or Maven User Settings -EXHORT_MVN_USER_SETTINGS +TRUSTIFY_DA_MVN_USER_SETTINGS Path to custom Maven settings.xml file Uses Maven's default settings Maven Local Repository -EXHORT_MVN_LOCAL_REPO +TRUSTIFY_DA_MVN_LOCAL_REPO Path to custom Maven local repository directory Uses Maven's default local repository @@ -468,14 +468,14 @@ You can customize Maven behavior by setting additional environment variables or Using environment variables: ```bash -export EXHORT_MVN_USER_SETTINGS=/home/user/.m2/custom-settings.xml -export EXHORT_MVN_LOCAL_REPO=/home/user/custom-maven-repo +export TRUSTIFY_DA_MVN_USER_SETTINGS=/home/user/.m2/custom-settings.xml +export TRUSTIFY_DA_MVN_LOCAL_REPO=/home/user/custom-maven-repo ``` Using Java properties: ```java -System.setProperty("EXHORT_MVN_USER_SETTINGS", "/home/user/.m2/custom-settings.xml"); -System.setProperty("EXHORT_MVN_LOCAL_REPO", "/home/user/custom-maven-repo"); +System.setProperty("TRUSTIFY_DA_MVN_USER_SETTINGS", "/home/user/.m2/custom-settings.xml"); +System.setProperty("TRUSTIFY_DA_MVN_LOCAL_REPO", "/home/user/custom-maven-repo"); ``` > Environment variables take precedence over Java properties. @@ -521,7 +521,7 @@ The MVS-based resolution is **enabled by default**. If you want to disable this behavior and instead include **all transitive module versions** (as listed in `go.mod` dependencies), set the system property or environment variable: ```bash -EXHORT_GO_MVS_LOGIC_ENABLED=false +TRUSTIFY_DA_GO_MVS_LOGIC_ENABLED=false ``` #### Python Support @@ -530,8 +530,8 @@ By default, Python support assumes that the package is installed using the pip/p Binaries passed to environment variables. If the package is not installed , then an error will be thrown. There is an experimental feature of installing the requirement.txt on a virtual env(only python3 or later is supported for this feature) - in this case, -it's important to pass in a path to python3 binary as `EXHORT_PYTHON3_PATH` or instead make sure that python3 is on the system path. -in such case, You can use that feature by setting environment variable `EXHORT_PYTHON_VIRTUAL_ENV` to true +it's important to pass in a path to python3 binary as `TRUSTIFY_DA_PYTHON3_PATH` or instead make sure that python3 is on the system path. +in such case, You can use that feature by setting environment variable `TRUSTIFY_DA_PYTHON_VIRTUAL_ENV` to true ##### "Best Efforts Installation" Since Python pip packages are very sensitive/picky regarding python version changes( every small range of versions is only tailored for a certain python version), I'm introducing this feature, that @@ -539,18 +539,18 @@ tries to install all packages in requirements.txt onto created virtual environme This increasing the chances and the probability a lot that the automatic installation will succeed. ##### Usage -A New setting is introduced - `EXHORT_PYTHON_INSTALL_BEST_EFFORTS` (as both env variable/key in `options` object) -1. `EXHORT_PYTHON_INSTALL_BEST_EFFORTS`="false" - install requirements.txt while respecting declared versions for all packages. -2. `EXHORT_PYTHON_INSTALL_BEST_EFFORTS`="true" - install all packages from requirements.txt, not respecting the declared version, but trying to install a version tailored for the used python version, when using this setting,you must set setting `MATCH_MANIFEST_VERSIONS`="false" +A New setting is introduced - `TRUSTIFY_DA_PYTHON_INSTALL_BEST_EFFORTS` (as both env variable/key in `options` object) +1. `TRUSTIFY_DA_PYTHON_INSTALL_BEST_EFFORTS`="false" - install requirements.txt while respecting declared versions for all packages. +2. `TRUSTIFY_DA_PYTHON_INSTALL_BEST_EFFORTS`="true" - install all packages from requirements.txt, not respecting the declared version, but trying to install a version tailored for the used python version, when using this setting,you must set setting `MATCH_MANIFEST_VERSIONS`="false" ##### Using `pipdeptree` By Default, The API algorithm will use native commands of PIP installer as data source to build the dependency tree. It's also possible, to use lightweight Python PIP utility [pipdeptree](https://pypi.org/project/pipdeptree/) as data source instead, in order to activate this, -Need to set environment variable/system property - `EXHORT_PIP_USE_DEP_TREE` to true. +Need to set environment variable/system property - `TRUSTIFY_DA_PIP_USE_DEP_TREE` to true. ### CLI Support -The Exhort Java API includes a command-line interface for standalone usage. +The Trustify DA Java Client includes a command-line interface for standalone usage. #### Building the CLI @@ -561,20 +561,20 @@ mvn clean package ``` This creates two JAR files in the `target/` directory: -- `exhort-java-api.jar` - Library JAR (for programmatic use) -- `exhort-java-api-cli.jar` - CLI JAR (includes all dependencies) +- `trustify-da-java-client.jar` - Library JAR (for programmatic use) +- `trustify-da-java-client-cli.jar` - CLI JAR (includes all dependencies) #### Usage ```shell -java -jar target/exhort-java-api-cli.jar [OPTIONS] +java -jar target/trustify-da-java-client-cli.jar [OPTIONS] ``` #### Commands **Stack Analysis** ```shell -java -jar exhort-java-api-cli.jar stack [--summary|--html] +java -jar trustify-da-java-client-cli.jar stack [--summary|--html] ``` Perform stack analysis on the specified manifest file. @@ -585,7 +585,7 @@ Options: **Component Analysis** ```shell -java -jar exhort-java-api-cli.jar component [--summary] +java -jar trustify-da-java-client-cli.jar component [--summary] ``` Perform component analysis on the specified manifest file. @@ -597,22 +597,22 @@ Options: ```shell # Stack analysis with JSON output (default) -java -jar exhort-java-api-cli.jar stack /path/to/pom.xml +java -jar trustify-da-java-client-cli.jar stack /path/to/pom.xml # Stack analysis with summary -java -jar exhort-java-api-cli.jar stack /path/to/package.json --summary +java -jar trustify-da-java-client-cli.jar stack /path/to/package.json --summary # Stack analysis with HTML output -java -jar exhort-java-api-cli.jar stack /path/to/build.gradle --html +java -jar trustify-da-java-client-cli.jar stack /path/to/build.gradle --html # Component analysis with JSON output (default) -java -jar exhort-java-api-cli.jar component /path/to/requirements.txt +java -jar trustify-da-java-client-cli.jar component /path/to/requirements.txt # Component analysis with summary -java -jar exhort-java-api-cli.jar component /path/to/go.mod --summary +java -jar trustify-da-java-client-cli.jar component /path/to/go.mod --summary # Show help -java -jar exhort-java-api-cli.jar --help +java -jar trustify-da-java-client-cli.jar --help ``` ### Image Support @@ -621,20 +621,20 @@ Generate vulnerability analysis report for container images. #### Code Example ```java -package com.redhat.exhort; +package io.github.guacsec.trustifyda; -import com.redhat.exhort.api.AnalysisReport; -import com.redhat.exhort.image.ImageRef; -import com.redhat.exhort.impl.ExhortApi; +import io.github.guacsec.trustifyda.api.AnalysisReport; +import io.github.guacsec.trustifyda.image.ImageRef; +import io.github.guacsec.trustifyda.impl.ExhortApi; import java.util.Map; import java.util.Set; import java.util.concurrent.CompletableFuture; -public class ExhortImageExample { +public class TrustifyImageExample { public static void main(String[] args) throws Exception { - // instantiate the Exhort API implementation + // instantiate the Trustify DA Java Client implementation var exhortApi = new ExhortApi(); // create a reference to image test1 by specifying image name and its platform when applicable @@ -667,23 +667,23 @@ Customize image analysis optionally by using *Environment Variables* or *Java Pr | Env / Property | Description | Default Value | |-------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------| -| EXHORT_SYFT_PATH | Custom path to the `syft` executable | syft | -| EXHORT_SYFT_CONFIG_PATH | Custom path to the `syft` [configuration file](https://github.com/anchore/syft?tab=readme-ov-file#configuration) | .syft.yaml, .syft/config.yaml, $HOME/.syft.yaml | -| EXHORT_SYFT_IMAGE_SOURCE | [Source](https://github.com/anchore/syft?tab=readme-ov-file#supported-sources) from which `syft` looks for the images (e.g. docker, podman, registry) | (By default, Syft attempts to resolve it using: the Docker, Podman, and Containerd daemons followed by direct registry access, in that order) | -| EXHORT_SKOPEO_PATH | Custom path to the `skopeo` executable | skopeo | -| EXHORT_SKOPEO_CONFIG_PATH | Custom path to the [authentication file](https://github.com/containers/skopeo/blob/main/docs/skopeo-inspect.1.md#options) used by `skopeo inspect` | $HOME/.docker/config.json | -| EXHORT_IMAGE_SERVICE_ENDPOINT | [Host endpoint](https://github.com/containers/skopeo/blob/main/docs/skopeo-inspect.1.md#options) of the container runtime daemon / service | | -| EXHORT_DOCKER_PATH | Custom path to the `docker` executable | docker | -| EXHORT_PODMAN_PATH | Custom path to the `podman` executable | podman | -| EXHORT_IMAGE_PLATFORM | Default platform used for multi-arch images | | -| EXHORT_IMAGE_OS | Default OS used for multi-arch images when `EXHORT_IMAGE_PLATFORM` is not set | | -| EXHORT_IMAGE_ARCH | Default Architecture used for multi-arch images when `EXHORT_IMAGE_PLATFORM` is not set | | -| EXHORT_IMAGE_VARIANT | Default Variant used for multi-arch images when `EXHORT_IMAGE_PLATFORM` is not set | | +| TRUSTIFY_DA_SYFT_PATH | Custom path to the `syft` executable | syft | +| TRUSTIFY_DA_SYFT_CONFIG_PATH | Custom path to the `syft` [configuration file](https://github.com/anchore/syft?tab=readme-ov-file#configuration) | .syft.yaml, .syft/config.yaml, $HOME/.syft.yaml | +| TRUSTIFY_DA_SYFT_IMAGE_SOURCE | [Source](https://github.com/anchore/syft?tab=readme-ov-file#supported-sources) from which `syft` looks for the images (e.g. docker, podman, registry) | (By default, Syft attempts to resolve it using: the Docker, Podman, and Containerd daemons followed by direct registry access, in that order) | +| TRUSTIFY_DA_SKOPEO_PATH | Custom path to the `skopeo` executable | skopeo | +| TRUSTIFY_DA_SKOPEO_CONFIG_PATH | Custom path to the [authentication file](https://github.com/containers/skopeo/blob/main/docs/skopeo-inspect.1.md#options) used by `skopeo inspect` | $HOME/.docker/config.json | +| TRUSTIFY_DA_IMAGE_SERVICE_ENDPOINT | [Host endpoint](https://github.com/containers/skopeo/blob/main/docs/skopeo-inspect.1.md#options) of the container runtime daemon / service | | +| TRUSTIFY_DA_DOCKER_PATH | Custom path to the `docker` executable | docker | +| TRUSTIFY_DA_PODMAN_PATH | Custom path to the `podman` executable | podman | +| TRUSTIFY_DA_IMAGE_PLATFORM | Default platform used for multi-arch images | | +| TRUSTIFY_DA_IMAGE_OS | Default OS used for multi-arch images when `TRUSTIFY_DA_IMAGE_PLATFORM` is not set | | +| TRUSTIFY_DA_IMAGE_ARCH | Default Architecture used for multi-arch images when `TRUSTIFY_DA_IMAGE_PLATFORM` is not set | | +| TRUSTIFY_DA_IMAGE_VARIANT | Default Variant used for multi-arch images when `TRUSTIFY_DA_IMAGE_PLATFORM` is not set | | ### Known Issues - For pip requirements.txt - It's been observed that for python versions 3.11.x, there might be slowness for invoking the analysis. - If you encounter a performance issue with python version >= 3.11.x, kindly try to set environment variable/system property `EXHORT_PIP_USE_DEP_TREE`=true, before calling the analysis - this should fix the performance issue. + If you encounter a performance issue with python version >= 3.11.x, kindly try to set environment variable/system property `TRUSTIFY_DA_PIP_USE_DEP_TREE`=true, before calling the analysis - this should fix the performance issue. @@ -694,5 +694,5 @@ Customize image analysis optionally by using *Environment Variables* or *Java Pr -[0]: https://img.shields.io/github/v/release/trustification/exhort-java-api?color=green&label=latest -[1]: https://img.shields.io/github/v/release/trustification/exhort-java-api?color=yellow&include_prereleases&label=snapshot +[0]: https://img.shields.io/github/v/release/guacsec/trustify-da-java-client?color=green&label=latest +[1]: https://img.shields.io/github/v/release/guacsec/trustify-da-java-client?color=yellow&include_prereleases&label=snapshot diff --git a/catalog-info.yaml b/catalog-info.yaml index 58922f7c..5ef62924 100644 --- a/catalog-info.yaml +++ b/catalog-info.yaml @@ -2,17 +2,17 @@ apiVersion: backstage.io/v1alpha1 kind: Component metadata: annotations: - backstage.io/kubernetes-id: exhort-java-api - github.com/project-slug: trustification/exhort-java-api + backstage.io/kuberqnetes-id: trustify-da-java-client + github.com/project-slug: guacsec/trustify-da-java-client github.com/project-readme-path: README.md - backstage.io/view-url: https://github.com/trustification/exhort-java-api/blob/main/catalog-info.yaml - backstage.io/edit-url: https://github.com/trustification/exhort-java-api/blob/main/catalog-info.yaml - backstage.io/source-location: url:https://github.com/trustification/exhort-java-api - rhda/manifest-file-path: package.json - backstage.io/techdocs-ref: url:https://github.com/trustification/exhort-java-api - name: exhort-java-api + backstage.io/view-url: https://github.com/guacsec/trustify-da-java-client/blob/main/catalog-info.yaml + backstage.io/edit-url: https://github.com/guacsec/trustify-da-java-client/blob/main/catalog-info.yaml + backstage.io/source-location: url:https://github.com/guacsec/trustify-da-java-client + trust-da/manifest-file-path: package.json + backstage.io/techdocs-ref: url:https://github.com/guacsec/trustify-da-java-client + name: trustify-da-java-client tags: - - rhda + - trust-da spec: lifecycle: production owner: ecosystem-appeng diff --git a/pom.xml b/pom.xml index 068d1706..e2ded2e2 100644 --- a/pom.xml +++ b/pom.xml @@ -3,12 +3,12 @@ 4.0.0 - com.redhat.exhort - exhort-java-api + io.github.guacsec + trustify-da-java-client 0.0.9-SNAPSHOT - Exhort Java API - Exhort Java API - https://github.com/trustification/exhort-java-api#readme + Trustify DA Java Client + Trustify DA Java Client + https://github.com/guacsec/trustify-da-java-client#readme 2023 @@ -18,11 +18,12 @@ UTF-8 17 - 1.0.6 + 2.0.1 2.19.2 2.1.1 2.0.4 10.2.1 + 1.1.1 3.27.3 5.10.5 @@ -87,33 +88,33 @@ GitHub Issues - https://github.com/trustification/exhort-java-api/issues + https://github.com/guacsec/trustify-da-java-client/issues - https://github.com/trustification/exhort-java-api - scm:git:git@github.com:trustification/exhort-java-api.git - scm:git:git@github.com:trustification/exhort-java-api.git + https://github.com/guacsec/trustify-da-java-client + scm:git:git@github.com:guacsec/trustify-da-java-client.git + scm:git:git@github.com:guacsec/trustify-da-java-client.git HEAD GitHub Workflows - https://github.com/trustification/exhort-java-api/actions + https://github.com/guacsec/trustify-da-java-client/actions - com.redhat.ecosystemappeng - exhort-api-spec - ${exhort-api.version} + io.github.guacsec + trustify-da-api-model + ${trustify-da-api-model.version} org.tomlj tomlj - 1.1.1 + ${tomlj.version} com.fasterxml.jackson.core @@ -187,8 +188,8 @@ - com.redhat.ecosystemappeng - exhort-api-spec + io.github.guacsec + trustify-da-api-model org.tomlj @@ -405,13 +406,13 @@ limitations under the License.]]> ${jacoco-maven-plugin.version} - com/redhat/exhort/api/* - com/redhat/exhort/api/serialization/* - com/redhat/exhort/exception/* + io/github/guacsec/trustifyda/api/* + io/github/guacsec/trustifyda/api/serialization/* + io/github/guacsec/trustifyda/exception/* - com/redhat/exhort/impl/* - com/redhat/exhort/logging/* - com/redhat/exhort/image/ImageUtils.class + io/github/guacsec/trustifyda/impl/* + io/github/guacsec/trustifyda/logging/* + io/github/guacsec/trustifyda/image/ImageUtils.class jacoco.java.option @@ -664,7 +665,7 @@ limitations under the License.]]> - com.redhat.exhort.cli.App + io.github.guacsec.trustifyda.cli.App @@ -704,7 +705,7 @@ limitations under the License.]]> - com.redhat.exhort.cli.App + io.github.guacsec.trustifyda.cli.App @@ -890,11 +891,11 @@ limitations under the License.]]> github - https://maven.pkg.github.com/trustification/exhort-java-api + https://maven.pkg.github.com/guacsec/trustify-da-java-client github - https://maven.pkg.github.com/trustification/exhort-java-api + https://maven.pkg.github.com/guacsec/trustify-da-java-client diff --git a/src/main/java/com/redhat/exhort/sbom/package-info.java b/src/main/java/com/redhat/exhort/sbom/package-info.java deleted file mode 100644 index c4527284..00000000 --- a/src/main/java/com/redhat/exhort/sbom/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package com.redhat.exhort.sbom; diff --git a/src/main/java/com/redhat/exhort/Api.java b/src/main/java/io/github/guacsec/trustifyda/Api.java similarity index 96% rename from src/main/java/com/redhat/exhort/Api.java rename to src/main/java/io/github/guacsec/trustifyda/Api.java index 57859cc8..63033110 100644 --- a/src/main/java/com/redhat/exhort/Api.java +++ b/src/main/java/io/github/guacsec/trustifyda/Api.java @@ -14,10 +14,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.redhat.exhort; +package io.github.guacsec.trustifyda; -import com.redhat.exhort.api.v4.AnalysisReport; -import com.redhat.exhort.image.ImageRef; +import io.github.guacsec.trustifyda.api.v5.AnalysisReport; +import io.github.guacsec.trustifyda.image.ImageRef; import java.io.IOException; import java.util.Arrays; import java.util.Map; diff --git a/src/main/java/com/redhat/exhort/Provider.java b/src/main/java/io/github/guacsec/trustifyda/Provider.java similarity index 96% rename from src/main/java/com/redhat/exhort/Provider.java rename to src/main/java/io/github/guacsec/trustifyda/Provider.java index edadd746..14b56480 100644 --- a/src/main/java/com/redhat/exhort/Provider.java +++ b/src/main/java/io/github/guacsec/trustifyda/Provider.java @@ -14,10 +14,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.redhat.exhort; +package io.github.guacsec.trustifyda; import com.fasterxml.jackson.databind.ObjectMapper; -import com.redhat.exhort.tools.Ecosystem; +import io.github.guacsec.trustifyda.tools.Ecosystem; import java.io.IOException; import java.nio.file.Path; diff --git a/src/main/java/com/redhat/exhort/cli/App.java b/src/main/java/io/github/guacsec/trustifyda/cli/App.java similarity index 92% rename from src/main/java/com/redhat/exhort/cli/App.java rename to src/main/java/io/github/guacsec/trustifyda/cli/App.java index ead1ecea..bd3082ec 100644 --- a/src/main/java/com/redhat/exhort/cli/App.java +++ b/src/main/java/io/github/guacsec/trustifyda/cli/App.java @@ -14,20 +14,20 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.redhat.exhort.cli; +package io.github.guacsec.trustifyda.cli; -import static com.redhat.exhort.cli.AppUtils.exitWithError; -import static com.redhat.exhort.cli.AppUtils.printException; -import static com.redhat.exhort.cli.AppUtils.printLine; +import static io.github.guacsec.trustifyda.cli.AppUtils.exitWithError; +import static io.github.guacsec.trustifyda.cli.AppUtils.printException; +import static io.github.guacsec.trustifyda.cli.AppUtils.printLine; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; -import com.redhat.exhort.Api; -import com.redhat.exhort.api.v4.AnalysisReport; -import com.redhat.exhort.api.v4.ProviderReport; -import com.redhat.exhort.api.v4.SourceSummary; -import com.redhat.exhort.impl.ExhortApi; +import io.github.guacsec.trustifyda.Api; +import io.github.guacsec.trustifyda.api.v5.AnalysisReport; +import io.github.guacsec.trustifyda.api.v5.ProviderReport; +import io.github.guacsec.trustifyda.api.v5.SourceSummary; +import io.github.guacsec.trustifyda.impl.ExhortApi; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; diff --git a/src/main/java/com/redhat/exhort/cli/AppUtils.java b/src/main/java/io/github/guacsec/trustifyda/cli/AppUtils.java similarity index 96% rename from src/main/java/com/redhat/exhort/cli/AppUtils.java rename to src/main/java/io/github/guacsec/trustifyda/cli/AppUtils.java index 1112c929..8247befa 100644 --- a/src/main/java/com/redhat/exhort/cli/AppUtils.java +++ b/src/main/java/io/github/guacsec/trustifyda/cli/AppUtils.java @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.redhat.exhort.cli; +package io.github.guacsec.trustifyda.cli; public class AppUtils { public static void exitWithError() { diff --git a/src/main/java/com/redhat/exhort/cli/CliArgs.java b/src/main/java/io/github/guacsec/trustifyda/cli/CliArgs.java similarity index 95% rename from src/main/java/com/redhat/exhort/cli/CliArgs.java rename to src/main/java/io/github/guacsec/trustifyda/cli/CliArgs.java index 2189750d..0561acb4 100644 --- a/src/main/java/com/redhat/exhort/cli/CliArgs.java +++ b/src/main/java/io/github/guacsec/trustifyda/cli/CliArgs.java @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.redhat.exhort.cli; +package io.github.guacsec.trustifyda.cli; import java.nio.file.Path; diff --git a/src/main/java/com/redhat/exhort/cli/Command.java b/src/main/java/io/github/guacsec/trustifyda/cli/Command.java similarity index 94% rename from src/main/java/com/redhat/exhort/cli/Command.java rename to src/main/java/io/github/guacsec/trustifyda/cli/Command.java index f09ffac1..2c14e1f5 100644 --- a/src/main/java/com/redhat/exhort/cli/Command.java +++ b/src/main/java/io/github/guacsec/trustifyda/cli/Command.java @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.redhat.exhort.cli; +package io.github.guacsec.trustifyda.cli; public enum Command { STACK, diff --git a/src/main/java/com/redhat/exhort/cli/OutputFormat.java b/src/main/java/io/github/guacsec/trustifyda/cli/OutputFormat.java similarity index 94% rename from src/main/java/com/redhat/exhort/cli/OutputFormat.java rename to src/main/java/io/github/guacsec/trustifyda/cli/OutputFormat.java index 1743a7a5..a6586435 100644 --- a/src/main/java/com/redhat/exhort/cli/OutputFormat.java +++ b/src/main/java/io/github/guacsec/trustifyda/cli/OutputFormat.java @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.redhat.exhort.cli; +package io.github.guacsec.trustifyda.cli; public enum OutputFormat { JSON, diff --git a/src/main/java/com/redhat/exhort/exception/PackageNotInstalledException.java b/src/main/java/io/github/guacsec/trustifyda/exception/PackageNotInstalledException.java similarity index 94% rename from src/main/java/com/redhat/exhort/exception/PackageNotInstalledException.java rename to src/main/java/io/github/guacsec/trustifyda/exception/PackageNotInstalledException.java index 6d6441ec..c5b7c613 100644 --- a/src/main/java/com/redhat/exhort/exception/PackageNotInstalledException.java +++ b/src/main/java/io/github/guacsec/trustifyda/exception/PackageNotInstalledException.java @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.redhat.exhort.exception; +package io.github.guacsec.trustifyda.exception; public class PackageNotInstalledException extends RuntimeException { public PackageNotInstalledException(String message) { diff --git a/src/main/java/com/redhat/exhort/image/Image.java b/src/main/java/io/github/guacsec/trustifyda/image/Image.java similarity index 99% rename from src/main/java/com/redhat/exhort/image/Image.java rename to src/main/java/io/github/guacsec/trustifyda/image/Image.java index 182311de..df181d54 100644 --- a/src/main/java/com/redhat/exhort/image/Image.java +++ b/src/main/java/io/github/guacsec/trustifyda/image/Image.java @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.redhat.exhort.image; +package io.github.guacsec.trustifyda.image; /** * Contents in this file are from: diff --git a/src/main/java/com/redhat/exhort/image/ImageRef.java b/src/main/java/io/github/guacsec/trustifyda/image/ImageRef.java similarity index 96% rename from src/main/java/com/redhat/exhort/image/ImageRef.java rename to src/main/java/io/github/guacsec/trustifyda/image/ImageRef.java index 90fdb267..715b5bc3 100644 --- a/src/main/java/com/redhat/exhort/image/ImageRef.java +++ b/src/main/java/io/github/guacsec/trustifyda/image/ImageRef.java @@ -14,10 +14,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.redhat.exhort.image; +package io.github.guacsec.trustifyda.image; -import static com.redhat.exhort.image.ImageUtils.getImageDigests; -import static com.redhat.exhort.image.ImageUtils.getImagePlatform; +import static io.github.guacsec.trustifyda.image.ImageUtils.getImageDigests; +import static io.github.guacsec.trustifyda.image.ImageUtils.getImagePlatform; import com.fasterxml.jackson.core.JsonProcessingException; import com.github.packageurl.MalformedPackageURLException; diff --git a/src/main/java/com/redhat/exhort/image/ImageUtils.java b/src/main/java/io/github/guacsec/trustifyda/image/ImageUtils.java similarity index 92% rename from src/main/java/com/redhat/exhort/image/ImageUtils.java rename to src/main/java/io/github/guacsec/trustifyda/image/ImageUtils.java index 1d35b68b..66eda22c 100644 --- a/src/main/java/com/redhat/exhort/image/ImageUtils.java +++ b/src/main/java/io/github/guacsec/trustifyda/image/ImageUtils.java @@ -14,9 +14,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.redhat.exhort.image; +package io.github.guacsec.trustifyda.image; -import static com.redhat.exhort.image.Platform.EMPTY_PLATFORM; +import static io.github.guacsec.trustifyda.image.Platform.EMPTY_PLATFORM; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.JsonNode; @@ -24,8 +24,8 @@ import com.fasterxml.jackson.databind.node.ObjectNode; import com.fasterxml.jackson.databind.node.TextNode; import com.github.packageurl.MalformedPackageURLException; -import com.redhat.exhort.tools.Operations; -import com.redhat.exhort.utils.Environment; +import io.github.guacsec.trustifyda.tools.Operations; +import io.github.guacsec.trustifyda.utils.Environment; import java.io.File; import java.io.IOException; import java.util.AbstractMap; @@ -40,14 +40,14 @@ public class ImageUtils { - static final String EXHORT_SYFT_CONFIG_PATH = "EXHORT_SYFT_CONFIG_PATH"; - static final String EXHORT_SYFT_IMAGE_SOURCE = "EXHORT_SYFT_IMAGE_SOURCE"; - static final String EXHORT_IMAGE_PLATFORM = "EXHORT_IMAGE_PLATFORM"; - static final String EXHORT_IMAGE_OS = "EXHORT_IMAGE_OS"; - static final String EXHORT_IMAGE_ARCH = "EXHORT_IMAGE_ARCH"; - static final String EXHORT_IMAGE_VARIANT = "EXHORT_IMAGE_VARIANT"; - static final String EXHORT_SKOPEO_CONFIG_PATH = "EXHORT_SKOPEO_CONFIG_PATH"; - static final String EXHORT_IMAGE_SERVICE_ENDPOINT = "EXHORT_IMAGE_SERVICE_ENDPOINT"; + static final String TRUSTIFY_DA_SYFT_CONFIG_PATH = "TRUSTIFY_DA_SYFT_CONFIG_PATH"; + static final String TRUSTIFY_DA_SYFT_IMAGE_SOURCE = "TRUSTIFY_DA_SYFT_IMAGE_SOURCE"; + static final String TRUSTIFY_DA_IMAGE_PLATFORM = "TRUSTIFY_DA_IMAGE_PLATFORM"; + static final String TRUSTIFY_DA_IMAGE_OS = "TRUSTIFY_DA_IMAGE_OS"; + static final String TRUSTIFY_DA_IMAGE_ARCH = "TRUSTIFY_DA_IMAGE_ARCH"; + static final String TRUSTIFY_DA_IMAGE_VARIANT = "TRUSTIFY_DA_IMAGE_VARIANT"; + static final String TRUSTIFY_DA_SKOPEO_CONFIG_PATH = "TRUSTIFY_DA_SKOPEO_CONFIG_PATH"; + static final String TRUSTIFY_DA_IMAGE_SERVICE_ENDPOINT = "TRUSTIFY_DA_IMAGE_SERVICE_ENDPOINT"; private static final String MEDIA_TYPE_DOCKER2_MANIFEST = "application/vnd.docker.distribution.manifest.v2+json"; private static final String MEDIA_TYPE_DOCKER2_MANIFEST_LIST = @@ -135,8 +135,8 @@ static Operations.ProcessExecOutput execSyft(ImageRef imageRef) { var docker = Operations.getCustomPathOrElse(DOCKER); var podman = Operations.getCustomPathOrElse(PODMAN); - var syftConfigPath = Environment.get(EXHORT_SYFT_CONFIG_PATH, ""); - var imageSource = Environment.get(EXHORT_SYFT_IMAGE_SOURCE, ""); + var syftConfigPath = Environment.get(TRUSTIFY_DA_SYFT_CONFIG_PATH, ""); + var imageSource = Environment.get(TRUSTIFY_DA_SYFT_IMAGE_SOURCE, ""); SyftImageSource.getImageSource(imageSource); var dockerPath = @@ -205,19 +205,19 @@ static List getSyftEnvs(String dockerPath, String podmanPath) { } public static Platform getImagePlatform() { - var platform = Environment.get(EXHORT_IMAGE_PLATFORM, ""); + var platform = Environment.get(TRUSTIFY_DA_IMAGE_PLATFORM, ""); if (!platform.isEmpty()) { return new Platform(platform); } - var imageSource = Environment.get(EXHORT_SYFT_IMAGE_SOURCE, ""); + var imageSource = Environment.get(TRUSTIFY_DA_SYFT_IMAGE_SOURCE, ""); SyftImageSource source = SyftImageSource.getImageSource(imageSource); - var os = Environment.get(EXHORT_IMAGE_OS, ""); + var os = Environment.get(TRUSTIFY_DA_IMAGE_OS, ""); if (os.isEmpty()) { os = source.getOs(); } - var arch = Environment.get(EXHORT_IMAGE_ARCH, ""); + var arch = Environment.get(TRUSTIFY_DA_IMAGE_ARCH, ""); if (arch.isEmpty()) { arch = source.getArch(); } @@ -226,7 +226,7 @@ public static Platform getImagePlatform() { return new Platform(os, arch, null); } - var variant = Environment.get(EXHORT_IMAGE_VARIANT, ""); + var variant = Environment.get(TRUSTIFY_DA_IMAGE_VARIANT, ""); if (variant.isEmpty()) { variant = source.getVariant(); } @@ -425,8 +425,8 @@ static Map getSingleImageDigest(ImageRef imageRef) static Operations.ProcessExecOutput execSkopeoInspect(ImageRef imageRef, boolean raw) { var skopeo = Operations.getExecutable(SKOPEO, ARG_VERSION); - var configPath = Environment.get(EXHORT_SKOPEO_CONFIG_PATH, ""); - var daemonHost = Environment.get(EXHORT_IMAGE_SERVICE_ENDPOINT, ""); + var configPath = Environment.get(TRUSTIFY_DA_SKOPEO_CONFIG_PATH, ""); + var daemonHost = Environment.get(TRUSTIFY_DA_IMAGE_SERVICE_ENDPOINT, ""); String[] cmd; if (daemonHost.isEmpty()) { diff --git a/src/main/java/com/redhat/exhort/image/Platform.java b/src/main/java/io/github/guacsec/trustifyda/image/Platform.java similarity index 99% rename from src/main/java/com/redhat/exhort/image/Platform.java rename to src/main/java/io/github/guacsec/trustifyda/image/Platform.java index c3201861..0608d97c 100644 --- a/src/main/java/com/redhat/exhort/image/Platform.java +++ b/src/main/java/io/github/guacsec/trustifyda/image/Platform.java @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.redhat.exhort.image; +package io.github.guacsec.trustifyda.image; import java.util.Objects; import java.util.Set; diff --git a/src/main/java/com/redhat/exhort/impl/ExhortApi.java b/src/main/java/io/github/guacsec/trustifyda/impl/ExhortApi.java similarity index 82% rename from src/main/java/com/redhat/exhort/impl/ExhortApi.java rename to src/main/java/io/github/guacsec/trustifyda/impl/ExhortApi.java index d481d1f5..618bbc52 100644 --- a/src/main/java/com/redhat/exhort/impl/ExhortApi.java +++ b/src/main/java/io/github/guacsec/trustifyda/impl/ExhortApi.java @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.redhat.exhort.impl; +package io.github.guacsec.trustifyda.impl; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.DeserializationFeature; @@ -22,14 +22,14 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.github.packageurl.MalformedPackageURLException; import com.github.packageurl.PackageURL; -import com.redhat.exhort.Api; -import com.redhat.exhort.Provider; -import com.redhat.exhort.api.v4.AnalysisReport; -import com.redhat.exhort.image.ImageRef; -import com.redhat.exhort.image.ImageUtils; -import com.redhat.exhort.logging.LoggersFactory; -import com.redhat.exhort.tools.Ecosystem; -import com.redhat.exhort.utils.Environment; +import io.github.guacsec.trustifyda.Api; +import io.github.guacsec.trustifyda.Provider; +import io.github.guacsec.trustifyda.api.v5.AnalysisReport; +import io.github.guacsec.trustifyda.image.ImageRef; +import io.github.guacsec.trustifyda.image.ImageUtils; +import io.github.guacsec.trustifyda.logging.LoggersFactory; +import io.github.guacsec.trustifyda.tools.Ecosystem; +import io.github.guacsec.trustifyda.utils.Environment; import jakarta.mail.MessagingException; import jakarta.mail.internet.MimeMultipart; import jakarta.mail.util.ByteArrayDataSource; @@ -60,27 +60,28 @@ import java.util.function.Supplier; import java.util.logging.Logger; import java.util.stream.Collectors; -import java.util.stream.Stream; /** Concrete implementation of the Exhort {@link Api} Service. */ public final class ExhortApi implements Api { - private static final String DEV_EXHORT_BACKEND_URL = "DEV_EXHORT_BACKEND_URL"; + private static final String DEV_TRUSTIFY_DA_BACKEND_URL = "DEV_TRUSTIFY_DA_BACKEND_URL"; - private static final String EXHORT_DEV_MODE = "EXHORT_DEV_MODE"; + private static final String TRUSTIFY_DA_DEV_MODE = "TRUSTIFY_DA_DEV_MODE"; - private static final String HTTP_VERSION_EXHORT_CLIENT = "HTTP_VERSION_EXHORT_CLIENT"; + private static final String HTTP_VERSION_TRUSTIFY_DA_CLIENT = "HTTP_VERSION_TRUSTIFY_DA_CLIENT"; - private static final String EXHORT_PROXY_URL = "EXHORT_PROXY_URL"; + private static final String TRUSTIFY_DA_PROXY_URL = "TRUSTIFY_DA_PROXY_URL"; private static final Logger LOG = LoggersFactory.getLogger(ExhortApi.class.getName()); public static final String DEFAULT_ENDPOINT = "https://rhda.rhcloud.com"; public static final String DEFAULT_ENDPOINT_DEV = "https://exhort.stage.devshift.net"; - public static final String RHDA_TOKEN_HEADER = "rhda-token"; - public static final String RHDA_SOURCE_HEADER = "rhda-source"; - public static final String RHDA_OPERATION_TYPE_HEADER = "rhda-operation-type"; - public static final String EXHORT_REQUEST_ID_HEADER_NAME = "ex-request-id"; + public static final String TRUST_DA_TOKEN_HEADER = "trust-da-token"; + public static final String TRUST_DA_SOURCE_HEADER = "trust-da-source"; + public static final String TRUST_DA_OPERATION_TYPE_HEADER = "trust-da-operation-type"; + public static final String TRUSTIFY_DA_REQUEST_ID_HEADER_NAME = "ex-request-id"; + public static final String S_API_V_5_ANALYSIS = "%s/api/v5/analysis"; + public static final String S_API_V_5_BATCH_ANALYSIS = "%s/api/v5/batch-analysis"; private final String endpoint; @@ -88,38 +89,6 @@ public String getEndpoint() { return endpoint; } - /** Enum for identifying token environment variables and their corresponding request headers. */ - private enum TokenProvider { - SNYK, - OSS_INDEX; - - /** - * Get the expected environment variable name. - * - * @return i.e. EXHORT_SNYK_TOKEN - */ - String getVarName() { - return String.format("EXHORT_%s_TOKEN", this); - } - - String getUserVarName() { - return String.format("EXHORT_%s_USER", this); - } - - /** - * Get the expected request header name. - * - * @return i.e. ex-snyk-token - */ - String getHeaderName() { - return String.format("ex-%s-token", this.toString().replace("_", "-").toLowerCase()); - } - - String getUserHeaderName() { - return String.format("ex-%s-user", this.toString().replace("_", "-").toLowerCase()); - } - } - private final HttpClient client; private final ObjectMapper mapper; @@ -138,7 +107,7 @@ public ExhortApi() { * @return i.e. HttpClient.Version.HTTP_1.1 */ static HttpClient.Version getHttpVersion() { - var version = Environment.get(HTTP_VERSION_EXHORT_CLIENT); + var version = Environment.get(HTTP_VERSION_TRUSTIFY_DA_CLIENT); return (version != null && version.contains("2")) ? HttpClient.Version.HTTP_2 : HttpClient.Version.HTTP_1_1; @@ -148,12 +117,12 @@ static HttpClient.Version getHttpVersion() { // // temp system property - as long as prod exhort url not implemented the multi-source v4 // endpoint, this // property needs to be true - // System.setProperty("EXHORT_DEV_MODE","true"); + // System.setProperty("TRUSTIFY_DA_DEV_MODE","true"); commonHookBeginning(true); this.client = client; this.mapper = new ObjectMapper().disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES); // Take default from config.properties in case client didn't override DEV MODE - if (Environment.get(EXHORT_DEV_MODE) == null) { + if (Environment.get(TRUSTIFY_DA_DEV_MODE) == null) { try { InputStream exhortConfig = this.getClass().getClassLoader().getResourceAsStream("config.properties"); @@ -161,11 +130,11 @@ static HttpClient.Version getHttpVersion() { LOG.info( "config.properties not found on the class path, fallback to default DEV MODE =" + " false"); - System.setProperty(EXHORT_DEV_MODE, "false"); + System.setProperty(TRUSTIFY_DA_DEV_MODE, "false"); } else { Properties properties = new Properties(); properties.load(exhortConfig); - System.setProperty(EXHORT_DEV_MODE, (String) properties.get(EXHORT_DEV_MODE)); + System.setProperty(TRUSTIFY_DA_DEV_MODE, (String) properties.get(TRUSTIFY_DA_DEV_MODE)); } } catch (IOException e) { LOG.info( @@ -173,7 +142,7 @@ static HttpClient.Version getHttpVersion() { "Error loading config.properties , fallback to set default property DEV MODE =" + " false, Error message = %s", e.getMessage())); - System.setProperty(EXHORT_DEV_MODE, "false"); + System.setProperty(TRUSTIFY_DA_DEV_MODE, "false"); } } @@ -182,14 +151,14 @@ static HttpClient.Version getHttpVersion() { public static HttpClient createHttpClient() { HttpClient.Builder builder = HttpClient.newBuilder().version(getHttpVersion()); - String proxyUrl = Environment.get(EXHORT_PROXY_URL); + String proxyUrl = Environment.get(TRUSTIFY_DA_PROXY_URL); if (proxyUrl != null && !proxyUrl.isBlank()) { try { URI proxyUri = URI.create(proxyUrl); builder.proxy( ProxySelector.of(new InetSocketAddress(proxyUri.getHost(), proxyUri.getPort()))); } catch (IllegalArgumentException e) { - LOG.warning("Invalid EXHORT_PROXY_URL: " + proxyUrl + ", using direct connection"); + LOG.warning("Invalid TRUSTIFY_DA_PROXY_URL: " + proxyUrl + ", using direct connection"); } } return builder.build(); @@ -198,7 +167,7 @@ public static HttpClient createHttpClient() { private String commonHookBeginning(boolean startOfApi) { if (startOfApi) { if (debugLoggingIsNeeded()) { - LOG.info("Start of exhort-java-api client"); + LOG.info("Start of trustify-da-java-client"); LOG.info(String.format("Starting time of API: %s", LocalDateTime.now())); } } else { @@ -225,8 +194,8 @@ private static String getClientRequestId() { public String getExhortUrl() { String endpoint; - if (Environment.getBoolean(EXHORT_DEV_MODE, false)) { - endpoint = Environment.get(DEV_EXHORT_BACKEND_URL, DEFAULT_ENDPOINT_DEV); + if (Environment.getBoolean(TRUSTIFY_DA_DEV_MODE, false)) { + endpoint = Environment.get(DEV_TRUSTIFY_DA_BACKEND_URL, DEFAULT_ENDPOINT_DEV); } else { endpoint = DEFAULT_ENDPOINT; @@ -234,10 +203,10 @@ public String getExhortUrl() { if (debugLoggingIsNeeded()) { LOG.info( String.format( - "EXHORT_DEV_MODE=%s,DEV_EXHORT_BACKEND_URL=%s, Chosen Backend URL=%s ," + "TRUSTIFY_DA_DEV_MODE=%s,DEV_TRUSTIFY_DA_BACKEND_URL=%s, Chosen Backend URL=%s ," + " DEFAULT_ENDPOINT_DEV=%s , DEFAULT_ENDPOINT=%s", - Environment.getBoolean(EXHORT_DEV_MODE, false), - Environment.get(DEV_EXHORT_BACKEND_URL, DEFAULT_ENDPOINT_DEV), + Environment.getBoolean(TRUSTIFY_DA_DEV_MODE, false), + Environment.get(DEV_TRUSTIFY_DA_BACKEND_URL, DEFAULT_ENDPOINT_DEV), endpoint, DEFAULT_ENDPOINT_DEV, DEFAULT_ENDPOINT)); @@ -392,7 +361,7 @@ private AnalysisReport getAnalysisReportFromResponse( private static void logExhortRequestId(HttpResponse response) { Optional headerExRequestId = - response.headers().allValues(EXHORT_REQUEST_ID_HEADER_NAME).stream().findFirst(); + response.headers().allValues(TRUSTIFY_DA_REQUEST_ID_HEADER_NAME).stream().findFirst(); headerExRequestId.ifPresent( value -> LOG.info( @@ -403,7 +372,7 @@ private static void logExhortRequestId(HttpResponse response) { } public static boolean debugLoggingIsNeeded() { - return Environment.getBoolean("EXHORT_DEBUG", false); + return Environment.getBoolean("TRUSTIFY_DA_DEBUG", false); } @Override @@ -412,7 +381,7 @@ public CompletableFuture componentAnalysis( String exClientTraceId = commonHookBeginning(false); var manifestPath = Path.of(manifest); var provider = Ecosystem.getProvider(manifestPath); - var uri = URI.create(String.format("%s/api/v4/analysis", this.endpoint)); + var uri = URI.create(String.format(S_API_V_5_ANALYSIS, this.endpoint)); var content = provider.provideComponent(); commonHookAfterProviderCreatedSbomAndBeforeExhort(); return getAnalysisReportForComponent(uri, content, exClientTraceId); @@ -456,7 +425,7 @@ public CompletableFuture componentAnalysis(String manifestFile) String exClientTraceId = commonHookBeginning(false); var manifestPath = Path.of(manifestFile); var provider = Ecosystem.getProvider(manifestPath); - var uri = URI.create(String.format("%s/api/v4/analysis", this.endpoint)); + var uri = URI.create(String.format(S_API_V_5_ANALYSIS, this.endpoint)); var content = provider.provideComponent(); commonHookAfterProviderCreatedSbomAndBeforeExhort(); return getAnalysisReportForComponent(uri, content, exClientTraceId); @@ -497,7 +466,7 @@ private HttpRequest buildStackRequest(final String manifestFile, final MediaType throws IOException { var manifestPath = Path.of(manifestFile); var provider = Ecosystem.getProvider(manifestPath); - var uri = URI.create(String.format("%s/api/v4/analysis", this.endpoint)); + var uri = URI.create(String.format(S_API_V_5_ANALYSIS, this.endpoint)); var content = provider.provideStack(); commonHookAfterProviderCreatedSbomAndBeforeExhort(); @@ -576,7 +545,7 @@ CompletableFuture performBatchAnalysis( final String analysisName) throws IOException { String exClientTraceId = commonHookBeginning(false); - var uri = URI.create(String.format("%s/api/v4/batch-analysis", this.endpoint)); + var uri = URI.create(String.format(S_API_V_5_BATCH_ANALYSIS, this.endpoint)); var sboms = sbomsGenerator.get(); var content = new Provider.Content( @@ -631,7 +600,8 @@ T getBatchAnalysisReportsFromResponse( /** * Build an HTTP request for sending to the Backend API. * - * @param content the {@link com.redhat.exhort.Provider.Content} info for the request body + * @param content the {@link io.github.guacsec.trustifyda.Provider.Content} info for the request + * body * @param uri the {@link URI} for sending the request to * @param acceptType value the Accept header in the request, indicating the required response type * @return a HttpRequest ready to be sent to the Backend API @@ -648,42 +618,19 @@ private HttpRequest buildRequest( .setHeader("Content-Type", content.type) .POST(HttpRequest.BodyPublishers.ofString(new String(content.buffer))); - // include tokens from environment variables of java properties as request headers - Stream.of(ExhortApi.TokenProvider.values()) - .forEach( - p -> { - var envToken = Environment.get(p.getVarName()); - if (Objects.nonNull(envToken)) { - request.setHeader(p.getHeaderName(), envToken); - } else { - var propToken = Environment.get(p.getVarName()); - if (Objects.nonNull(propToken)) { - request.setHeader(p.getHeaderName(), propToken); - } - } - var envUser = Environment.get(p.getUserHeaderName()); - if (Objects.nonNull(envUser)) { - request.setHeader(p.getUserHeaderName(), envUser); - } else { - var propUser = Environment.get(p.getUserVarName()); - if (Objects.nonNull(propUser)) { - request.setHeader(p.getUserHeaderName(), propUser); - } - } - }); - // set rhda-token - // Environment variable/property name = RHDA_TOKEN - String rhdaToken = calculateHeaderValue(RHDA_TOKEN_HEADER); - if (rhdaToken != null) { - request.setHeader(RHDA_TOKEN_HEADER, rhdaToken); + // set trust-da-token + // Environment variable/property name = TRUST_DA_TOKEN + String trustDaToken = calculateHeaderValue(TRUST_DA_TOKEN_HEADER); + if (trustDaToken != null) { + request.setHeader(TRUST_DA_TOKEN_HEADER, trustDaToken); } - // set rhda-source ( extension/plugin id/name) - // Environment variable/property name = RHDA_SOURCE - String rhdaSource = calculateHeaderValue(RHDA_SOURCE_HEADER); - if (rhdaSource != null) { - request.setHeader(RHDA_SOURCE_HEADER, rhdaSource); + // set trust-da-source ( extension/plugin id/name) + // Environment variable/property name = TRUST_DA_SOURCE + String trustDaSource = calculateHeaderValue(TRUST_DA_SOURCE_HEADER); + if (trustDaSource != null) { + request.setHeader(TRUST_DA_SOURCE_HEADER, trustDaSource); } - request.setHeader(RHDA_OPERATION_TYPE_HEADER, analysisType); + request.setHeader(TRUST_DA_OPERATION_TYPE_HEADER, analysisType); return request.build(); } diff --git a/src/main/java/com/redhat/exhort/impl/RequestManager.java b/src/main/java/io/github/guacsec/trustifyda/impl/RequestManager.java similarity index 97% rename from src/main/java/com/redhat/exhort/impl/RequestManager.java rename to src/main/java/io/github/guacsec/trustifyda/impl/RequestManager.java index 17417e45..38bbee27 100644 --- a/src/main/java/com/redhat/exhort/impl/RequestManager.java +++ b/src/main/java/io/github/guacsec/trustifyda/impl/RequestManager.java @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.redhat.exhort.impl; +package io.github.guacsec.trustifyda.impl; import java.util.HashMap; import java.util.Map; diff --git a/src/main/java/com/redhat/exhort/impl/package-info.java b/src/main/java/io/github/guacsec/trustifyda/impl/package-info.java similarity index 59% rename from src/main/java/com/redhat/exhort/impl/package-info.java rename to src/main/java/io/github/guacsec/trustifyda/impl/package-info.java index e2d0748e..9b5ea997 100644 --- a/src/main/java/com/redhat/exhort/impl/package-info.java +++ b/src/main/java/io/github/guacsec/trustifyda/impl/package-info.java @@ -1,2 +1,2 @@ /** Package hosting various the Exhort API implementation. * */ -package com.redhat.exhort.impl; +package io.github.guacsec.trustifyda.impl; diff --git a/src/main/java/com/redhat/exhort/logging/ClientTraceIdSimpleFormatter.java b/src/main/java/io/github/guacsec/trustifyda/logging/ClientTraceIdSimpleFormatter.java similarity index 97% rename from src/main/java/com/redhat/exhort/logging/ClientTraceIdSimpleFormatter.java rename to src/main/java/io/github/guacsec/trustifyda/logging/ClientTraceIdSimpleFormatter.java index 71c6e908..7757654d 100644 --- a/src/main/java/com/redhat/exhort/logging/ClientTraceIdSimpleFormatter.java +++ b/src/main/java/io/github/guacsec/trustifyda/logging/ClientTraceIdSimpleFormatter.java @@ -14,13 +14,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.redhat.exhort.logging; +package io.github.guacsec.trustifyda.logging; import com.fasterxml.jackson.core.JacksonException; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; -import com.redhat.exhort.impl.RequestManager; +import io.github.guacsec.trustifyda.impl.RequestManager; import java.io.PrintWriter; import java.io.StringWriter; import java.time.ZoneId; diff --git a/src/main/java/com/redhat/exhort/logging/LoggersFactory.java b/src/main/java/io/github/guacsec/trustifyda/logging/LoggersFactory.java similarity index 96% rename from src/main/java/com/redhat/exhort/logging/LoggersFactory.java rename to src/main/java/io/github/guacsec/trustifyda/logging/LoggersFactory.java index e1df1759..f476f50c 100644 --- a/src/main/java/com/redhat/exhort/logging/LoggersFactory.java +++ b/src/main/java/io/github/guacsec/trustifyda/logging/LoggersFactory.java @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.redhat.exhort.logging; +package io.github.guacsec.trustifyda.logging; import java.util.logging.ConsoleHandler; import java.util.logging.Logger; diff --git a/src/main/java/com/redhat/exhort/package-info.java b/src/main/java/io/github/guacsec/trustifyda/package-info.java similarity index 63% rename from src/main/java/com/redhat/exhort/package-info.java rename to src/main/java/io/github/guacsec/trustifyda/package-info.java index 5d36173e..1d033b7f 100644 --- a/src/main/java/com/redhat/exhort/package-info.java +++ b/src/main/java/io/github/guacsec/trustifyda/package-info.java @@ -1,2 +1,2 @@ /** Package hosting various Interfaces for the Exhort module. * */ -package com.redhat.exhort; +package io.github.guacsec.trustifyda; diff --git a/src/main/java/com/redhat/exhort/providers/AnalysisType.java b/src/main/java/io/github/guacsec/trustifyda/providers/AnalysisType.java similarity index 93% rename from src/main/java/com/redhat/exhort/providers/AnalysisType.java rename to src/main/java/io/github/guacsec/trustifyda/providers/AnalysisType.java index f334aac3..4400fa3f 100644 --- a/src/main/java/com/redhat/exhort/providers/AnalysisType.java +++ b/src/main/java/io/github/guacsec/trustifyda/providers/AnalysisType.java @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.redhat.exhort.providers; +package io.github.guacsec.trustifyda.providers; public enum AnalysisType { STACK, diff --git a/src/main/java/com/redhat/exhort/providers/BaseJavaProvider.java b/src/main/java/io/github/guacsec/trustifyda/providers/BaseJavaProvider.java similarity index 97% rename from src/main/java/com/redhat/exhort/providers/BaseJavaProvider.java rename to src/main/java/io/github/guacsec/trustifyda/providers/BaseJavaProvider.java index 769c9d3c..9f0d8d75 100644 --- a/src/main/java/com/redhat/exhort/providers/BaseJavaProvider.java +++ b/src/main/java/io/github/guacsec/trustifyda/providers/BaseJavaProvider.java @@ -14,13 +14,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.redhat.exhort.providers; +package io.github.guacsec.trustifyda.providers; import com.github.packageurl.MalformedPackageURLException; import com.github.packageurl.PackageURL; -import com.redhat.exhort.Provider; -import com.redhat.exhort.sbom.Sbom; -import com.redhat.exhort.tools.Ecosystem; +import io.github.guacsec.trustifyda.Provider; +import io.github.guacsec.trustifyda.sbom.Sbom; +import io.github.guacsec.trustifyda.tools.Ecosystem; import java.nio.file.Path; import java.util.Arrays; import java.util.Map; diff --git a/src/main/java/com/redhat/exhort/providers/GoModulesProvider.java b/src/main/java/io/github/guacsec/trustifyda/providers/GoModulesProvider.java similarity index 95% rename from src/main/java/com/redhat/exhort/providers/GoModulesProvider.java rename to src/main/java/io/github/guacsec/trustifyda/providers/GoModulesProvider.java index 54016f16..2e71cb8b 100644 --- a/src/main/java/com/redhat/exhort/providers/GoModulesProvider.java +++ b/src/main/java/io/github/guacsec/trustifyda/providers/GoModulesProvider.java @@ -14,23 +14,23 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.redhat.exhort.providers; +package io.github.guacsec.trustifyda.providers; -import static com.redhat.exhort.impl.ExhortApi.debugLoggingIsNeeded; +import static io.github.guacsec.trustifyda.impl.ExhortApi.debugLoggingIsNeeded; import com.github.packageurl.MalformedPackageURLException; import com.github.packageurl.PackageURL; -import com.redhat.exhort.Api; -import com.redhat.exhort.Provider; -import com.redhat.exhort.logging.LoggersFactory; -import com.redhat.exhort.sbom.Sbom; -import com.redhat.exhort.sbom.SbomFactory; -import com.redhat.exhort.tools.Ecosystem.Type; -import com.redhat.exhort.tools.Operations; -import com.redhat.exhort.utils.Environment; -import com.redhat.exhort.vcs.GitVersionControlSystemImpl; -import com.redhat.exhort.vcs.TagInfo; -import com.redhat.exhort.vcs.VersionControlSystem; +import io.github.guacsec.trustifyda.Api; +import io.github.guacsec.trustifyda.Provider; +import io.github.guacsec.trustifyda.logging.LoggersFactory; +import io.github.guacsec.trustifyda.sbom.Sbom; +import io.github.guacsec.trustifyda.sbom.SbomFactory; +import io.github.guacsec.trustifyda.tools.Ecosystem.Type; +import io.github.guacsec.trustifyda.tools.Operations; +import io.github.guacsec.trustifyda.utils.Environment; +import io.github.guacsec.trustifyda.vcs.GitVersionControlSystemImpl; +import io.github.guacsec.trustifyda.vcs.TagInfo; +import io.github.guacsec.trustifyda.vcs.VersionControlSystem; import java.io.IOException; import java.nio.charset.StandardCharsets; import java.nio.file.Files; @@ -51,7 +51,8 @@ */ public final class GoModulesProvider extends Provider { - public static final String PROP_EXHORT_GO_MVS_LOGIC_ENABLED = "EXHORT_GO_MVS_LOGIC_ENABLED"; + public static final String PROP_TRUSTIFY_DA_GO_MVS_LOGIC_ENABLED = + "TRUSTIFY_DA_GO_MVS_LOGIC_ENABLED"; private static final Logger log = LoggersFactory.getLogger(GoModulesProvider.class.getName()); public static final String DEFAULT_MAIN_VERSION = "v0.0.0"; private final String goExecutable; @@ -277,7 +278,7 @@ private Sbom buildSbomFromGraph( startingIndex += deps.size(); } } - boolean goMvsLogicEnabled = Environment.getBoolean(PROP_EXHORT_GO_MVS_LOGIC_ENABLED, true); + boolean goMvsLogicEnabled = Environment.getBoolean(PROP_TRUSTIFY_DA_GO_MVS_LOGIC_ENABLED, true); if (goMvsLogicEnabled) { edges = getFinalPackagesVersionsForModule(edges, manifestPath); } diff --git a/src/main/java/com/redhat/exhort/providers/GradleProvider.java b/src/main/java/io/github/guacsec/trustifyda/providers/GradleProvider.java similarity index 97% rename from src/main/java/com/redhat/exhort/providers/GradleProvider.java rename to src/main/java/io/github/guacsec/trustifyda/providers/GradleProvider.java index a3fcb4dd..d4c11895 100644 --- a/src/main/java/com/redhat/exhort/providers/GradleProvider.java +++ b/src/main/java/io/github/guacsec/trustifyda/providers/GradleProvider.java @@ -14,19 +14,19 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.redhat.exhort.providers; +package io.github.guacsec.trustifyda.providers; -import static com.redhat.exhort.impl.ExhortApi.debugLoggingIsNeeded; +import static io.github.guacsec.trustifyda.impl.ExhortApi.debugLoggingIsNeeded; import com.github.packageurl.MalformedPackageURLException; import com.github.packageurl.PackageURL; -import com.redhat.exhort.Api; -import com.redhat.exhort.Provider; -import com.redhat.exhort.logging.LoggersFactory; -import com.redhat.exhort.sbom.Sbom; -import com.redhat.exhort.sbom.SbomFactory; -import com.redhat.exhort.tools.Ecosystem.Type; -import com.redhat.exhort.tools.Operations; +import io.github.guacsec.trustifyda.Api; +import io.github.guacsec.trustifyda.Provider; +import io.github.guacsec.trustifyda.logging.LoggersFactory; +import io.github.guacsec.trustifyda.sbom.Sbom; +import io.github.guacsec.trustifyda.sbom.SbomFactory; +import io.github.guacsec.trustifyda.tools.Ecosystem.Type; +import io.github.guacsec.trustifyda.tools.Operations; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; @@ -222,7 +222,7 @@ private String extractPackageName(String line) { private Path getDependencies(Path manifestPath) throws IOException { // create a temp file for storing the dependency tree in - var tempFile = Files.createTempFile("exhort_graph_", null); + var tempFile = Files.createTempFile("TRUSTIFY_DA_graph_", null); // the command will create the dependency tree in the temp file String gradleCommand = gradleExecutable + " dependencies"; diff --git a/src/main/java/com/redhat/exhort/providers/JavaMavenProvider.java b/src/main/java/io/github/guacsec/trustifyda/providers/JavaMavenProvider.java similarity index 96% rename from src/main/java/com/redhat/exhort/providers/JavaMavenProvider.java rename to src/main/java/io/github/guacsec/trustifyda/providers/JavaMavenProvider.java index 201cdb4b..5e2192ec 100644 --- a/src/main/java/com/redhat/exhort/providers/JavaMavenProvider.java +++ b/src/main/java/io/github/guacsec/trustifyda/providers/JavaMavenProvider.java @@ -14,20 +14,20 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.redhat.exhort.providers; +package io.github.guacsec.trustifyda.providers; -import static com.redhat.exhort.impl.ExhortApi.debugLoggingIsNeeded; +import static io.github.guacsec.trustifyda.impl.ExhortApi.debugLoggingIsNeeded; import com.github.packageurl.MalformedPackageURLException; import com.github.packageurl.PackageURL; -import com.redhat.exhort.Api; -import com.redhat.exhort.Provider; -import com.redhat.exhort.logging.LoggersFactory; -import com.redhat.exhort.sbom.Sbom; -import com.redhat.exhort.sbom.SbomFactory; -import com.redhat.exhort.tools.Ecosystem.Type; -import com.redhat.exhort.tools.Operations; -import com.redhat.exhort.utils.Environment; +import io.github.guacsec.trustifyda.Api; +import io.github.guacsec.trustifyda.Provider; +import io.github.guacsec.trustifyda.logging.LoggersFactory; +import io.github.guacsec.trustifyda.sbom.Sbom; +import io.github.guacsec.trustifyda.sbom.SbomFactory; +import io.github.guacsec.trustifyda.tools.Ecosystem.Type; +import io.github.guacsec.trustifyda.tools.Operations; +import io.github.guacsec.trustifyda.utils.Environment; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; @@ -72,7 +72,7 @@ public Content provideStack() throws IOException { // execute the clean command Operations.runProcess(manifest.getParent(), mvnCleanCmd.toArray(String[]::new), mvnEnvs); // create a temp file for storing the dependency tree in - var tmpFile = Files.createTempFile("exhort_dot_graph_", null); + var tmpFile = Files.createTempFile("TRUSTIFY_DA_dot_graph_", null); // the tree command will build the project and create the dependency tree in the temp file var mvnTreeCmd = buildMvnCommandArgs( @@ -128,7 +128,7 @@ public Content provideComponent() throws IOException { } private Content generateSbomFromEffectivePom() throws IOException { - var tmpEffPom = Files.createTempFile("exhort_eff_pom_", ".xml"); + var tmpEffPom = Files.createTempFile("TRUSTIFY_DA_eff_pom_", ".xml"); var mvnEffPomCmd = buildMvnCommandArgs( "clean", diff --git a/src/main/java/com/redhat/exhort/providers/JavaScriptNpmProvider.java b/src/main/java/io/github/guacsec/trustifyda/providers/JavaScriptNpmProvider.java similarity index 91% rename from src/main/java/com/redhat/exhort/providers/JavaScriptNpmProvider.java rename to src/main/java/io/github/guacsec/trustifyda/providers/JavaScriptNpmProvider.java index c83de5cd..efc77541 100644 --- a/src/main/java/com/redhat/exhort/providers/JavaScriptNpmProvider.java +++ b/src/main/java/io/github/guacsec/trustifyda/providers/JavaScriptNpmProvider.java @@ -14,10 +14,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.redhat.exhort.providers; +package io.github.guacsec.trustifyda.providers; -import com.redhat.exhort.tools.Ecosystem; -import com.redhat.exhort.tools.Operations; +import io.github.guacsec.trustifyda.tools.Ecosystem; +import io.github.guacsec.trustifyda.tools.Operations; import java.nio.file.Path; /** diff --git a/src/main/java/com/redhat/exhort/providers/JavaScriptPnpmProvider.java b/src/main/java/io/github/guacsec/trustifyda/providers/JavaScriptPnpmProvider.java similarity index 93% rename from src/main/java/com/redhat/exhort/providers/JavaScriptPnpmProvider.java rename to src/main/java/io/github/guacsec/trustifyda/providers/JavaScriptPnpmProvider.java index e60d95a9..5517656f 100644 --- a/src/main/java/com/redhat/exhort/providers/JavaScriptPnpmProvider.java +++ b/src/main/java/io/github/guacsec/trustifyda/providers/JavaScriptPnpmProvider.java @@ -14,12 +14,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.redhat.exhort.providers; +package io.github.guacsec.trustifyda.providers; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.JsonNode; -import com.redhat.exhort.tools.Ecosystem; -import com.redhat.exhort.tools.Operations; +import io.github.guacsec.trustifyda.tools.Ecosystem; +import io.github.guacsec.trustifyda.tools.Operations; import java.nio.file.Path; /** diff --git a/src/main/java/com/redhat/exhort/providers/JavaScriptProvider.java b/src/main/java/io/github/guacsec/trustifyda/providers/JavaScriptProvider.java similarity index 93% rename from src/main/java/com/redhat/exhort/providers/JavaScriptProvider.java rename to src/main/java/io/github/guacsec/trustifyda/providers/JavaScriptProvider.java index 0594e024..64aac6ea 100644 --- a/src/main/java/com/redhat/exhort/providers/JavaScriptProvider.java +++ b/src/main/java/io/github/guacsec/trustifyda/providers/JavaScriptProvider.java @@ -14,23 +14,23 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.redhat.exhort.providers; +package io.github.guacsec.trustifyda.providers; -import static com.redhat.exhort.impl.ExhortApi.debugLoggingIsNeeded; +import static io.github.guacsec.trustifyda.impl.ExhortApi.debugLoggingIsNeeded; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.JsonNode; import com.github.packageurl.MalformedPackageURLException; import com.github.packageurl.PackageURL; -import com.redhat.exhort.Api; -import com.redhat.exhort.Provider; -import com.redhat.exhort.logging.LoggersFactory; -import com.redhat.exhort.providers.javascript.model.Manifest; -import com.redhat.exhort.sbom.Sbom; -import com.redhat.exhort.sbom.SbomFactory; -import com.redhat.exhort.tools.Ecosystem; -import com.redhat.exhort.tools.Operations; -import com.redhat.exhort.utils.Environment; +import io.github.guacsec.trustifyda.Api; +import io.github.guacsec.trustifyda.Provider; +import io.github.guacsec.trustifyda.logging.LoggersFactory; +import io.github.guacsec.trustifyda.providers.javascript.model.Manifest; +import io.github.guacsec.trustifyda.sbom.Sbom; +import io.github.guacsec.trustifyda.sbom.SbomFactory; +import io.github.guacsec.trustifyda.tools.Ecosystem; +import io.github.guacsec.trustifyda.tools.Operations; +import io.github.guacsec.trustifyda.utils.Environment; import java.io.File; import java.io.IOException; import java.nio.charset.StandardCharsets; diff --git a/src/main/java/com/redhat/exhort/providers/JavaScriptProviderFactory.java b/src/main/java/io/github/guacsec/trustifyda/providers/JavaScriptProviderFactory.java similarity index 94% rename from src/main/java/com/redhat/exhort/providers/JavaScriptProviderFactory.java rename to src/main/java/io/github/guacsec/trustifyda/providers/JavaScriptProviderFactory.java index d08360ff..e40c7446 100644 --- a/src/main/java/com/redhat/exhort/providers/JavaScriptProviderFactory.java +++ b/src/main/java/io/github/guacsec/trustifyda/providers/JavaScriptProviderFactory.java @@ -14,9 +14,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.redhat.exhort.providers; +package io.github.guacsec.trustifyda.providers; -import com.redhat.exhort.Provider; +import io.github.guacsec.trustifyda.Provider; import java.nio.file.Files; import java.nio.file.Path; import java.util.Map; diff --git a/src/main/java/com/redhat/exhort/providers/JavaScriptYarnProvider.java b/src/main/java/io/github/guacsec/trustifyda/providers/JavaScriptYarnProvider.java similarity index 93% rename from src/main/java/com/redhat/exhort/providers/JavaScriptYarnProvider.java rename to src/main/java/io/github/guacsec/trustifyda/providers/JavaScriptYarnProvider.java index d71a8d2b..d38a6647 100644 --- a/src/main/java/com/redhat/exhort/providers/JavaScriptYarnProvider.java +++ b/src/main/java/io/github/guacsec/trustifyda/providers/JavaScriptYarnProvider.java @@ -14,13 +14,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.redhat.exhort.providers; +package io.github.guacsec.trustifyda.providers; import com.fasterxml.jackson.databind.JsonNode; import com.github.packageurl.PackageURL; -import com.redhat.exhort.sbom.Sbom; -import com.redhat.exhort.tools.Ecosystem; -import com.redhat.exhort.tools.Operations; +import io.github.guacsec.trustifyda.sbom.Sbom; +import io.github.guacsec.trustifyda.tools.Ecosystem; +import io.github.guacsec.trustifyda.tools.Operations; import java.nio.file.Path; import java.util.Map; import java.util.regex.Pattern; diff --git a/src/main/java/com/redhat/exhort/providers/PythonPipProvider.java b/src/main/java/io/github/guacsec/trustifyda/providers/PythonPipProvider.java similarity index 90% rename from src/main/java/com/redhat/exhort/providers/PythonPipProvider.java rename to src/main/java/io/github/guacsec/trustifyda/providers/PythonPipProvider.java index aaccea81..c1bffb88 100644 --- a/src/main/java/com/redhat/exhort/providers/PythonPipProvider.java +++ b/src/main/java/io/github/guacsec/trustifyda/providers/PythonPipProvider.java @@ -14,24 +14,24 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.redhat.exhort.providers; +package io.github.guacsec.trustifyda.providers; -import static com.redhat.exhort.impl.ExhortApi.debugLoggingIsNeeded; +import static io.github.guacsec.trustifyda.impl.ExhortApi.debugLoggingIsNeeded; import com.fasterxml.jackson.core.JsonProcessingException; import com.github.packageurl.MalformedPackageURLException; import com.github.packageurl.PackageURL; -import com.redhat.exhort.Api; -import com.redhat.exhort.Provider; -import com.redhat.exhort.logging.LoggersFactory; -import com.redhat.exhort.sbom.Sbom; -import com.redhat.exhort.sbom.SbomFactory; -import com.redhat.exhort.tools.Ecosystem; -import com.redhat.exhort.tools.Operations; -import com.redhat.exhort.utils.Environment; -import com.redhat.exhort.utils.PythonControllerBase; -import com.redhat.exhort.utils.PythonControllerRealEnv; -import com.redhat.exhort.utils.PythonControllerVirtualEnv; +import io.github.guacsec.trustifyda.Api; +import io.github.guacsec.trustifyda.Provider; +import io.github.guacsec.trustifyda.logging.LoggersFactory; +import io.github.guacsec.trustifyda.sbom.Sbom; +import io.github.guacsec.trustifyda.sbom.SbomFactory; +import io.github.guacsec.trustifyda.tools.Ecosystem; +import io.github.guacsec.trustifyda.tools.Operations; +import io.github.guacsec.trustifyda.utils.Environment; +import io.github.guacsec.trustifyda.utils.PythonControllerBase; +import io.github.guacsec.trustifyda.utils.PythonControllerRealEnv; +import io.github.guacsec.trustifyda.utils.PythonControllerVirtualEnv; import java.io.IOException; import java.nio.charset.StandardCharsets; import java.nio.file.Files; @@ -211,14 +211,16 @@ private PackageURL toPurl(String name, String version) { private PythonControllerBase getPythonController() { String pythonPipBinaries; boolean useVirtualPythonEnv; - if (!Environment.get(PythonControllerBase.PROP_EXHORT_PIP_SHOW, "").trim().isEmpty() - && !Environment.get(PythonControllerBase.PROP_EXHORT_PIP_FREEZE, "").trim().isEmpty()) { + if (!Environment.get(PythonControllerBase.PROP_TRUSTIFY_DA_PIP_SHOW, "").trim().isEmpty() + && !Environment.get(PythonControllerBase.PROP_TRUSTIFY_DA_PIP_FREEZE, "") + .trim() + .isEmpty()) { pythonPipBinaries = "python;;pip"; useVirtualPythonEnv = false; } else { pythonPipBinaries = getExecutable("python", "--version"); useVirtualPythonEnv = - Environment.getBoolean(PythonControllerBase.PROP_EXHORT_PYTHON_VIRTUAL_ENV, false); + Environment.getBoolean(PythonControllerBase.PROP_TRUSTIFY_DA_PYTHON_VIRTUAL_ENV, false); } String[] parts = pythonPipBinaries.split(";;"); diff --git a/src/main/java/com/redhat/exhort/providers/YarnBerryProcessor.java b/src/main/java/io/github/guacsec/trustifyda/providers/YarnBerryProcessor.java similarity index 95% rename from src/main/java/com/redhat/exhort/providers/YarnBerryProcessor.java rename to src/main/java/io/github/guacsec/trustifyda/providers/YarnBerryProcessor.java index 46fcfe34..da9cb204 100644 --- a/src/main/java/com/redhat/exhort/providers/YarnBerryProcessor.java +++ b/src/main/java/io/github/guacsec/trustifyda/providers/YarnBerryProcessor.java @@ -14,14 +14,14 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.redhat.exhort.providers; +package io.github.guacsec.trustifyda.providers; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.node.ArrayNode; import com.github.packageurl.PackageURL; -import com.redhat.exhort.providers.javascript.model.Manifest; -import com.redhat.exhort.sbom.Sbom; -import com.redhat.exhort.tools.Operations; +import io.github.guacsec.trustifyda.providers.javascript.model.Manifest; +import io.github.guacsec.trustifyda.sbom.Sbom; +import io.github.guacsec.trustifyda.tools.Operations; import java.nio.file.Path; import java.util.Map; import java.util.TreeMap; diff --git a/src/main/java/com/redhat/exhort/providers/YarnClassicProcessor.java b/src/main/java/io/github/guacsec/trustifyda/providers/YarnClassicProcessor.java similarity index 96% rename from src/main/java/com/redhat/exhort/providers/YarnClassicProcessor.java rename to src/main/java/io/github/guacsec/trustifyda/providers/YarnClassicProcessor.java index 7c487c02..2a7668f7 100644 --- a/src/main/java/com/redhat/exhort/providers/YarnClassicProcessor.java +++ b/src/main/java/io/github/guacsec/trustifyda/providers/YarnClassicProcessor.java @@ -14,13 +14,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.redhat.exhort.providers; +package io.github.guacsec.trustifyda.providers; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.node.ArrayNode; import com.github.packageurl.PackageURL; -import com.redhat.exhort.providers.javascript.model.Manifest; -import com.redhat.exhort.sbom.Sbom; +import io.github.guacsec.trustifyda.providers.javascript.model.Manifest; +import io.github.guacsec.trustifyda.sbom.Sbom; import java.nio.file.Path; import java.util.HashMap; import java.util.Map; diff --git a/src/main/java/com/redhat/exhort/providers/YarnProcessor.java b/src/main/java/io/github/guacsec/trustifyda/providers/YarnProcessor.java similarity index 89% rename from src/main/java/com/redhat/exhort/providers/YarnProcessor.java rename to src/main/java/io/github/guacsec/trustifyda/providers/YarnProcessor.java index 2ed504bc..87965034 100644 --- a/src/main/java/com/redhat/exhort/providers/YarnProcessor.java +++ b/src/main/java/io/github/guacsec/trustifyda/providers/YarnProcessor.java @@ -14,12 +14,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.redhat.exhort.providers; +package io.github.guacsec.trustifyda.providers; import com.fasterxml.jackson.databind.JsonNode; import com.github.packageurl.PackageURL; -import com.redhat.exhort.providers.javascript.model.Manifest; -import com.redhat.exhort.sbom.Sbom; +import io.github.guacsec.trustifyda.providers.javascript.model.Manifest; +import io.github.guacsec.trustifyda.sbom.Sbom; import java.nio.file.Path; import java.util.Map; diff --git a/src/main/java/com/redhat/exhort/providers/javascript/model/Manifest.java b/src/main/java/io/github/guacsec/trustifyda/providers/javascript/model/Manifest.java similarity index 95% rename from src/main/java/com/redhat/exhort/providers/javascript/model/Manifest.java rename to src/main/java/io/github/guacsec/trustifyda/providers/javascript/model/Manifest.java index 6f3a01a5..87a26703 100644 --- a/src/main/java/com/redhat/exhort/providers/javascript/model/Manifest.java +++ b/src/main/java/io/github/guacsec/trustifyda/providers/javascript/model/Manifest.java @@ -14,13 +14,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.redhat.exhort.providers.javascript.model; +package io.github.guacsec.trustifyda.providers.javascript.model; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.node.ArrayNode; import com.github.packageurl.PackageURL; -import com.redhat.exhort.providers.JavaScriptProvider; +import io.github.guacsec.trustifyda.providers.JavaScriptProvider; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; diff --git a/src/main/java/com/redhat/exhort/providers/javascript/model/package-info.java b/src/main/java/io/github/guacsec/trustifyda/providers/javascript/model/package-info.java similarity index 64% rename from src/main/java/com/redhat/exhort/providers/javascript/model/package-info.java rename to src/main/java/io/github/guacsec/trustifyda/providers/javascript/model/package-info.java index 49c6cdc9..f549bcb7 100644 --- a/src/main/java/com/redhat/exhort/providers/javascript/model/package-info.java +++ b/src/main/java/io/github/guacsec/trustifyda/providers/javascript/model/package-info.java @@ -2,4 +2,4 @@ * Package hosting various the content providers generating content that will be sent to the Backend * API. */ -package com.redhat.exhort.providers.javascript.model; +package io.github.guacsec.trustifyda.providers.javascript.model; diff --git a/src/main/java/com/redhat/exhort/providers/package-info.java b/src/main/java/io/github/guacsec/trustifyda/providers/package-info.java similarity index 70% rename from src/main/java/com/redhat/exhort/providers/package-info.java rename to src/main/java/io/github/guacsec/trustifyda/providers/package-info.java index efff6d82..851a8681 100644 --- a/src/main/java/com/redhat/exhort/providers/package-info.java +++ b/src/main/java/io/github/guacsec/trustifyda/providers/package-info.java @@ -2,4 +2,4 @@ * Package hosting various the content providers generating content that will be sent to the Backend * API. */ -package com.redhat.exhort.providers; +package io.github.guacsec.trustifyda.providers; diff --git a/src/main/java/com/redhat/exhort/sbom/CycloneDXSbom.java b/src/main/java/io/github/guacsec/trustifyda/sbom/CycloneDXSbom.java similarity index 96% rename from src/main/java/com/redhat/exhort/sbom/CycloneDXSbom.java rename to src/main/java/io/github/guacsec/trustifyda/sbom/CycloneDXSbom.java index a537a794..accdf592 100644 --- a/src/main/java/com/redhat/exhort/sbom/CycloneDXSbom.java +++ b/src/main/java/io/github/guacsec/trustifyda/sbom/CycloneDXSbom.java @@ -14,14 +14,14 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.redhat.exhort.sbom; +package io.github.guacsec.trustifyda.sbom; -import static com.redhat.exhort.impl.ExhortApi.debugLoggingIsNeeded; +import static io.github.guacsec.trustifyda.impl.ExhortApi.debugLoggingIsNeeded; import com.github.packageurl.MalformedPackageURLException; import com.github.packageurl.PackageURL; -import com.redhat.exhort.logging.LoggersFactory; -import com.redhat.exhort.utils.Environment; +import io.github.guacsec.trustifyda.logging.LoggersFactory; +import io.github.guacsec.trustifyda.utils.Environment; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; @@ -45,7 +45,7 @@ public class CycloneDXSbom implements Sbom { - private static final String EXHORT_IGNORE_METHOD = "EXHORT_IGNORE_METHOD"; + private static final String TRUSTIFY_DA_IGNORE_METHOD = "TRUSTIFY_DA_IGNORE_METHOD"; private final Logger log = LoggersFactory.getLogger(this.getClass().getName()); private static final Version VERSION = Version.VERSION_14; private String exhortIgnoreMethod; @@ -120,7 +120,7 @@ public Sbom filterIgnoredDeps(Collection ignoredDeps) { } private String getExhortIgnoreMethod() { - var val = Environment.get(EXHORT_IGNORE_METHOD); + var val = Environment.get(TRUSTIFY_DA_IGNORE_METHOD); return val != null ? val.trim().toLowerCase() : null; } diff --git a/src/main/java/com/redhat/exhort/sbom/Sbom.java b/src/main/java/io/github/guacsec/trustifyda/sbom/Sbom.java similarity index 97% rename from src/main/java/com/redhat/exhort/sbom/Sbom.java rename to src/main/java/io/github/guacsec/trustifyda/sbom/Sbom.java index 73d8fefc..ed5bcf79 100644 --- a/src/main/java/com/redhat/exhort/sbom/Sbom.java +++ b/src/main/java/io/github/guacsec/trustifyda/sbom/Sbom.java @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.redhat.exhort.sbom; +package io.github.guacsec.trustifyda.sbom; import com.github.packageurl.PackageURL; import java.util.Collection; diff --git a/src/main/java/com/redhat/exhort/sbom/SbomFactory.java b/src/main/java/io/github/guacsec/trustifyda/sbom/SbomFactory.java similarity index 95% rename from src/main/java/com/redhat/exhort/sbom/SbomFactory.java rename to src/main/java/io/github/guacsec/trustifyda/sbom/SbomFactory.java index 262a0f47..bb54b56e 100644 --- a/src/main/java/com/redhat/exhort/sbom/SbomFactory.java +++ b/src/main/java/io/github/guacsec/trustifyda/sbom/SbomFactory.java @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.redhat.exhort.sbom; +package io.github.guacsec.trustifyda.sbom; public class SbomFactory { diff --git a/src/main/java/io/github/guacsec/trustifyda/sbom/package-info.java b/src/main/java/io/github/guacsec/trustifyda/sbom/package-info.java new file mode 100644 index 00000000..84d1ff1f --- /dev/null +++ b/src/main/java/io/github/guacsec/trustifyda/sbom/package-info.java @@ -0,0 +1 @@ +package io.github.guacsec.trustifyda.sbom; diff --git a/src/main/java/com/redhat/exhort/tools/Ecosystem.java b/src/main/java/io/github/guacsec/trustifyda/tools/Ecosystem.java similarity index 86% rename from src/main/java/com/redhat/exhort/tools/Ecosystem.java rename to src/main/java/io/github/guacsec/trustifyda/tools/Ecosystem.java index 85aad7b5..04fe0447 100644 --- a/src/main/java/com/redhat/exhort/tools/Ecosystem.java +++ b/src/main/java/io/github/guacsec/trustifyda/tools/Ecosystem.java @@ -14,14 +14,14 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.redhat.exhort.tools; +package io.github.guacsec.trustifyda.tools; -import com.redhat.exhort.Provider; -import com.redhat.exhort.providers.GoModulesProvider; -import com.redhat.exhort.providers.GradleProvider; -import com.redhat.exhort.providers.JavaMavenProvider; -import com.redhat.exhort.providers.JavaScriptProviderFactory; -import com.redhat.exhort.providers.PythonPipProvider; +import io.github.guacsec.trustifyda.Provider; +import io.github.guacsec.trustifyda.providers.GoModulesProvider; +import io.github.guacsec.trustifyda.providers.GradleProvider; +import io.github.guacsec.trustifyda.providers.JavaMavenProvider; +import io.github.guacsec.trustifyda.providers.JavaScriptProviderFactory; +import io.github.guacsec.trustifyda.providers.PythonPipProvider; import java.nio.file.Path; /** Utility class used for instantiating providers. * */ diff --git a/src/main/java/com/redhat/exhort/tools/Operations.java b/src/main/java/io/github/guacsec/trustifyda/tools/Operations.java similarity index 94% rename from src/main/java/com/redhat/exhort/tools/Operations.java rename to src/main/java/io/github/guacsec/trustifyda/tools/Operations.java index 12f55cfd..9b1dd932 100644 --- a/src/main/java/com/redhat/exhort/tools/Operations.java +++ b/src/main/java/io/github/guacsec/trustifyda/tools/Operations.java @@ -14,12 +14,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.redhat.exhort.tools; +package io.github.guacsec.trustifyda.tools; import static java.lang.String.join; -import com.redhat.exhort.logging.LoggersFactory; -import com.redhat.exhort.utils.Environment; +import io.github.guacsec.trustifyda.logging.LoggersFactory; +import io.github.guacsec.trustifyda.utils.Environment; import java.io.BufferedReader; import java.io.File; import java.io.IOException; @@ -48,9 +48,9 @@ private Operations() { /** * Function for looking up custom executable path based on the default one provides as an * argument. I.e. if defaultExecutable=mvn, this function will look for a custom mvn path set as - * an environment variable or a java property with the name EXHORT_MVN_PATH. If not found, the - * original mvn passed as defaultExecutable will be returned. Note, environment variables takes - * precedence on java properties. + * an environment variable or a java property with the name TRUSTIFY_DA_MVN_PATH. If not found, + * the original mvn passed as defaultExecutable will be returned. Note, environment variables + * takes precedence on java properties. * * @param defaultExecutable default executable (uppercase spaces and dashes will be replaced with * underscores). @@ -64,7 +64,7 @@ public static String getCustomPathOrElse(String defaultExecutable) { } var target = normalized.toUpperCase().replaceAll(" ", "_").replaceAll("-", "_"); - var primaryKey = String.format("EXHORT_%s_PATH", target); + var primaryKey = String.format("TRUSTIFY_DA_%s_PATH", target); String primary = Environment.get(primaryKey); if (primary != null) { return primary; @@ -316,7 +316,7 @@ public static String getExecutable(String command, String args) { * Checks whether a wrapper preference is set for a given tool name. * *

This method looks for an environment variable with the name {@code - * EXHORT_PREFER_W}, where {@code } is the uppercase form of the provided + * TRUSTIFY_DA_PREFER_W}, where {@code } is the uppercase form of the provided * {@code name} parameter. If the environment variable is present (i.e., not {@code null}), the * method returns {@code true}. * @@ -324,7 +324,7 @@ public static String getExecutable(String command, String args) { * @return {@code true} if the corresponding environment variable is set; {@code false} otherwise */ public static boolean getWrapperPreference(String name) { - return Environment.get("EXHORT_PREFER_" + name.toUpperCase() + "W") != null; + return Environment.get("TRUSTIFY_DA_PREFER_" + name.toUpperCase() + "W") != null; } /** @@ -334,7 +334,7 @@ public static boolean getWrapperPreference(String name) { * @return the configuration value if set and not blank, null otherwise */ public static String getMavenConfig(String configName) { - String configValue = Environment.get("EXHORT_MVN_" + configName); + String configValue = Environment.get("TRUSTIFY_DA_MVN_" + configName); return (configValue != null && !configValue.isBlank()) ? configValue : null; } diff --git a/src/main/java/com/redhat/exhort/tools/package-info.java b/src/main/java/io/github/guacsec/trustifyda/tools/package-info.java similarity index 64% rename from src/main/java/com/redhat/exhort/tools/package-info.java rename to src/main/java/io/github/guacsec/trustifyda/tools/package-info.java index f5dae356..3c7705d3 100644 --- a/src/main/java/com/redhat/exhort/tools/package-info.java +++ b/src/main/java/io/github/guacsec/trustifyda/tools/package-info.java @@ -1,2 +1,2 @@ /** Package hosting various utility and tools used throughout the project. * */ -package com.redhat.exhort.tools; +package io.github.guacsec.trustifyda.tools; diff --git a/src/main/java/com/redhat/exhort/utils/Environment.java b/src/main/java/io/github/guacsec/trustifyda/utils/Environment.java similarity index 96% rename from src/main/java/com/redhat/exhort/utils/Environment.java rename to src/main/java/io/github/guacsec/trustifyda/utils/Environment.java index 076828dd..4cd6019f 100644 --- a/src/main/java/com/redhat/exhort/utils/Environment.java +++ b/src/main/java/io/github/guacsec/trustifyda/utils/Environment.java @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.redhat.exhort.utils; +package io.github.guacsec.trustifyda.utils; import java.util.Optional; diff --git a/src/main/java/com/redhat/exhort/utils/PythonControllerBase.java b/src/main/java/io/github/guacsec/trustifyda/utils/PythonControllerBase.java similarity index 90% rename from src/main/java/com/redhat/exhort/utils/PythonControllerBase.java rename to src/main/java/io/github/guacsec/trustifyda/utils/PythonControllerBase.java index 267e3291..b8b65a2b 100644 --- a/src/main/java/com/redhat/exhort/utils/PythonControllerBase.java +++ b/src/main/java/io/github/guacsec/trustifyda/utils/PythonControllerBase.java @@ -14,17 +14,17 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.redhat.exhort.utils; +package io.github.guacsec.trustifyda.utils; -import static com.redhat.exhort.Provider.PROP_MATCH_MANIFEST_VERSIONS; -import static com.redhat.exhort.impl.ExhortApi.debugLoggingIsNeeded; +import static io.github.guacsec.trustifyda.Provider.PROP_MATCH_MANIFEST_VERSIONS; +import static io.github.guacsec.trustifyda.impl.ExhortApi.debugLoggingIsNeeded; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; -import com.redhat.exhort.exception.PackageNotInstalledException; -import com.redhat.exhort.logging.LoggersFactory; -import com.redhat.exhort.tools.Operations; +import io.github.guacsec.trustifyda.exception.PackageNotInstalledException; +import io.github.guacsec.trustifyda.logging.LoggersFactory; +import io.github.guacsec.trustifyda.tools.Operations; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; @@ -40,13 +40,13 @@ public abstract class PythonControllerBase { - public static final String PROP_EXHORT_PIP_PIPDEPTREE = "EXHORT_PIP_PIPDEPTREE"; - public static final String PROP_EXHORT_PIP_FREEZE = "EXHORT_PIP_FREEZE"; - public static final String PROP_EXHORT_PIP_USE_DEP_TREE = "EXHORT_PIP_USE_DEP_TREE"; - public static final String PROP_EXHORT_PYTHON_INSTALL_BEST_EFFORTS = - "EXHORT_PYTHON_INSTALL_BEST_EFFORTS"; - public static final String PROP_EXHORT_PIP_SHOW = "EXHORT_PIP_SHOW"; - public static final String PROP_EXHORT_PYTHON_VIRTUAL_ENV = "EXHORT_PYTHON_VIRTUAL_ENV"; + public static final String PROP_TRUSTIFY_DA_PIP_PIPDEPTREE = "TRUSTIFY_DA_PIP_PIPDEPTREE"; + public static final String PROP_TRUSTIFY_DA_PIP_FREEZE = "TRUSTIFY_DA_PIP_FREEZE"; + public static final String PROP_TRUSTIFY_DA_PIP_USE_DEP_TREE = "TRUSTIFY_DA_PIP_USE_DEP_TREE"; + public static final String PROP_TRUSTIFY_DA_PYTHON_INSTALL_BEST_EFFORTS = + "TRUSTIFY_DA_PYTHON_INSTALL_BEST_EFFORTS"; + public static final String PROP_TRUSTIFY_DA_PIP_SHOW = "TRUSTIFY_DA_PIP_SHOW"; + public static final String PROP_TRUSTIFY_DA_PYTHON_VIRTUAL_ENV = "TRUSTIFY_DA_PYTHON_VIRTUAL_ENV"; private final Logger log = LoggersFactory.getLogger(this.getClass().getName()); protected Path pythonEnvironmentDir; @@ -78,7 +78,7 @@ public final List> getDependencies( } if (automaticallyInstallPackageOnEnvironment()) { boolean installBestEfforts = - Environment.getBoolean(PROP_EXHORT_PYTHON_INSTALL_BEST_EFFORTS, false); + Environment.getBoolean(PROP_TRUSTIFY_DA_PYTHON_INSTALL_BEST_EFFORTS, false); /* make best efforts to install the requirements.txt on the virtual environment created from the python3 passed in. that means that it will install the packages without referring to @@ -90,7 +90,7 @@ public final List> getDependencies( if (matchManifestVersions) { throw new RuntimeException( "Conflicting settings, " - + PythonControllerBase.PROP_EXHORT_PYTHON_INSTALL_BEST_EFFORTS + + PythonControllerBase.PROP_TRUSTIFY_DA_PYTHON_INSTALL_BEST_EFFORTS + "=true can only work with " + PROP_MATCH_MANIFEST_VERSIONS + "=false"); @@ -223,26 +223,27 @@ private String getPipShowFromEnvironment(List depNames) { args.add(pipBinaryLocation); args.add("show"); args.addAll(depNames); - return executeCommandOrExtractFromEnv(PROP_EXHORT_PIP_SHOW, args.toArray(new String[] {})); + return executeCommandOrExtractFromEnv(PROP_TRUSTIFY_DA_PIP_SHOW, args.toArray(new String[] {})); } String getPipFreezeFromEnvironment() { return executeCommandOrExtractFromEnv( - PROP_EXHORT_PIP_FREEZE, pipBinaryLocation, "freeze", "--all"); + PROP_TRUSTIFY_DA_PIP_FREEZE, pipBinaryLocation, "freeze", "--all"); } List getDependencyTreeJsonFromPipDepTree() { executeCommandOrExtractFromEnv( - PROP_EXHORT_PIP_PIPDEPTREE, pipBinaryLocation, "install", "pipdeptree"); + PROP_TRUSTIFY_DA_PIP_PIPDEPTREE, pipBinaryLocation, "install", "pipdeptree"); String pipdeptreeJsonString = ""; if (isVirtualEnv()) { pipdeptreeJsonString = - executeCommandOrExtractFromEnv(PROP_EXHORT_PIP_PIPDEPTREE, "./bin/pipdeptree", "--json"); + executeCommandOrExtractFromEnv( + PROP_TRUSTIFY_DA_PIP_PIPDEPTREE, "./bin/pipdeptree", "--json"); } else if (isRealEnv()) { pipdeptreeJsonString = executeCommandOrExtractFromEnv( - PROP_EXHORT_PIP_PIPDEPTREE, pathToPythonBin, "-m", "pipdeptree", "--json"); + PROP_TRUSTIFY_DA_PIP_PIPDEPTREE, pathToPythonBin, "-m", "pipdeptree", "--json"); } if (debugLoggingIsNeeded()) { String pipdeptreeMessage = @@ -307,7 +308,7 @@ private void bringAllDependencies( + " better to install requirements.txt altogether) or turn on environment" + " variable %s=true to automatically install it on" + " virtual environment (will slow down the analysis)", - depName, PROP_EXHORT_PYTHON_VIRTUAL_ENV)); + depName, PROP_TRUSTIFY_DA_PYTHON_VIRTUAL_ENV)); } Map dataMap = new HashMap<>(); @@ -411,7 +412,7 @@ private PythonDependency getPythonDependencyByShowStringBlock(String pipShowStri } private void fillCacheWithEnvironmentDeps(Map cache) { - boolean usePipDepTree = Environment.getBoolean(PROP_EXHORT_PIP_USE_DEP_TREE, false); + boolean usePipDepTree = Environment.getBoolean(PROP_TRUSTIFY_DA_PIP_USE_DEP_TREE, false); if (usePipDepTree) { getDependencyTreeJsonFromPipDepTree().forEach(d -> saveToCacheWithKeyVariations(cache, d)); } else { diff --git a/src/main/java/com/redhat/exhort/utils/PythonControllerRealEnv.java b/src/main/java/io/github/guacsec/trustifyda/utils/PythonControllerRealEnv.java similarity index 97% rename from src/main/java/com/redhat/exhort/utils/PythonControllerRealEnv.java rename to src/main/java/io/github/guacsec/trustifyda/utils/PythonControllerRealEnv.java index 7deae16f..3dead077 100644 --- a/src/main/java/com/redhat/exhort/utils/PythonControllerRealEnv.java +++ b/src/main/java/io/github/guacsec/trustifyda/utils/PythonControllerRealEnv.java @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.redhat.exhort.utils; +package io.github.guacsec.trustifyda.utils; import java.nio.file.FileSystems; import java.nio.file.Path; diff --git a/src/main/java/com/redhat/exhort/utils/PythonControllerTestEnv.java b/src/main/java/io/github/guacsec/trustifyda/utils/PythonControllerTestEnv.java similarity index 92% rename from src/main/java/com/redhat/exhort/utils/PythonControllerTestEnv.java rename to src/main/java/io/github/guacsec/trustifyda/utils/PythonControllerTestEnv.java index 7070510e..0b28b0a1 100644 --- a/src/main/java/com/redhat/exhort/utils/PythonControllerTestEnv.java +++ b/src/main/java/io/github/guacsec/trustifyda/utils/PythonControllerTestEnv.java @@ -14,9 +14,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.redhat.exhort.utils; +package io.github.guacsec.trustifyda.utils; -import com.redhat.exhort.tools.Operations; +import io.github.guacsec.trustifyda.tools.Operations; import java.nio.file.Path; public class PythonControllerTestEnv extends PythonControllerRealEnv { diff --git a/src/main/java/com/redhat/exhort/utils/PythonControllerVirtualEnv.java b/src/main/java/io/github/guacsec/trustifyda/utils/PythonControllerVirtualEnv.java similarity index 95% rename from src/main/java/com/redhat/exhort/utils/PythonControllerVirtualEnv.java rename to src/main/java/io/github/guacsec/trustifyda/utils/PythonControllerVirtualEnv.java index ae29988f..f39ab436 100644 --- a/src/main/java/com/redhat/exhort/utils/PythonControllerVirtualEnv.java +++ b/src/main/java/io/github/guacsec/trustifyda/utils/PythonControllerVirtualEnv.java @@ -14,9 +14,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.redhat.exhort.utils; +package io.github.guacsec.trustifyda.utils; -import com.redhat.exhort.tools.Operations; +import io.github.guacsec.trustifyda.tools.Operations; import java.io.IOException; import java.nio.file.FileSystems; import java.nio.file.Files; @@ -28,9 +28,9 @@ public class PythonControllerVirtualEnv extends PythonControllerBase { // private System.Logger log = System.getLogger("name"); public PythonControllerVirtualEnv(String pathToPythonBin) { this.pipBinaryDir = - Path.of(FileSystems.getDefault().getSeparator(), "tmp", "exhort_env", "bin"); + Path.of(FileSystems.getDefault().getSeparator(), "tmp", "trustify_da_env", "bin"); this.pythonEnvironmentDir = - Path.of(FileSystems.getDefault().getSeparator(), "tmp", "exhort_env"); + Path.of(FileSystems.getDefault().getSeparator(), "tmp", "trustify_da_env"); this.pathToPythonBin = pathToPythonBin; } diff --git a/src/main/java/com/redhat/exhort/utils/PythonDependency.java b/src/main/java/io/github/guacsec/trustifyda/utils/PythonDependency.java similarity index 96% rename from src/main/java/com/redhat/exhort/utils/PythonDependency.java rename to src/main/java/io/github/guacsec/trustifyda/utils/PythonDependency.java index 7a2bd715..7dd2916b 100644 --- a/src/main/java/com/redhat/exhort/utils/PythonDependency.java +++ b/src/main/java/io/github/guacsec/trustifyda/utils/PythonDependency.java @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.redhat.exhort.utils; +package io.github.guacsec.trustifyda.utils; import java.util.List; diff --git a/src/main/java/com/redhat/exhort/utils/StringInsensitive.java b/src/main/java/io/github/guacsec/trustifyda/utils/StringInsensitive.java similarity index 96% rename from src/main/java/com/redhat/exhort/utils/StringInsensitive.java rename to src/main/java/io/github/guacsec/trustifyda/utils/StringInsensitive.java index 3675712e..982b835a 100644 --- a/src/main/java/com/redhat/exhort/utils/StringInsensitive.java +++ b/src/main/java/io/github/guacsec/trustifyda/utils/StringInsensitive.java @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.redhat.exhort.utils; +package io.github.guacsec.trustifyda.utils; import java.util.Objects; diff --git a/src/main/java/com/redhat/exhort/vcs/GitVersionControlSystemImpl.java b/src/main/java/io/github/guacsec/trustifyda/vcs/GitVersionControlSystemImpl.java similarity index 98% rename from src/main/java/com/redhat/exhort/vcs/GitVersionControlSystemImpl.java rename to src/main/java/io/github/guacsec/trustifyda/vcs/GitVersionControlSystemImpl.java index 35bbdcb2..11b4f0f5 100644 --- a/src/main/java/com/redhat/exhort/vcs/GitVersionControlSystemImpl.java +++ b/src/main/java/io/github/guacsec/trustifyda/vcs/GitVersionControlSystemImpl.java @@ -14,9 +14,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.redhat.exhort.vcs; +package io.github.guacsec.trustifyda.vcs; -import com.redhat.exhort.tools.Operations; +import io.github.guacsec.trustifyda.tools.Operations; import java.nio.file.Path; import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; diff --git a/src/main/java/com/redhat/exhort/vcs/TagInfo.java b/src/main/java/io/github/guacsec/trustifyda/vcs/TagInfo.java similarity index 97% rename from src/main/java/com/redhat/exhort/vcs/TagInfo.java rename to src/main/java/io/github/guacsec/trustifyda/vcs/TagInfo.java index 3ab17cd2..88e0fcc8 100644 --- a/src/main/java/com/redhat/exhort/vcs/TagInfo.java +++ b/src/main/java/io/github/guacsec/trustifyda/vcs/TagInfo.java @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.redhat.exhort.vcs; +package io.github.guacsec.trustifyda.vcs; import java.time.LocalDateTime; diff --git a/src/main/java/com/redhat/exhort/vcs/VersionControlSystem.java b/src/main/java/io/github/guacsec/trustifyda/vcs/VersionControlSystem.java similarity index 97% rename from src/main/java/com/redhat/exhort/vcs/VersionControlSystem.java rename to src/main/java/io/github/guacsec/trustifyda/vcs/VersionControlSystem.java index 757bb97c..e9cb2df7 100644 --- a/src/main/java/com/redhat/exhort/vcs/VersionControlSystem.java +++ b/src/main/java/io/github/guacsec/trustifyda/vcs/VersionControlSystem.java @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.redhat.exhort.vcs; +package io.github.guacsec.trustifyda.vcs; import java.nio.file.Path; diff --git a/src/main/java/module-info.java b/src/main/java/module-info.java index 6e740677..a9d27524 100644 --- a/src/main/java/module-info.java +++ b/src/main/java/module-info.java @@ -1,4 +1,4 @@ -module com.redhat.exhort { +module io.github.guacsec.trustifyda { requires java.net.http; requires com.fasterxml.jackson.annotation; requires com.fasterxml.jackson.core; @@ -6,33 +6,33 @@ requires jakarta.annotation; requires java.xml; requires jakarta.mail; - requires transitive exhort.api; + requires transitive trustifyda.api; requires cyclonedx.core.java; requires transitive packageurl.java; requires transitive java.logging; requires org.tomlj; requires java.base; - opens com.redhat.exhort.providers to + opens io.github.guacsec.trustifyda.providers to com.fasterxml.jackson.databind; - exports com.redhat.exhort; - exports com.redhat.exhort.impl; - exports com.redhat.exhort.sbom; - exports com.redhat.exhort.tools; - exports com.redhat.exhort.utils; + exports io.github.guacsec.trustifyda; + exports io.github.guacsec.trustifyda.impl; + exports io.github.guacsec.trustifyda.sbom; + exports io.github.guacsec.trustifyda.tools; + exports io.github.guacsec.trustifyda.utils; - opens com.redhat.exhort.utils to + opens io.github.guacsec.trustifyda.utils to com.fasterxml.jackson.databind; - opens com.redhat.exhort.sbom to + opens io.github.guacsec.trustifyda.sbom to com.fasterxml.jackson.databind, packageurl.java; - exports com.redhat.exhort.providers; - exports com.redhat.exhort.providers.javascript.model; - exports com.redhat.exhort.logging; - exports com.redhat.exhort.image; + exports io.github.guacsec.trustifyda.providers; + exports io.github.guacsec.trustifyda.providers.javascript.model; + exports io.github.guacsec.trustifyda.logging; + exports io.github.guacsec.trustifyda.image; - opens com.redhat.exhort.image to + opens io.github.guacsec.trustifyda.image to com.fasterxml.jackson.databind; } diff --git a/src/main/resources/cli_help.txt b/src/main/resources/cli_help.txt index 8301f1cf..dd5b6b21 100644 --- a/src/main/resources/cli_help.txt +++ b/src/main/resources/cli_help.txt @@ -1,7 +1,7 @@ -Exhort Java API CLI +Dependency Analytics Java API CLI USAGE: - java -jar exhort-java-api.jar [OPTIONS] + java -jar trustify-da-java-client-cli.jar [OPTIONS] COMMANDS: stack [--summary|--html] @@ -21,7 +21,7 @@ OPTIONS: -h, --help Show this help message EXAMPLES: - java -jar exhort-java-api.jar stack /path/to/pom.xml - java -jar exhort-java-api.jar stack /path/to/package.json --summary - java -jar exhort-java-api.jar stack /path/to/build.gradle --html - java -jar exhort-java-api.jar component /path/to/requirements.txt + java -jar trustify-da-java-client-cli.jar stack /path/to/pom.xml + java -jar trustify-da-java-client-cli.jar stack /path/to/package.json --summary + java -jar trustify-da-java-client-cli.jar stack /path/to/build.gradle --html + java -jar trustify-da-java-client-cli.jar component /path/to/requirements.txt diff --git a/src/main/resources/config.properties b/src/main/resources/config.properties index 39940fa7..66bae57e 100644 --- a/src/main/resources/config.properties +++ b/src/main/resources/config.properties @@ -1 +1 @@ -EXHORT_DEV_MODE=false +TRUSTIFY_DA_DEV_MODE=false diff --git a/src/main/resources/exhort/openapi.yaml b/src/main/resources/exhort/openapi.yaml deleted file mode 100644 index 2cc153f5..00000000 --- a/src/main/resources/exhort/openapi.yaml +++ /dev/null @@ -1,407 +0,0 @@ -openapi: 3.0.3 -info: - title: Exhort API - description: Vulnerability analysis with Red Hat Trusted Profile Analyzer - license: - name: Apache 2.0 - url: https://www.apache.org/licenses/LICENSE-2.0.html - version: 4.1.0 -servers: - - url: https://rhda.rhcloud.com/api/v4 - description: Production server - - url: https://exhort-alpha.stage.devshift.net/api/v4 - description: Staging server - - url: http://localhost:8080/api/v4 - description: Local development -paths: - /analysis: - post: - operationId: analysis - summary: Takes a client-resolved dependency graph to perform a full stack analysis from all the available Vulnerability sources - security: - - RhdaTokenAuth: [] - - SnykTokenAuth: [] - - OssIndexUserAuth: [] - OssIndexTokenAuth: [] - parameters: - - name: providers - in: query - description: List of vulnerability providers to get the report from - required: false - schema: - enum: - - snyk - - oss-index - type: string - example: snyk - requestBody: - required: true - description: Dependency graph in SBOM format - content: - application/vnd.cyclonedx+json: - schema: - type: object - application/vnd.spdx+json: - schema: - type: object - responses: - '200': - description: Full dependency analysis from all the available providers - content: - application/json: - schema: - $ref: '#/components/schemas/AnalysisReport' - text/html: - schema: - type: object - multipart/mixed: - schema: - type: object - properties: - json_report: - $ref: '#/components/schemas/AnalysisReport' - html_report: - type: object - '422': - description: Invalid request - content: - text/plain: - schema: - type: string - description: Error message - /batch-analysis: - post: - operationId: batchAnalysis - summary: Takes an array of client-resolved dependency graphs to perform a full stack analysis from all the available Vulnerability sources - security: - - RhdaTokenAuth: [ ] - - SnykTokenAuth: [ ] - - OssIndexUserAuth: [ ] - OssIndexTokenAuth: [ ] - parameters: - - name: providers - in: query - description: List of vulnerability providers to get the report from - required: false - schema: - enum: - - snyk - - oss-index - type: string - example: snyk - requestBody: - required: true - description: An array of dependency graphs in SBOM format - content: - application/vnd.cyclonedx+json: - schema: - type: object - additionalProperties: - type: object - application/vnd.spdx+json: - schema: - type: object - additionalProperties: - type: object - responses: - '200': - description: Full dependency analysis from all the available providers - content: - application/json: - schema: - type: object - additionalProperties: - $ref: '#/components/schemas/AnalysisReport' - text/html: - schema: - type: object - multipart/mixed: - schema: - type: object - properties: - json_report: - type: object - additionalProperties: - $ref: '#/components/schemas/AnalysisReport' - html_report: - type: object - '422': - description: Invalid request - content: - text/plain: - schema: - type: string - description: Error message - /token: - get: - operationId: validateToken - summary: Validates a vulnerability provider token - security: - - RhdaTokenAuth: [] - - SnykTokenAuth: [] - - OssIndexUserAuth: [] - OssIndexTokenAuth: [] - responses: - '200': - description: Successful token validation - content: - text/plain: - schema: - type: string - description: Response message - '401': - description: Invalid token - content: - text/plain: - schema: - type: string - description: Error message - '403': - description: Forbidden. The token does not have permissions - content: - text/plain: - schema: - type: string - description: Error message - '429': - description: Too many requests. Rate limit exceeded - content: - text/plain: - schema: - type: string - description: Error message - '400': - description: Invalid request - content: - text/plain: - schema: - type: string - description: Missing token - -components: - securitySchemes: - RhdaTokenAuth: - type: apiKey - in: header - name: rhda-token - SnykTokenAuth: - type: apiKey - in: header - name: ex-snyk-token - OssIndexUserAuth: - type: apiKey - in: header - name: ex-oss-index-name - OssIndexTokenAuth: - type: apiKey - in: header - name: ex-oss-index-token - schemas: - AnalysisReport: - type: object - properties: - scanned: - $ref: '#/components/schemas/Scanned' - providers: - $ref: '#/components/schemas/Providers' - Scanned: - type: object - description: Number of dependencies scanned - properties: - total: - type: integer - direct: - type: integer - transitive: - type: integer - Providers: - type: object - additionalProperties: - $ref: '#/components/schemas/ProviderReport' - ProviderReport: - type: object - properties: - status: - $ref: '#/components/schemas/ProviderStatus' - sources: - type: object - additionalProperties: - $ref: '#/components/schemas/Source' - ProviderStatus: - type: object - properties: - ok: - type: boolean - name: - type: string - code: - type: integer - message: - type: string - Source: - type: object - properties: - summary: - $ref: '#/components/schemas/SourceSummary' - dependencies: - type: array - items: - $ref: '#/components/schemas/DependencyReport' - unscanned: - type: array - items: - $ref: '#/components/schemas/UnscannedDependency' - SourceSummary: - type: object - properties: - direct: - type: integer - default: 0 - transitive: - type: integer - default: 0 - total: - type: integer - default: 0 - dependencies: - type: integer - default: 0 - critical: - type: integer - default: 0 - high: - type: integer - default: 0 - medium: - type: integer - default: 0 - low: - type: integer - default: 0 - remediations: - type: integer - default: 0 - recommendations: - type: integer - default: 0 - unscanned: - type: integer - default: 0 - PackageRef: - type: string - description: PackageURL used to identify a dependency artifact - example: pkg:maven/io.quarkus/quarkus-hibernate-orm@2.13.5.Final - DependencyReport: - type: object - properties: - ref: - $ref: '#/components/schemas/PackageRef' - issues: - type: array - items: - $ref: '#/components/schemas/Issue' - transitive: - type: array - items: - $ref: '#/components/schemas/TransitiveDependencyReport' - recommendation: - description: Trusted Content recommendation that is not related to any security vulnerability - allOf: - - $ref: '#/components/schemas/PackageRef' - highestVulnerability: - description: Highest vulnerability found for this dependency - $ref: '#/components/schemas/Issue' - Severity: - type: string - enum: - - CRITICAL - - HIGH - - MEDIUM - - LOW - Issue: - type: object - properties: - id: - type: string - title: - type: string - source: - type: string - cvss: - $ref: '#/components/schemas/CvssVector' - cvssScore: - type: number - format: float - severity: - $ref: '#/components/schemas/Severity' - cves: - type: array - items: - type: string - unique: - type: boolean - default: false - remediation: - $ref: '#/components/schemas/Remediation' - TransitiveDependencyReport: - type: object - properties: - ref: - $ref: '#/components/schemas/PackageRef' - issues: - type: array - items: - $ref: '#/components/schemas/Issue' - highestVulnerability: - description: Highest vulnerability found for this dependency - $ref: '#/components/schemas/Issue' - Remediation: - type: object - properties: - fixedIn: - type: array - items: - type: string - trustedContent: - type: object - properties: - ref: - $ref: '#/components/schemas/PackageRef' - status: - type: string - justification: - type: string - CvssVector: - type: object - properties: - attackVector: - type: string - attackComplexity: - type: string - privilegesRequired: - type: string - userInteraction: - type: string - scope: - type: string - confidentialityImpact: - type: string - integrityImpact: - type: string - availabilityImpact: - type: string - exploitCodeMaturity: - type: string - remediationLevel: - type: string - reportConfidence: - type: string - cvss: - type: string - UnscannedDependency: - type: object - properties: - ref: - $ref: '#/components/schemas/PackageRef' - reason: - type: string diff --git a/src/test/java/com/redhat/exhort/ExhortTest.java b/src/test/java/io/github/guacsec/trustifyda/ExhortTest.java similarity index 95% rename from src/test/java/com/redhat/exhort/ExhortTest.java rename to src/test/java/io/github/guacsec/trustifyda/ExhortTest.java index b21a6957..4b41c569 100644 --- a/src/test/java/com/redhat/exhort/ExhortTest.java +++ b/src/test/java/io/github/guacsec/trustifyda/ExhortTest.java @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.redhat.exhort; +package io.github.guacsec.trustifyda; import java.io.File; import java.io.IOException; @@ -58,7 +58,7 @@ public static Path resolveFile(String path) { protected String getFileFromResource(String fileName, String path) { Path tmpFile; try { - var tmpDir = Files.createTempDirectory("exhort_test_"); + var tmpDir = Files.createTempDirectory("TRUSTIFY_DA_test_"); tmpFile = Files.createFile(tmpDir.resolve(fileName)); try (var is = getResourceAsStreamDecision(this.getClass(), path)) { if (Objects.nonNull(is)) { @@ -81,7 +81,7 @@ public static class TempDirFromResources { private final Path tmpDir; public TempDirFromResources() throws IOException { - tmpDir = Files.createTempDirectory("exhort_test_"); + tmpDir = Files.createTempDirectory("TRUSTIFY_DA_test_"); } public class AddPath { @@ -145,7 +145,7 @@ public Path getTempDir() { protected String getFileFromString(String fileName, String content) { Path tmpFile; try { - var tmpDir = Files.createTempDirectory("exhort_test_"); + var tmpDir = Files.createTempDirectory("TRUSTIFY_DA_test_"); tmpFile = Files.createFile(tmpDir.resolve(fileName)); Files.write(tmpFile, content.getBytes()); diff --git a/src/test/java/com/redhat/exhort/cli/AppTest.java b/src/test/java/io/github/guacsec/trustifyda/cli/AppTest.java similarity index 92% rename from src/test/java/com/redhat/exhort/cli/AppTest.java rename to src/test/java/io/github/guacsec/trustifyda/cli/AppTest.java index 889b49c4..27cbd4aa 100644 --- a/src/test/java/com/redhat/exhort/cli/AppTest.java +++ b/src/test/java/io/github/guacsec/trustifyda/cli/AppTest.java @@ -14,11 +14,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.redhat.exhort.cli; +package io.github.guacsec.trustifyda.cli; -import static com.redhat.exhort.cli.AppUtils.exitWithError; -import static com.redhat.exhort.cli.AppUtils.printException; -import static com.redhat.exhort.cli.AppUtils.printLine; +import static io.github.guacsec.trustifyda.cli.AppUtils.exitWithError; +import static io.github.guacsec.trustifyda.cli.AppUtils.printException; +import static io.github.guacsec.trustifyda.cli.AppUtils.printLine; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatThrownBy; import static org.mockito.ArgumentMatchers.any; @@ -28,14 +28,14 @@ import static org.mockito.Mockito.mockStatic; import static org.mockito.Mockito.when; -import com.redhat.exhort.ExhortTest; -import com.redhat.exhort.api.v4.AnalysisReport; -import com.redhat.exhort.api.v4.ProviderReport; -import com.redhat.exhort.api.v4.ProviderStatus; -import com.redhat.exhort.api.v4.Scanned; -import com.redhat.exhort.api.v4.Source; -import com.redhat.exhort.api.v4.SourceSummary; -import com.redhat.exhort.impl.ExhortApi; +import io.github.guacsec.trustifyda.ExhortTest; +import io.github.guacsec.trustifyda.api.v5.AnalysisReport; +import io.github.guacsec.trustifyda.api.v5.ProviderReport; +import io.github.guacsec.trustifyda.api.v5.ProviderStatus; +import io.github.guacsec.trustifyda.api.v5.Scanned; +import io.github.guacsec.trustifyda.api.v5.Source; +import io.github.guacsec.trustifyda.api.v5.SourceSummary; +import io.github.guacsec.trustifyda.impl.ExhortApi; import java.io.IOException; import java.lang.reflect.Method; import java.nio.file.Path; @@ -62,7 +62,7 @@ void main_with_no_args_should_print_help() { try (MockedStatic mockedAppUtils = mockStatic(AppUtils.class)) { App.main(new String[0]); - mockedAppUtils.verify(() -> printLine(contains("Exhort Java API CLI"))); + mockedAppUtils.verify(() -> printLine(contains("Dependency Analytics Java API CLI"))); } } @@ -72,11 +72,14 @@ void main_with_help_flag_should_print_help(String helpFlag) { try (MockedStatic mockedAppUtils = mockStatic(AppUtils.class)) { App.main(new String[] {helpFlag}); - mockedAppUtils.verify(() -> printLine(contains("Exhort Java API CLI"))); + mockedAppUtils.verify(() -> printLine(contains("Dependency Analytics Java API CLI"))); mockedAppUtils.verify(() -> printLine(contains("USAGE:"))); mockedAppUtils.verify( () -> - printLine(contains("java -jar exhort-java-api.jar [OPTIONS]"))); + printLine( + contains( + "java -jar trustify-da-java-client-cli.jar " + + " [OPTIONS]"))); } } @@ -85,7 +88,7 @@ void main_with_help_flag_after_other_args_should_print_help() { try (MockedStatic mockedAppUtils = mockStatic(AppUtils.class)) { App.main(new String[] {"stack", "--help"}); - mockedAppUtils.verify(() -> printLine(contains("Exhort Java API CLI"))); + mockedAppUtils.verify(() -> printLine(contains("Dependency Analytics Java API CLI"))); } } @@ -97,7 +100,10 @@ void help_should_contain_usage_section() { mockedAppUtils.verify(() -> printLine(contains("USAGE:"))); mockedAppUtils.verify( () -> - printLine(contains("java -jar exhort-java-api.jar [OPTIONS]"))); + printLine( + contains( + "java -jar trustify-da-java-client-cli.jar " + + " [OPTIONS]"))); } } @@ -159,19 +165,27 @@ void help_should_contain_examples_section() { mockedAppUtils.verify(() -> printLine(contains("EXAMPLES:"))); mockedAppUtils.verify( - () -> printLine(contains("java -jar exhort-java-api.jar stack /path/to/pom.xml"))); + () -> + printLine( + contains("java -jar trustify-da-java-client-cli.jar stack /path/to/pom.xml"))); mockedAppUtils.verify( () -> printLine( - contains("java -jar exhort-java-api.jar stack /path/to/package.json --summary"))); + contains( + "java -jar trustify-da-java-client-cli.jar stack /path/to/package.json" + + " --summary"))); mockedAppUtils.verify( () -> printLine( - contains("java -jar exhort-java-api.jar stack /path/to/build.gradle --html"))); + contains( + "java -jar trustify-da-java-client-cli.jar stack /path/to/build.gradle" + + " --html"))); mockedAppUtils.verify( () -> printLine( - contains("java -jar exhort-java-api.jar component /path/to/requirements.txt"))); + contains( + "java -jar trustify-da-java-client-cli.jar component" + + " /path/to/requirements.txt"))); } } @@ -203,7 +217,7 @@ void help_loads_from_external_file() { App.main(new String[] {"--help"}); // Verify that help content is printed (loaded from cli_help.txt) - mockedAppUtils.verify(() -> printLine(contains("Exhort Java API CLI"))); + mockedAppUtils.verify(() -> printLine(contains("Dependency Analytics Java API CLI"))); mockedAppUtils.verify(() -> printLine(contains("USAGE:"))); mockedAppUtils.verify(() -> printLine(contains("COMMANDS:"))); mockedAppUtils.verify(() -> printLine(contains("EXAMPLES:"))); diff --git a/src/test/java/com/redhat/exhort/image/ImageRefTest.java b/src/test/java/io/github/guacsec/trustifyda/image/ImageRefTest.java similarity index 96% rename from src/test/java/com/redhat/exhort/image/ImageRefTest.java rename to src/test/java/io/github/guacsec/trustifyda/image/ImageRefTest.java index e2af9e2c..d3edb8c8 100644 --- a/src/test/java/com/redhat/exhort/image/ImageRefTest.java +++ b/src/test/java/io/github/guacsec/trustifyda/image/ImageRefTest.java @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.redhat.exhort.image; +package io.github.guacsec.trustifyda.image; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.mockito.AdditionalMatchers.aryEq; @@ -24,8 +24,8 @@ import com.github.packageurl.MalformedPackageURLException; import com.github.packageurl.PackageURL; -import com.redhat.exhort.ExhortTest; -import com.redhat.exhort.tools.Operations; +import io.github.guacsec.trustifyda.ExhortTest; +import io.github.guacsec.trustifyda.tools.Operations; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; diff --git a/src/test/java/com/redhat/exhort/image/ImageTest.java b/src/test/java/io/github/guacsec/trustifyda/image/ImageTest.java similarity index 99% rename from src/test/java/com/redhat/exhort/image/ImageTest.java rename to src/test/java/io/github/guacsec/trustifyda/image/ImageTest.java index b9454ba4..b201b002 100644 --- a/src/test/java/com/redhat/exhort/image/ImageTest.java +++ b/src/test/java/io/github/guacsec/trustifyda/image/ImageTest.java @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.redhat.exhort.image; +package io.github.guacsec.trustifyda.image; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotEquals; diff --git a/src/test/java/com/redhat/exhort/image/ImageUtilsTest.java b/src/test/java/io/github/guacsec/trustifyda/image/ImageUtilsTest.java similarity index 87% rename from src/test/java/com/redhat/exhort/image/ImageUtilsTest.java rename to src/test/java/io/github/guacsec/trustifyda/image/ImageUtilsTest.java index 6ad99d76..2208deca 100644 --- a/src/test/java/com/redhat/exhort/image/ImageUtilsTest.java +++ b/src/test/java/io/github/guacsec/trustifyda/image/ImageUtilsTest.java @@ -14,16 +14,16 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.redhat.exhort.image; - -import static com.redhat.exhort.image.ImageUtils.EXHORT_IMAGE_ARCH; -import static com.redhat.exhort.image.ImageUtils.EXHORT_IMAGE_OS; -import static com.redhat.exhort.image.ImageUtils.EXHORT_IMAGE_PLATFORM; -import static com.redhat.exhort.image.ImageUtils.EXHORT_IMAGE_SERVICE_ENDPOINT; -import static com.redhat.exhort.image.ImageUtils.EXHORT_IMAGE_VARIANT; -import static com.redhat.exhort.image.ImageUtils.EXHORT_SKOPEO_CONFIG_PATH; -import static com.redhat.exhort.image.ImageUtils.EXHORT_SYFT_CONFIG_PATH; -import static com.redhat.exhort.image.ImageUtils.EXHORT_SYFT_IMAGE_SOURCE; +package io.github.guacsec.trustifyda.image; + +import static io.github.guacsec.trustifyda.image.ImageUtils.TRUSTIFY_DA_IMAGE_ARCH; +import static io.github.guacsec.trustifyda.image.ImageUtils.TRUSTIFY_DA_IMAGE_OS; +import static io.github.guacsec.trustifyda.image.ImageUtils.TRUSTIFY_DA_IMAGE_PLATFORM; +import static io.github.guacsec.trustifyda.image.ImageUtils.TRUSTIFY_DA_IMAGE_SERVICE_ENDPOINT; +import static io.github.guacsec.trustifyda.image.ImageUtils.TRUSTIFY_DA_IMAGE_VARIANT; +import static io.github.guacsec.trustifyda.image.ImageUtils.TRUSTIFY_DA_SKOPEO_CONFIG_PATH; +import static io.github.guacsec.trustifyda.image.ImageUtils.TRUSTIFY_DA_SYFT_CONFIG_PATH; +import static io.github.guacsec.trustifyda.image.ImageUtils.TRUSTIFY_DA_SYFT_IMAGE_SOURCE; import static org.assertj.core.api.Assertions.assertThat; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNull; @@ -39,9 +39,9 @@ import com.fasterxml.jackson.databind.node.ObjectNode; import com.fasterxml.jackson.databind.node.TextNode; import com.github.packageurl.MalformedPackageURLException; -import com.redhat.exhort.ExhortTest; -import com.redhat.exhort.tools.Operations; -import com.redhat.exhort.utils.Environment; +import io.github.guacsec.trustifyda.ExhortTest; +import io.github.guacsec.trustifyda.tools.Operations; +import io.github.guacsec.trustifyda.utils.Environment; import java.io.BufferedReader; import java.io.File; import java.io.IOException; @@ -134,11 +134,11 @@ void tearDown() { @Test @ClearSystemProperty(key = "PATH") - @ClearSystemProperty(key = "EXHORT_SYFT_PATH") - @ClearSystemProperty(key = EXHORT_SYFT_CONFIG_PATH) - @ClearSystemProperty(key = "EXHORT_DOCKER_PATH") - @ClearSystemProperty(key = "EXHORT_PODMAN_PATH") - @ClearSystemProperty(key = EXHORT_SYFT_IMAGE_SOURCE) + @ClearSystemProperty(key = "TRUSTIFY_DA_SYFT_PATH") + @ClearSystemProperty(key = TRUSTIFY_DA_SYFT_CONFIG_PATH) + @ClearSystemProperty(key = "TRUSTIFY_DA_DOCKER_PATH") + @ClearSystemProperty(key = "TRUSTIFY_DA_PODMAN_PATH") + @ClearSystemProperty(key = TRUSTIFY_DA_SYFT_IMAGE_SOURCE) void test_generate_image_sbom() throws IOException, MalformedPackageURLException { try (MockedStatic mock = Mockito.mockStatic(Operations.class); var is = getResourceAsStreamDecision(this.getClass(), "msc/image/image_sbom.json")) { @@ -181,9 +181,9 @@ void test_generate_image_sbom() throws IOException, MalformedPackageURLException } @Test - @ClearSystemProperty(key = "EXHORT_SKOPEO_PATH") - @ClearSystemProperty(key = EXHORT_SKOPEO_CONFIG_PATH) - @ClearSystemProperty(key = EXHORT_IMAGE_SERVICE_ENDPOINT) + @ClearSystemProperty(key = "TRUSTIFY_DA_SKOPEO_PATH") + @ClearSystemProperty(key = TRUSTIFY_DA_SKOPEO_CONFIG_PATH) + @ClearSystemProperty(key = TRUSTIFY_DA_IMAGE_SERVICE_ENDPOINT) void test_get_image_digests_single() throws IOException { try (MockedStatic mock = Mockito.mockStatic(Operations.class); var isRaw = @@ -247,9 +247,9 @@ void test_get_image_digests_single() throws IOException { } @Test - @ClearSystemProperty(key = "EXHORT_SKOPEO_PATH") - @ClearSystemProperty(key = EXHORT_SKOPEO_CONFIG_PATH) - @ClearSystemProperty(key = EXHORT_IMAGE_SERVICE_ENDPOINT) + @ClearSystemProperty(key = "TRUSTIFY_DA_SKOPEO_PATH") + @ClearSystemProperty(key = TRUSTIFY_DA_SKOPEO_CONFIG_PATH) + @ClearSystemProperty(key = TRUSTIFY_DA_IMAGE_SERVICE_ENDPOINT) void test_get_image_digests_multiple() throws IOException { try (MockedStatic mock = Mockito.mockStatic(Operations.class); var is = @@ -300,33 +300,33 @@ void test_get_image_digests_multiple() throws IOException { } @Test - @SetSystemProperty(key = EXHORT_IMAGE_PLATFORM, value = mockImagePlatform) - @SetSystemProperty(key = EXHORT_SYFT_IMAGE_SOURCE, value = mockSyftSource) - @SetSystemProperty(key = EXHORT_IMAGE_OS, value = mockOs) - @SetSystemProperty(key = EXHORT_IMAGE_ARCH, value = mockArch) - @SetSystemProperty(key = EXHORT_IMAGE_VARIANT, value = mockVariant) + @SetSystemProperty(key = TRUSTIFY_DA_IMAGE_PLATFORM, value = mockImagePlatform) + @SetSystemProperty(key = TRUSTIFY_DA_SYFT_IMAGE_SOURCE, value = mockSyftSource) + @SetSystemProperty(key = TRUSTIFY_DA_IMAGE_OS, value = mockOs) + @SetSystemProperty(key = TRUSTIFY_DA_IMAGE_ARCH, value = mockArch) + @SetSystemProperty(key = TRUSTIFY_DA_IMAGE_VARIANT, value = mockVariant) void test_get_image_platform() { var platform = ImageUtils.getImagePlatform(); assertEquals(new Platform(mockImagePlatform), platform); } @Test - @ClearSystemProperty(key = EXHORT_IMAGE_PLATFORM) - @SetSystemProperty(key = EXHORT_SYFT_IMAGE_SOURCE, value = mockSyftSource) - @SetSystemProperty(key = EXHORT_IMAGE_OS, value = mockOs) - @SetSystemProperty(key = EXHORT_IMAGE_ARCH, value = mockArch) - @SetSystemProperty(key = EXHORT_IMAGE_VARIANT, value = mockVariant) + @ClearSystemProperty(key = TRUSTIFY_DA_IMAGE_PLATFORM) + @SetSystemProperty(key = TRUSTIFY_DA_SYFT_IMAGE_SOURCE, value = mockSyftSource) + @SetSystemProperty(key = TRUSTIFY_DA_IMAGE_OS, value = mockOs) + @SetSystemProperty(key = TRUSTIFY_DA_IMAGE_ARCH, value = mockArch) + @SetSystemProperty(key = TRUSTIFY_DA_IMAGE_VARIANT, value = mockVariant) void test_get_image_platform_no_default() { var platform = ImageUtils.getImagePlatform(); assertEquals(new Platform(mockOs, mockArch, mockVariant), platform); } @Test - @ClearSystemProperty(key = EXHORT_IMAGE_PLATFORM) - @SetSystemProperty(key = EXHORT_SYFT_IMAGE_SOURCE, value = "podman") - @SetSystemProperty(key = EXHORT_IMAGE_OS, value = mockOs) - @SetSystemProperty(key = EXHORT_IMAGE_ARCH, value = mockArch) - @ClearSystemProperty(key = EXHORT_IMAGE_VARIANT) + @ClearSystemProperty(key = TRUSTIFY_DA_IMAGE_PLATFORM) + @SetSystemProperty(key = TRUSTIFY_DA_SYFT_IMAGE_SOURCE, value = "podman") + @SetSystemProperty(key = TRUSTIFY_DA_IMAGE_OS, value = mockOs) + @SetSystemProperty(key = TRUSTIFY_DA_IMAGE_ARCH, value = mockArch) + @ClearSystemProperty(key = TRUSTIFY_DA_IMAGE_VARIANT) void test_get_image_platform_no_default_no_variant() { try (MockedStatic mock = Mockito.mockStatic(Operations.class)) { mock.when(() -> Operations.getCustomPathOrElse(eq("podman"))).thenReturn("podman"); @@ -345,11 +345,11 @@ void test_get_image_platform_no_default_no_variant() { } @Test - @ClearSystemProperty(key = EXHORT_IMAGE_PLATFORM) - @SetSystemProperty(key = EXHORT_SYFT_IMAGE_SOURCE, value = "podman") - @ClearSystemProperty(key = EXHORT_IMAGE_OS) - @ClearSystemProperty(key = EXHORT_IMAGE_ARCH) - @ClearSystemProperty(key = EXHORT_IMAGE_VARIANT) + @ClearSystemProperty(key = TRUSTIFY_DA_IMAGE_PLATFORM) + @SetSystemProperty(key = TRUSTIFY_DA_SYFT_IMAGE_SOURCE, value = "podman") + @ClearSystemProperty(key = TRUSTIFY_DA_IMAGE_OS) + @ClearSystemProperty(key = TRUSTIFY_DA_IMAGE_ARCH) + @ClearSystemProperty(key = TRUSTIFY_DA_IMAGE_VARIANT) @ClearSystemProperty(key = "PATH") void test_get_image_platform_no_defaults() { try (MockedStatic mock = Mockito.mockStatic(Operations.class)) { @@ -370,8 +370,8 @@ void test_get_image_platform_no_defaults() { } @Test - @SetSystemProperty(key = EXHORT_SYFT_CONFIG_PATH, value = mockSyftConfig) - @SetSystemProperty(key = EXHORT_SYFT_IMAGE_SOURCE, value = mockSyftSource) + @SetSystemProperty(key = TRUSTIFY_DA_SYFT_CONFIG_PATH, value = mockSyftConfig) + @SetSystemProperty(key = TRUSTIFY_DA_SYFT_IMAGE_SOURCE, value = mockSyftSource) void test_exec_syft() { try (MockedStatic mockEnv = Mockito.mockStatic(Environment.class, Mockito.CALLS_REAL_METHODS)) { @@ -426,8 +426,8 @@ void test_exec_syft() { } @Test - @ClearSystemProperty(key = EXHORT_SYFT_CONFIG_PATH) - @ClearSystemProperty(key = EXHORT_SYFT_IMAGE_SOURCE) + @ClearSystemProperty(key = TRUSTIFY_DA_SYFT_CONFIG_PATH) + @ClearSystemProperty(key = TRUSTIFY_DA_SYFT_IMAGE_SOURCE) void test_exec_syft_no_config_no_source() { try (MockedStatic mockEnv = Mockito.mockStatic(Environment.class, Mockito.CALLS_REAL_METHODS)) { @@ -514,7 +514,7 @@ void test_update_PATH_env_no_PATH() { } @Test - @SetSystemProperty(key = "EXHORT_DOCKER_PATH", value = mockDockerPath) + @SetSystemProperty(key = "TRUSTIFY_DA_DOCKER_PATH", value = mockDockerPath) @SetSystemProperty(key = "PATH", value = mockPath) void test_host_info_docker() { try (MockedStatic mock = Mockito.mockStatic(Operations.class)) { @@ -535,7 +535,7 @@ void test_host_info_docker() { } @Test - @ClearSystemProperty(key = "EXHORT_DOCKER_PATH") + @ClearSystemProperty(key = "TRUSTIFY_DA_DOCKER_PATH") void test_host_info_no_docker_path() { try (MockedStatic mock = Mockito.mockStatic(Operations.class)) { var output = new Operations.ProcessExecOutput("", "test-error", 0); @@ -557,7 +557,7 @@ void test_host_info_no_docker_path() { } @Test - @SetSystemProperty(key = "EXHORT_DOCKER_PATH", value = mockDockerPath) + @SetSystemProperty(key = "TRUSTIFY_DA_DOCKER_PATH", value = mockDockerPath) @SetSystemProperty(key = "PATH", value = mockPath) void test_docker_get_os() { try (MockedStatic mock = Mockito.mockStatic(Operations.class)) { @@ -578,7 +578,7 @@ void test_docker_get_os() { } @ParameterizedTest(name = "{0}") - @SetSystemProperty(key = "EXHORT_DOCKER_PATH", value = mockDockerPath) + @SetSystemProperty(key = "TRUSTIFY_DA_DOCKER_PATH", value = mockDockerPath) @SetSystemProperty(key = "PATH", value = mockPath) @MethodSource("dockerArchSources") void test_docker_get_arch(String sysArch, String arch) { @@ -600,7 +600,7 @@ void test_docker_get_arch(String sysArch, String arch) { } @ParameterizedTest(name = "{0}") - @SetSystemProperty(key = "EXHORT_DOCKER_PATH", value = mockDockerPath) + @SetSystemProperty(key = "TRUSTIFY_DA_DOCKER_PATH", value = mockDockerPath) @SetSystemProperty(key = "PATH", value = mockPath) @MethodSource("dockerVariantSources") void test_docker_get_variant(String sysArch, String variant) { @@ -622,7 +622,7 @@ void test_docker_get_variant(String sysArch, String variant) { } @Test - @SetSystemProperty(key = "EXHORT_PODMAN_PATH", value = mockPodmanPath) + @SetSystemProperty(key = "TRUSTIFY_DA_PODMAN_PATH", value = mockPodmanPath) @SetSystemProperty(key = "PATH", value = mockPath) void test_host_info_podman() { try (MockedStatic mock = Mockito.mockStatic(Operations.class)) { @@ -643,7 +643,7 @@ void test_host_info_podman() { } @Test - @SetSystemProperty(key = "EXHORT_PODMAN_PATH", value = mockPodmanPath) + @SetSystemProperty(key = "TRUSTIFY_DA_PODMAN_PATH", value = mockPodmanPath) @SetSystemProperty(key = "PATH", value = mockPath) void test_podman_get_os() { try (MockedStatic mock = Mockito.mockStatic(Operations.class)) { @@ -664,7 +664,7 @@ void test_podman_get_os() { } @Test - @SetSystemProperty(key = "EXHORT_PODMAN_PATH", value = mockPodmanPath) + @SetSystemProperty(key = "TRUSTIFY_DA_PODMAN_PATH", value = mockPodmanPath) @SetSystemProperty(key = "PATH", value = mockPath) void test_podman_get_arch() { try (MockedStatic mock = Mockito.mockStatic(Operations.class)) { @@ -685,7 +685,7 @@ void test_podman_get_arch() { } @Test - @SetSystemProperty(key = "EXHORT_PODMAN_PATH", value = mockPodmanPath) + @SetSystemProperty(key = "TRUSTIFY_DA_PODMAN_PATH", value = mockPodmanPath) @SetSystemProperty(key = "PATH", value = mockPath) void test_podman_get_variant() { try (MockedStatic mock = Mockito.mockStatic(Operations.class)) { @@ -715,9 +715,9 @@ void test_docker_podman_info() { } @Test - @SetSystemProperty(key = "EXHORT_SKOPEO_PATH", value = mockSkopeoPath) - @SetSystemProperty(key = EXHORT_SKOPEO_CONFIG_PATH, value = mockSkopeoConfig) - @SetSystemProperty(key = EXHORT_IMAGE_SERVICE_ENDPOINT, value = mockSkopeoDaemon) + @SetSystemProperty(key = "TRUSTIFY_DA_SKOPEO_PATH", value = mockSkopeoPath) + @SetSystemProperty(key = TRUSTIFY_DA_SKOPEO_CONFIG_PATH, value = mockSkopeoConfig) + @SetSystemProperty(key = TRUSTIFY_DA_IMAGE_SERVICE_ENDPOINT, value = mockSkopeoDaemon) void test_exec_skopeo_inspect_raw() { try (MockedStatic mock = Mockito.mockStatic(Operations.class)) { var output = new Operations.ProcessExecOutput("test-output", "test-error", 0); @@ -749,9 +749,9 @@ void test_exec_skopeo_inspect_raw() { } @Test - @SetSystemProperty(key = "EXHORT_SKOPEO_PATH", value = mockSkopeoPath) - @ClearSystemProperty(key = EXHORT_SKOPEO_CONFIG_PATH) - @SetSystemProperty(key = EXHORT_IMAGE_SERVICE_ENDPOINT, value = mockSkopeoDaemon) + @SetSystemProperty(key = "TRUSTIFY_DA_SKOPEO_PATH", value = mockSkopeoPath) + @ClearSystemProperty(key = TRUSTIFY_DA_SKOPEO_CONFIG_PATH) + @SetSystemProperty(key = TRUSTIFY_DA_IMAGE_SERVICE_ENDPOINT, value = mockSkopeoDaemon) void test_exec_skopeo_inspect_raw_no_config() { try (MockedStatic mock = Mockito.mockStatic(Operations.class)) { var output = new Operations.ProcessExecOutput("test-output", "test-error", 0); @@ -781,9 +781,9 @@ void test_exec_skopeo_inspect_raw_no_config() { } @Test - @ClearSystemProperty(key = "EXHORT_SKOPEO_PATH") - @SetSystemProperty(key = EXHORT_SKOPEO_CONFIG_PATH, value = mockSkopeoConfig) - @ClearSystemProperty(key = EXHORT_IMAGE_SERVICE_ENDPOINT) + @ClearSystemProperty(key = "TRUSTIFY_DA_SKOPEO_PATH") + @SetSystemProperty(key = TRUSTIFY_DA_SKOPEO_CONFIG_PATH, value = mockSkopeoConfig) + @ClearSystemProperty(key = TRUSTIFY_DA_IMAGE_SERVICE_ENDPOINT) void test_exec_skopeo_inspect_raw_no_daemon() { try (MockedStatic mock = Mockito.mockStatic(Operations.class)) { var output = new Operations.ProcessExecOutput("test-output", "test-error", 0); @@ -813,9 +813,9 @@ void test_exec_skopeo_inspect_raw_no_daemon() { } @Test - @ClearSystemProperty(key = "EXHORT_SKOPEO_PATH") - @ClearSystemProperty(key = EXHORT_SKOPEO_CONFIG_PATH) - @ClearSystemProperty(key = EXHORT_IMAGE_SERVICE_ENDPOINT) + @ClearSystemProperty(key = "TRUSTIFY_DA_SKOPEO_PATH") + @ClearSystemProperty(key = TRUSTIFY_DA_SKOPEO_CONFIG_PATH) + @ClearSystemProperty(key = TRUSTIFY_DA_IMAGE_SERVICE_ENDPOINT) void test_exec_skopeo_inspect_raw_no_config_no_daemon() { try (MockedStatic mock = Mockito.mockStatic(Operations.class)) { var output = new Operations.ProcessExecOutput("test-output", "test-error", 0); @@ -843,9 +843,9 @@ void test_exec_skopeo_inspect_raw_no_config_no_daemon() { } @Test - @SetSystemProperty(key = "EXHORT_SKOPEO_PATH", value = mockSkopeoPath) - @SetSystemProperty(key = EXHORT_SKOPEO_CONFIG_PATH, value = mockSkopeoConfig) - @SetSystemProperty(key = EXHORT_IMAGE_SERVICE_ENDPOINT, value = mockSkopeoDaemon) + @SetSystemProperty(key = "TRUSTIFY_DA_SKOPEO_PATH", value = mockSkopeoPath) + @SetSystemProperty(key = TRUSTIFY_DA_SKOPEO_CONFIG_PATH, value = mockSkopeoConfig) + @SetSystemProperty(key = TRUSTIFY_DA_IMAGE_SERVICE_ENDPOINT, value = mockSkopeoDaemon) void test_exec_skopeo_inspect() { try (MockedStatic mock = Mockito.mockStatic(Operations.class)) { var output = new Operations.ProcessExecOutput("test-output", "test-error", 0); @@ -877,9 +877,9 @@ void test_exec_skopeo_inspect() { } @Test - @SetSystemProperty(key = "EXHORT_SKOPEO_PATH", value = mockSkopeoPath) - @ClearSystemProperty(key = EXHORT_SKOPEO_CONFIG_PATH) - @SetSystemProperty(key = EXHORT_IMAGE_SERVICE_ENDPOINT, value = mockSkopeoDaemon) + @SetSystemProperty(key = "TRUSTIFY_DA_SKOPEO_PATH", value = mockSkopeoPath) + @ClearSystemProperty(key = TRUSTIFY_DA_SKOPEO_CONFIG_PATH) + @SetSystemProperty(key = TRUSTIFY_DA_IMAGE_SERVICE_ENDPOINT, value = mockSkopeoDaemon) void test_exec_skopeo_inspect_no_config() { try (MockedStatic mock = Mockito.mockStatic(Operations.class)) { var output = new Operations.ProcessExecOutput("test-output", "test-error", 0); @@ -909,9 +909,9 @@ void test_exec_skopeo_inspect_no_config() { } @Test - @ClearSystemProperty(key = "EXHORT_SKOPEO_PATH") - @SetSystemProperty(key = EXHORT_SKOPEO_CONFIG_PATH, value = mockSkopeoConfig) - @ClearSystemProperty(key = EXHORT_IMAGE_SERVICE_ENDPOINT) + @ClearSystemProperty(key = "TRUSTIFY_DA_SKOPEO_PATH") + @SetSystemProperty(key = TRUSTIFY_DA_SKOPEO_CONFIG_PATH, value = mockSkopeoConfig) + @ClearSystemProperty(key = TRUSTIFY_DA_IMAGE_SERVICE_ENDPOINT) void test_exec_skopeo_inspect_no_daemon() { try (MockedStatic mock = Mockito.mockStatic(Operations.class)) { var output = new Operations.ProcessExecOutput("test-output", "test-error", 0); @@ -941,9 +941,9 @@ void test_exec_skopeo_inspect_no_daemon() { } @Test - @ClearSystemProperty(key = "EXHORT_SKOPEO_PATH") - @ClearSystemProperty(key = EXHORT_SKOPEO_CONFIG_PATH) - @ClearSystemProperty(key = EXHORT_IMAGE_SERVICE_ENDPOINT) + @ClearSystemProperty(key = "TRUSTIFY_DA_SKOPEO_PATH") + @ClearSystemProperty(key = TRUSTIFY_DA_SKOPEO_CONFIG_PATH) + @ClearSystemProperty(key = TRUSTIFY_DA_IMAGE_SERVICE_ENDPOINT) void test_exec_skopeo_inspect_no_config_no_daemon() { try (MockedStatic mock = Mockito.mockStatic(Operations.class)) { var output = new Operations.ProcessExecOutput("test-output", "test-error", 0); diff --git a/src/test/java/com/redhat/exhort/image/PlatformTest.java b/src/test/java/io/github/guacsec/trustifyda/image/PlatformTest.java similarity index 99% rename from src/test/java/com/redhat/exhort/image/PlatformTest.java rename to src/test/java/io/github/guacsec/trustifyda/image/PlatformTest.java index 2de69807..b491bcae 100644 --- a/src/test/java/com/redhat/exhort/image/PlatformTest.java +++ b/src/test/java/io/github/guacsec/trustifyda/image/PlatformTest.java @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.redhat.exhort.image; +package io.github.guacsec.trustifyda.image; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertThrows; diff --git a/src/test/java/com/redhat/exhort/impl/ExhortApiIT.java b/src/test/java/io/github/guacsec/trustifyda/impl/ExhortApiIT.java similarity index 90% rename from src/test/java/com/redhat/exhort/impl/ExhortApiIT.java rename to src/test/java/io/github/guacsec/trustifyda/impl/ExhortApiIT.java index c79be200..fa7dfe10 100644 --- a/src/test/java/com/redhat/exhort/impl/ExhortApiIT.java +++ b/src/test/java/io/github/guacsec/trustifyda/impl/ExhortApiIT.java @@ -14,12 +14,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.redhat.exhort.impl; +package io.github.guacsec.trustifyda.impl; -import static com.redhat.exhort.Provider.PROP_MATCH_MANIFEST_VERSIONS; -import static com.redhat.exhort.image.ImageUtils.SKIP_VALIDATION_KEY; -import static com.redhat.exhort.utils.PythonControllerBase.PROP_EXHORT_PYTHON_INSTALL_BEST_EFFORTS; -import static com.redhat.exhort.utils.PythonControllerBase.PROP_EXHORT_PYTHON_VIRTUAL_ENV; +import static io.github.guacsec.trustifyda.Provider.PROP_MATCH_MANIFEST_VERSIONS; +import static io.github.guacsec.trustifyda.image.ImageUtils.SKIP_VALIDATION_KEY; +import static io.github.guacsec.trustifyda.utils.PythonControllerBase.PROP_TRUSTIFY_DA_PYTHON_INSTALL_BEST_EFFORTS; +import static io.github.guacsec.trustifyda.utils.PythonControllerBase.PROP_TRUSTIFY_DA_PYTHON_VIRTUAL_ENV; import static org.assertj.core.api.Assertions.assertThat; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertTrue; @@ -30,17 +30,17 @@ import static org.mockito.ArgumentMatchers.isNull; import static org.mockito.Mockito.mockStatic; -import com.redhat.exhort.Api; -import com.redhat.exhort.ExhortTest; -import com.redhat.exhort.api.v4.AnalysisReport; -import com.redhat.exhort.api.v4.ProviderReport; -import com.redhat.exhort.image.ImageRef; -import com.redhat.exhort.providers.HelperExtension; -import com.redhat.exhort.providers.JavaScriptNpmProvider; -import com.redhat.exhort.providers.JavaScriptPnpmProvider; -import com.redhat.exhort.providers.JavaScriptYarnProvider; -import com.redhat.exhort.tools.Ecosystem; -import com.redhat.exhort.tools.Operations; +import io.github.guacsec.trustifyda.Api; +import io.github.guacsec.trustifyda.ExhortTest; +import io.github.guacsec.trustifyda.api.v5.AnalysisReport; +import io.github.guacsec.trustifyda.api.v5.ProviderReport; +import io.github.guacsec.trustifyda.image.ImageRef; +import io.github.guacsec.trustifyda.providers.HelperExtension; +import io.github.guacsec.trustifyda.providers.JavaScriptNpmProvider; +import io.github.guacsec.trustifyda.providers.JavaScriptPnpmProvider; +import io.github.guacsec.trustifyda.providers.JavaScriptYarnProvider; +import io.github.guacsec.trustifyda.tools.Ecosystem; +import io.github.guacsec.trustifyda.tools.Operations; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; @@ -61,6 +61,7 @@ import java.util.function.Function; import java.util.stream.Collectors; import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Tag; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; @@ -78,9 +79,12 @@ @Tag("IntegrationTest") @ExtendWith(HelperExtension.class) @ExtendWith(MockitoExtension.class) -@SetSystemProperty(key = "RHDA_SOURCE", value = "exhort-java-api-it") -@SetSystemProperty(key = "EXHORT_DEV_MODE", value = "false") +@SetSystemProperty(key = "TRUST_DA_SOURCE", value = "trustify-da-java-client-it") +@SetSystemProperty(key = "TRUSTIFY_DA_DEV_MODE", value = "false") @RestoreSystemProperties +// TODO: Re-enable this integration test when https://issues.redhat.com/browse/TC-3192 is resolved +// The test is currently disabled due to backend service changes that prevent successful connections +@Disabled("Backend service unavailable - see https://issues.redhat.com/browse/TC-3192") class ExhortApiIT extends ExhortTest { private static Api api; @@ -318,8 +322,8 @@ private static T testImageAnalysis(Function, T> imageAnalysisF private static void preparePythonEnvironment(Ecosystem.Type packageManager) { if (packageManager.equals(Ecosystem.Type.PYTHON)) { - System.setProperty(PROP_EXHORT_PYTHON_VIRTUAL_ENV, "true"); - System.setProperty(PROP_EXHORT_PYTHON_INSTALL_BEST_EFFORTS, "true"); + System.setProperty(PROP_TRUSTIFY_DA_PYTHON_VIRTUAL_ENV, "true"); + System.setProperty(PROP_TRUSTIFY_DA_PYTHON_INSTALL_BEST_EFFORTS, "true"); System.setProperty(PROP_MATCH_MANIFEST_VERSIONS, "false"); } } diff --git a/src/test/java/com/redhat/exhort/impl/Exhort_Api_Test.java b/src/test/java/io/github/guacsec/trustifyda/impl/Exhort_Api_Test.java similarity index 82% rename from src/test/java/com/redhat/exhort/impl/Exhort_Api_Test.java rename to src/test/java/io/github/guacsec/trustifyda/impl/Exhort_Api_Test.java index ced2a908..0c8eba4e 100644 --- a/src/test/java/com/redhat/exhort/impl/Exhort_Api_Test.java +++ b/src/test/java/io/github/guacsec/trustifyda/impl/Exhort_Api_Test.java @@ -14,9 +14,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.redhat.exhort.impl; +package io.github.guacsec.trustifyda.impl; -import static com.redhat.exhort.image.ImageUtils.SKIP_VALIDATION_KEY; +import static io.github.guacsec.trustifyda.image.ImageUtils.SKIP_VALIDATION_KEY; import static org.assertj.core.api.BDDAssertions.then; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotNull; @@ -39,13 +39,13 @@ import com.fasterxml.jackson.databind.node.TextNode; import com.github.packageurl.MalformedPackageURLException; import com.github.packageurl.PackageURL; -import com.redhat.exhort.Api; -import com.redhat.exhort.ExhortTest; -import com.redhat.exhort.Provider; -import com.redhat.exhort.api.v4.AnalysisReport; -import com.redhat.exhort.image.ImageRef; -import com.redhat.exhort.tools.Ecosystem; -import com.redhat.exhort.tools.Operations; +import io.github.guacsec.trustifyda.Api; +import io.github.guacsec.trustifyda.ExhortTest; +import io.github.guacsec.trustifyda.Provider; +import io.github.guacsec.trustifyda.api.v5.AnalysisReport; +import io.github.guacsec.trustifyda.image.ImageRef; +import io.github.guacsec.trustifyda.tools.Ecosystem; +import io.github.guacsec.trustifyda.tools.Operations; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; @@ -66,7 +66,6 @@ import java.util.function.Function; import java.util.function.Supplier; import java.util.stream.Collectors; -import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.junitpioneer.jupiter.ClearSystemProperty; @@ -80,34 +79,28 @@ import org.mockito.junit.jupiter.MockitoExtension; @ExtendWith(MockitoExtension.class) -@ClearSystemProperty(key = "EXHORT_SNYK_TOKEN") -@ClearSystemProperty(key = "EXHORT_DEV_MODE") -@ClearSystemProperty(key = "EXHORT_PROXY_URL") -@ClearSystemProperty(key = "DEV_EXHORT_BACKEND_URL") -@ClearSystemProperty(key = "RHDA_TOKEN") -@ClearSystemProperty(key = "RHDA_SOURCE") +@ClearSystemProperty(key = "TRUSTIFY_DA_DEV_MODE") +@ClearSystemProperty(key = "TRUSTIFY_DA_PROXY_URL") +@ClearSystemProperty(key = "DEV_TRUSTIFY_DA_BACKEND_URL") +@ClearSystemProperty(key = "TRUST_DA_TOKEN") +@ClearSystemProperty(key = "TRUST_DA_SOURCE") @SuppressWarnings("unchecked") class Exhort_Api_Test extends ExhortTest { + public static final String S_API_V_5_BATCH_ANALYSIS = "%s/api/v5/batch-analysis"; @Mock Provider mockProvider; @Mock HttpClient mockHttpClient; @InjectMocks ExhortApi exhortApiSut; - @AfterEach - void cleanup() { - System.clearProperty("EXHORT_SNYK_TOKEN"); - } - @Test - @SetSystemProperty(key = "EXHORT_SNYK_TOKEN", value = "snyk-token-from-env-var") - @SetSystemProperty(key = "RHDA_TOKEN", value = "rhda-token-from-env-var") - @SetSystemProperty(key = "RHDA_SOURCE", value = "rhda-source-from-env-var") + @SetSystemProperty(key = "TRUST_DA_TOKEN", value = "trust-da-token-from-env-var") + @SetSystemProperty(key = "TRUST_DA_SOURCE", value = "trust-da-source-from-env-var") void stackAnalysisHtml_with_pom_xml_should_return_html_report_from_the_backend() throws IOException, ExecutionException, InterruptedException { // create a temporary pom.xml file - var tmpFile = Files.createTempFile("exhort_test_pom_", ".xml"); + var tmpFile = Files.createTempFile("TRUSTIFY_DA_test_pom_", ".xml"); try (var is = getResourceAsStreamDecision(this.getClass(), "tst_manifests/maven/empty/pom.xml")) { Files.write(tmpFile, is.readAllBytes()); @@ -122,12 +115,15 @@ void stackAnalysisHtml_with_pom_xml_should_return_html_report_from_the_backend() r -> r.headers().firstValue("Content-Type").get().equals("fake-content-type") && r.headers().firstValue("Accept").get().equals("text/html") - && - // snyk token is set using the environment variable (annotation) - r.headers().firstValue("ex-snyk-token").get().equals("snyk-token-from-env-var") - && r.headers().firstValue("rhda-token").get().equals("rhda-token-from-env-var") - && r.headers().firstValue("rhda-source").get().equals("rhda-source-from-env-var") - && r.headers().firstValue("rhda-operation-type").get().equals("Stack Analysis") + && r.headers() + .firstValue("trust-da-token") + .get() + .equals("trust-da-token-from-env-var") + && r.headers() + .firstValue("trust-da-source") + .get() + .equals("trust-da-source-from-env-var") + && r.headers().firstValue("trust-da-operation-type").get().equals("Stack Analysis") && r.method().equals("POST"); // load dummy html and set as the expected analysis @@ -162,13 +158,12 @@ void stackAnalysisHtml_with_pom_xml_should_return_html_report_from_the_backend() } @Test - @SetSystemProperty(key = "EXHORT_SNYK_TOKEN", value = "snyk-token") - @SetSystemProperty(key = "RHDA_TOKEN", value = "rhda-token") - @SetSystemProperty(key = "RHDA_SOURCE", value = "rhda-source") + @SetSystemProperty(key = "TRUST_DA_TOKEN", value = "trust-da-token") + @SetSystemProperty(key = "TRUST_DA_SOURCE", value = "trust-da-source") void stackAnalysis_with_pom_xml_should_return_json_object_from_the_backend() throws IOException, ExecutionException, InterruptedException { // create a temporary pom.xml file - var tmpFile = Files.createTempFile("exhort_test_pom_", ".xml"); + var tmpFile = Files.createTempFile("TRUSTIFY_DA_test_pom_", ".xml"); try (var is = getResourceAsStreamDecision(this.getClass(), "tst_manifests/maven/empty/pom.xml")) { Files.write(tmpFile, is.readAllBytes()); @@ -183,10 +178,9 @@ void stackAnalysis_with_pom_xml_should_return_json_object_from_the_backend() r -> r.headers().firstValue("Content-Type").get().equals("fake-content-type") && r.headers().firstValue("Accept").get().equals("application/json") - && r.headers().firstValue("ex-snyk-token").get().equals("snyk-token") - && r.headers().firstValue("rhda-token").get().equals("rhda-token") - && r.headers().firstValue("rhda-source").get().equals("rhda-source") - && r.headers().firstValue("rhda-operation-type").get().equals("Stack Analysis") + && r.headers().firstValue("trust-da-token").get().equals("trust-da-token") + && r.headers().firstValue("trust-da-source").get().equals("trust-da-source") + && r.headers().firstValue("trust-da-operation-type").get().equals("Stack Analysis") && r.method().equals("POST"); // load dummy json and set as the expected analysis @@ -238,22 +232,26 @@ void componentAnalysis_with_pom_xml_should_return_json_object_from_the_backend() .willReturn(new Provider.Content("fake-body-content".getBytes(), "fake-content-type")); // we expect this to picked up because no env var to take precedence - System.setProperty("EXHORT_SNYK_TOKEN", "snyk-token-from-property"); - System.setProperty("RHDA_TOKEN", "rhda-token-from-property"); - System.setProperty("RHDA_SOURCE", "rhda-source-from-property"); + System.setProperty("TRUST_DA_TOKEN", "trust-da-token-from-property"); + System.setProperty("TRUST_DA_SOURCE", "trust-da-source-from-property"); // create an argument matcher to make sure we mock the response for the right request ArgumentMatcher matchesRequest = r -> r.headers().firstValue("Content-Type").get().equals("fake-content-type") && r.headers().firstValue("Accept").get().equals("application/json") - && - // snyk token is set using properties which is picked up because no env var - // specified - r.headers().firstValue("ex-snyk-token").get().equals("snyk-token-from-property") - && r.headers().firstValue("rhda-token").get().equals("rhda-token-from-property") - && r.headers().firstValue("rhda-source").get().equals("rhda-source-from-property") - && r.headers().firstValue("rhda-operation-type").get().equals("Component Analysis") + && r.headers() + .firstValue("trust-da-token") + .get() + .equals("trust-da-token-from-property") + && r.headers() + .firstValue("trust-da-source") + .get() + .equals("trust-da-source-from-property") + && r.headers() + .firstValue("trust-da-operation-type") + .get() + .equals("Component Analysis") && r.method().equals("POST"); // load dummy json and set as the expected analysis @@ -308,7 +306,7 @@ void componentAnalysis_with_pom_xml_should_return_json_object_from_the_backend() } // create a temporary pom.xml file - var tmpFile = Files.createTempFile("exhort_test_pom_", ".xml"); + var tmpFile = Files.createTempFile("TRUSTIFY_DA_test_pom_", ".xml"); try (var is = getResourceAsStreamDecision(this.getClass(), "tst_manifests/maven/empty/pom.xml")) { Files.write(tmpFile, is.readAllBytes()); @@ -362,7 +360,7 @@ void componentAnalysis_with_pom_xml_should_return_json_object_from_the_backend() void componentAnalysis_with_pom_xml_as_path_should_return_json_object_from_the_backend() throws IOException, ExecutionException, InterruptedException { // load pom.xml - var tmpFile = Files.createTempFile("exhort_test_pom_", ".xml"); + var tmpFile = Files.createTempFile("TRUSTIFY_DA_test_pom_", ".xml"); try (var is = getResourceAsStreamDecision(this.getClass(), "tst_manifests/maven/empty/pom.xml")) { Files.write(tmpFile, is.readAllBytes()); @@ -373,17 +371,12 @@ void componentAnalysis_with_pom_xml_as_path_should_return_json_object_from_the_b .willReturn(new Provider.Content("fake-body-content".getBytes(), "fake-content-type")); // we expect this to picked up because no env var to take precedence - System.setProperty("EXHORT_SNYK_TOKEN", "snyk-token-from-property"); // create an argument matcher to make sure we mock the response for the right request ArgumentMatcher matchesRequest = r -> r.headers().firstValue("Content-Type").get().equals("fake-content-type") && r.headers().firstValue("Accept").get().equals("application/json") - && - // snyk token is set using properties which is picked up because no env var - // specified - r.headers().firstValue("ex-snyk-token").get().equals("snyk-token-from-property") && r.method().equals("POST"); // load dummy json and set as the expected analysis @@ -419,47 +412,46 @@ void componentAnalysis_with_pom_xml_as_path_should_return_json_object_from_the_b } @Test - @SetSystemProperty(key = "EXHORT_DEV_MODE", value = "true") - @ClearSystemProperty(key = "DEV_EXHORT_BACKEND_URL") + @SetSystemProperty(key = "TRUSTIFY_DA_DEV_MODE", value = "true") + @ClearSystemProperty(key = "DEV_TRUSTIFY_DA_BACKEND_URL") @RestoreSystemProperties - void check_Exhort_Url_When_DEV_Mode_true_And_DEV_Exhort_Url_Set() { + void check_TRUSTIFY_DA_Url_When_DEV_Mode_true_And_DEV_TRUSTIFY_DA_Url_Set() { String dummyUrl = "http://dummy-url"; - System.setProperty("DEV_EXHORT_BACKEND_URL", dummyUrl); + System.setProperty("DEV_TRUSTIFY_DA_BACKEND_URL", dummyUrl); ExhortApi exhortApi = new ExhortApi(); then(exhortApi.getEndpoint()).isEqualTo(dummyUrl); } @Test - @SetSystemProperty(key = "EXHORT_DEV_MODE", value = "false") - void check_Exhort_Url_When_DEV_Mode_false_And_DEV_Exhort_Url_Set() { + @SetSystemProperty(key = "TRUSTIFY_DA_DEV_MODE", value = "false") + void check_TRUSTIFY_DA_Url_When_DEV_Mode_false_And_DEV_TRUSTIFY_DA_Url_Set() { ExhortApi exhortApi = new ExhortApi(); then(exhortApi.getEndpoint()).isEqualTo(ExhortApi.DEFAULT_ENDPOINT); } @Test - @SetSystemProperty(key = "EXHORT_DEV_MODE", value = "true") - void check_Exhort_Url_When_DEV_Mode_true_Dev_Exhort_URL_Selected() { + @SetSystemProperty(key = "TRUSTIFY_DA_DEV_MODE", value = "true") + void check_TRUSTIFY_DA_Url_When_DEV_Mode_true_Dev_TRUSTIFY_DA_URL_Selected() { ExhortApi exhortApi = new ExhortApi(); then(exhortApi.getEndpoint()).isEqualTo(ExhortApi.DEFAULT_ENDPOINT_DEV); } @Test - @SetSystemProperty(key = "EXHORT_DEV_MODE", value = "false") - void check_Exhort_Url_When_DEV_Mode_not_set_Then_Default_Exhort_URL_Selected() { + @SetSystemProperty(key = "TRUSTIFY_DA_DEV_MODE", value = "false") + void check_TRUSTIFY_DA_Url_When_DEV_Mode_not_set_Then_Default_TRUSTIFY_DA_URL_Selected() { ExhortApi exhortApi = new ExhortApi(); then(exhortApi.getEndpoint()).isEqualTo(ExhortApi.DEFAULT_ENDPOINT); } @Test - void check_Exhort_Url_When_Nothing_Set_Then_Default_Exhort_URL_Selected() { + void check_TRUSTIFY_DA_Url_When_Nothing_Set_Then_Default_TRUSTIFY_DA_URL_Selected() { ExhortApi exhortApi = new ExhortApi(); then(exhortApi.getEndpoint()).isEqualTo(ExhortApi.DEFAULT_ENDPOINT); } @Test - @SetSystemProperty(key = "EXHORT_SNYK_TOKEN", value = "snyk-token-from-env-var") - @SetSystemProperty(key = "RHDA_TOKEN", value = "rhda-token-from-env-var") - @SetSystemProperty(key = "RHDA_SOURCE", value = "rhda-source-from-env-var") + @SetSystemProperty(key = "TRUST_DA_TOKEN", value = "trust-da-token-from-env-var") + @SetSystemProperty(key = "TRUST_DA_SOURCE", value = "trust-da-source-from-env-var") @SetSystemProperty(key = SKIP_VALIDATION_KEY, value = "true") void test_image_analysis() throws IOException, ExecutionException, InterruptedException, MalformedPackageURLException { @@ -514,17 +506,24 @@ void test_image_analysis() r.uri() .equals( URI.create( - String.format( - "%s/api/v4/batch-analysis", exhortApiSut.getEndpoint()))) + String.format(S_API_V_5_BATCH_ANALYSIS, exhortApiSut.getEndpoint()))) && r.headers().firstValue("Content-Type").get().equals(Api.CYCLONEDX_MEDIA_TYPE) && r.headers() .firstValue("Accept") .get() .equals(Api.MediaType.APPLICATION_JSON.toString()) - && r.headers().firstValue("ex-snyk-token").get().equals("snyk-token-from-env-var") - && r.headers().firstValue("rhda-token").get().equals("rhda-token-from-env-var") - && r.headers().firstValue("rhda-source").get().equals("rhda-source-from-env-var") - && r.headers().firstValue("rhda-operation-type").get().equals("Image Analysis") + && r.headers() + .firstValue("trust-da-token") + .get() + .equals("trust-da-token-from-env-var") + && r.headers() + .firstValue("trust-da-source") + .get() + .equals("trust-da-source-from-env-var") + && r.headers() + .firstValue("trust-da-operation-type") + .get() + .equals("Image Analysis") && r.method().equals("POST"); when(mockHttpClient.sendAsync(argThat(matchesRequest), any())) @@ -557,9 +556,8 @@ void test_image_analysis() } @Test - @SetSystemProperty(key = "EXHORT_SNYK_TOKEN", value = "snyk-token-from-env-var") - @SetSystemProperty(key = "RHDA_TOKEN", value = "rhda-token-from-env-var") - @SetSystemProperty(key = "RHDA_SOURCE", value = "rhda-source-from-env-var") + @SetSystemProperty(key = "TRUST_DA_TOKEN", value = "trust-da-token-from-env-var") + @SetSystemProperty(key = "TRUST_DA_SOURCE", value = "trust-da-source-from-env-var") @SetSystemProperty(key = SKIP_VALIDATION_KEY, value = "true") void imageAnalysisHtml() throws IOException, ExecutionException, InterruptedException { try (MockedStatic mock = Mockito.mockStatic(Operations.class); @@ -613,17 +611,24 @@ void imageAnalysisHtml() throws IOException, ExecutionException, InterruptedExce r.uri() .equals( URI.create( - String.format( - "%s/api/v4/batch-analysis", exhortApiSut.getEndpoint()))) + String.format(S_API_V_5_BATCH_ANALYSIS, exhortApiSut.getEndpoint()))) && r.headers().firstValue("Content-Type").get().equals(Api.CYCLONEDX_MEDIA_TYPE) && r.headers() .firstValue("Accept") .get() .equals(Api.MediaType.TEXT_HTML.toString()) - && r.headers().firstValue("ex-snyk-token").get().equals("snyk-token-from-env-var") - && r.headers().firstValue("rhda-token").get().equals("rhda-token-from-env-var") - && r.headers().firstValue("rhda-source").get().equals("rhda-source-from-env-var") - && r.headers().firstValue("rhda-operation-type").get().equals("Image Analysis") + && r.headers() + .firstValue("trust-da-token") + .get() + .equals("trust-da-token-from-env-var") + && r.headers() + .firstValue("trust-da-source") + .get() + .equals("trust-da-source-from-env-var") + && r.headers() + .firstValue("trust-da-operation-type") + .get() + .equals("Image Analysis") && r.method().equals("POST"); when(mockHttpClient.sendAsync(argThat(matchesRequest), any())) @@ -635,9 +640,8 @@ void imageAnalysisHtml() throws IOException, ExecutionException, InterruptedExce } @Test - @SetSystemProperty(key = "EXHORT_SNYK_TOKEN", value = "snyk-token-from-env-var") - @SetSystemProperty(key = "RHDA_TOKEN", value = "rhda-token-from-env-var") - @SetSystemProperty(key = "RHDA_SOURCE", value = "rhda-source-from-env-var") + @SetSystemProperty(key = "TRUST_DA_TOKEN", value = "trust-da-token-from-env-var") + @SetSystemProperty(key = "TRUST_DA_SOURCE", value = "trust-da-source-from-env-var") void test_perform_batch_analysis() throws IOException, MalformedPackageURLException, ExecutionException, InterruptedException { try (var is = getResourceAsStreamDecision(this.getClass(), "msc/image/image_sbom.json")) { @@ -651,17 +655,24 @@ void test_perform_batch_analysis() r.uri() .equals( URI.create( - String.format( - "%s/api/v4/batch-analysis", exhortApiSut.getEndpoint()))) + String.format(S_API_V_5_BATCH_ANALYSIS, exhortApiSut.getEndpoint()))) && r.headers().firstValue("Content-Type").get().equals(Api.CYCLONEDX_MEDIA_TYPE) && r.headers() .firstValue("Accept") .get() .equals(Api.MediaType.APPLICATION_JSON.toString()) - && r.headers().firstValue("ex-snyk-token").get().equals("snyk-token-from-env-var") - && r.headers().firstValue("rhda-token").get().equals("rhda-token-from-env-var") - && r.headers().firstValue("rhda-source").get().equals("rhda-source-from-env-var") - && r.headers().firstValue("rhda-operation-type").get().equals("Image Analysis") + && r.headers() + .firstValue("trust-da-token") + .get() + .equals("trust-da-token-from-env-var") + && r.headers() + .firstValue("trust-da-source") + .get() + .equals("trust-da-source-from-env-var") + && r.headers() + .firstValue("trust-da-operation-type") + .get() + .equals("Image Analysis") && r.method().equals("POST"); var imageRef = @@ -806,7 +817,7 @@ void test_get_batch_analysis_reports_from_response() { } @Test - @SetSystemProperty(key = "EXHORT_PROXY_URL", value = "http://proxy.example.com:8080") + @SetSystemProperty(key = "TRUSTIFY_DA_PROXY_URL", value = "http://proxy.example.com:8080") void test_create_httpclient_applies_http_proxyselector() { HttpClient client = ExhortApi.createHttpClient(); Optional selectorOpt = client.proxy(); @@ -824,7 +835,7 @@ void test_create_httpclient_applies_http_proxyselector() { } @Test - @SetSystemProperty(key = "EXHORT_PROXY_URL", value = "://bad-url") + @SetSystemProperty(key = "TRUSTIFY_DA_PROXY_URL", value = "://bad-url") void test_create_httpclient_should_fallback_to_direct_when_proxyurl_is_invalid() { HttpClient client = ExhortApi.createHttpClient(); Optional proxySelector = client.proxy(); diff --git a/src/test/java/com/redhat/exhort/providers/GoModulesMainModuleVersionTest.java b/src/test/java/io/github/guacsec/trustifyda/providers/GoModulesMainModuleVersionTest.java similarity index 93% rename from src/test/java/com/redhat/exhort/providers/GoModulesMainModuleVersionTest.java rename to src/test/java/io/github/guacsec/trustifyda/providers/GoModulesMainModuleVersionTest.java index e1f11cec..3553668d 100644 --- a/src/test/java/com/redhat/exhort/providers/GoModulesMainModuleVersionTest.java +++ b/src/test/java/io/github/guacsec/trustifyda/providers/GoModulesMainModuleVersionTest.java @@ -14,12 +14,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.redhat.exhort.providers; +package io.github.guacsec.trustifyda.providers; import static org.assertj.core.api.Assertions.assertThat; import static org.junit.jupiter.api.Assertions.assertEquals; -import com.redhat.exhort.tools.Operations; +import io.github.guacsec.trustifyda.tools.Operations; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; @@ -40,9 +40,9 @@ class GoModulesMainModuleVersionTest { void setUp() { try { this.goModulesProvider = new GoModulesProvider(null); - this.testGitRepo = Files.createTempDirectory("exhort_tmp"); + this.testGitRepo = Files.createTempDirectory("TRUSTIFY_DA_tmp"); gitInit(); - this.noGitRepo = Files.createTempDirectory("exhort_tmp"); + this.noGitRepo = Files.createTempDirectory("TRUSTIFY_DA_tmp"); } catch (IOException e) { throw new RuntimeException(e); } diff --git a/src/test/java/com/redhat/exhort/providers/Golang_Modules_Provider_Test.java b/src/test/java/io/github/guacsec/trustifyda/providers/Golang_Modules_Provider_Test.java similarity index 93% rename from src/test/java/com/redhat/exhort/providers/Golang_Modules_Provider_Test.java rename to src/test/java/io/github/guacsec/trustifyda/providers/Golang_Modules_Provider_Test.java index 13edfa79..a940f5f9 100644 --- a/src/test/java/com/redhat/exhort/providers/Golang_Modules_Provider_Test.java +++ b/src/test/java/io/github/guacsec/trustifyda/providers/Golang_Modules_Provider_Test.java @@ -14,9 +14,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.redhat.exhort.providers; +package io.github.guacsec.trustifyda.providers; -import static com.redhat.exhort.Provider.PROP_MATCH_MANIFEST_VERSIONS; +import static io.github.guacsec.trustifyda.Provider.PROP_MATCH_MANIFEST_VERSIONS; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException; import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; @@ -28,8 +28,8 @@ import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; -import com.redhat.exhort.Api; -import com.redhat.exhort.ExhortTest; +import io.github.guacsec.trustifyda.Api; +import io.github.guacsec.trustifyda.ExhortTest; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; @@ -64,7 +64,7 @@ static Stream testFolders() { @MethodSource("testFolders") void test_the_provideStack(String testFolder) throws IOException { // create temp file hosting our sut package.json - var tmpGoModulesDir = Files.createTempDirectory("exhort_test_"); + var tmpGoModulesDir = Files.createTempDirectory("TRUSTIFY_DA_test_"); var tmpGolangFile = Files.createFile(tmpGoModulesDir.resolve("go.mod")); try (var is = getResourceAsStreamDecision( @@ -94,7 +94,7 @@ void test_the_provideStack(String testFolder) throws IOException { @MethodSource("testFolders") void test_the_provideComponent(String testFolder) throws IOException { // create temp file hosting our sut package.json - var tmpGoModulesDir = Files.createTempDirectory("exhort_test_"); + var tmpGoModulesDir = Files.createTempDirectory("TRUSTIFY_DA_test_"); var tmpGolangFile = Files.createFile(tmpGoModulesDir.resolve("go.mod")); try (var is = getResourceAsStreamDecision( @@ -167,7 +167,7 @@ void Test_Golang_Modules_with_Match_Manifest_Version(boolean MatchManifestVersio @Test void Test_Golang_MvS_Logic_Disabled() throws IOException { - System.setProperty(GoModulesProvider.PROP_EXHORT_GO_MVS_LOGIC_ENABLED, "false"); + System.setProperty(GoModulesProvider.PROP_TRUSTIFY_DA_GO_MVS_LOGIC_ENABLED, "false"); String goModPath = getFileFromResource("go.mod", "msc/golang/mvs_logic/go.mod"); Path manifest = Path.of(goModPath); GoModulesProvider goModulesProvider = new GoModulesProvider(manifest); @@ -184,13 +184,13 @@ void Test_Golang_MvS_Logic_Disabled() throws IOException { .filter(str -> str.contains("\"ref\" : \"pkg:golang/go.opencensus.io@")) .count()); - System.clearProperty(GoModulesProvider.PROP_EXHORT_GO_MVS_LOGIC_ENABLED); + System.clearProperty(GoModulesProvider.PROP_TRUSTIFY_DA_GO_MVS_LOGIC_ENABLED); resultSbom = dropIgnoredKeepFormat( goModulesProvider.getDependenciesSbom(manifest, true).getAsJsonString()); // check that there is more than one version of package golang/go.opencensus.io in sbom for - // EXHORT_GO_MVS_LOGIC_ENABLED=false + // TRUSTIFY_DA_GO_MVS_LOGIC_ENABLED=false assertTrue( Arrays.stream(resultSbom.split(System.lineSeparator())) .filter(str -> str.contains("\"ref\" : \"pkg:golang/go.opencensus.io@")) diff --git a/src/test/java/com/redhat/exhort/providers/Gradle_Groovy_Provider_Test.java b/src/test/java/io/github/guacsec/trustifyda/providers/Gradle_Groovy_Provider_Test.java similarity index 95% rename from src/test/java/com/redhat/exhort/providers/Gradle_Groovy_Provider_Test.java rename to src/test/java/io/github/guacsec/trustifyda/providers/Gradle_Groovy_Provider_Test.java index 3cfe1d63..6ee9fad4 100644 --- a/src/test/java/com/redhat/exhort/providers/Gradle_Groovy_Provider_Test.java +++ b/src/test/java/io/github/guacsec/trustifyda/providers/Gradle_Groovy_Provider_Test.java @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.redhat.exhort.providers; +package io.github.guacsec.trustifyda.providers; import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.junit.jupiter.MockitoExtension; diff --git a/src/test/java/com/redhat/exhort/providers/Gradle_Kotlin_Provider_Test.java b/src/test/java/io/github/guacsec/trustifyda/providers/Gradle_Kotlin_Provider_Test.java similarity index 95% rename from src/test/java/com/redhat/exhort/providers/Gradle_Kotlin_Provider_Test.java rename to src/test/java/io/github/guacsec/trustifyda/providers/Gradle_Kotlin_Provider_Test.java index 1980e504..e75fb2d0 100644 --- a/src/test/java/com/redhat/exhort/providers/Gradle_Kotlin_Provider_Test.java +++ b/src/test/java/io/github/guacsec/trustifyda/providers/Gradle_Kotlin_Provider_Test.java @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.redhat.exhort.providers; +package io.github.guacsec.trustifyda.providers; import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.junit.jupiter.MockitoExtension; diff --git a/src/test/java/com/redhat/exhort/providers/Gradle_Provider_Test.java b/src/test/java/io/github/guacsec/trustifyda/providers/Gradle_Provider_Test.java similarity index 96% rename from src/test/java/com/redhat/exhort/providers/Gradle_Provider_Test.java rename to src/test/java/io/github/guacsec/trustifyda/providers/Gradle_Provider_Test.java index 7d08bcaa..ecd5c23e 100644 --- a/src/test/java/com/redhat/exhort/providers/Gradle_Provider_Test.java +++ b/src/test/java/io/github/guacsec/trustifyda/providers/Gradle_Provider_Test.java @@ -14,16 +14,16 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.redhat.exhort.providers; +package io.github.guacsec.trustifyda.providers; import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.argThat; import static org.mockito.Mockito.mockStatic; -import com.redhat.exhort.Api; -import com.redhat.exhort.ExhortTest; -import com.redhat.exhort.tools.Operations; +import io.github.guacsec.trustifyda.Api; +import io.github.guacsec.trustifyda.ExhortTest; +import io.github.guacsec.trustifyda.tools.Operations; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; @@ -60,7 +60,7 @@ static Stream testFolders() { @MethodSource("testFolders") void test_the_provideStack(String testFolder) throws IOException { // create temp file hosting our sut build.gradle - var tmpGradleDir = Files.createTempDirectory("exhort_test_"); + var tmpGradleDir = Files.createTempDirectory("TRUSTIFY_DA_test_"); var tmpGradleFile = Files.createFile(tmpGradleDir.resolve(getManifestName())); try (var is = getClass() @@ -163,7 +163,7 @@ void test_the_provideStack(String testFolder) throws IOException { @MethodSource("testFolders") void test_the_provideComponent(String testFolder) throws IOException { // create temp file hosting our sut build.gradle - var tmpGradleDir = Files.createTempDirectory("exhort_test_"); + var tmpGradleDir = Files.createTempDirectory("TRUSTIFY_DA_test_"); var tmpGradleFile = Files.createFile(tmpGradleDir.resolve(getManifestName())); try (var is = getClass() diff --git a/src/test/java/com/redhat/exhort/providers/HelperExtension.java b/src/test/java/io/github/guacsec/trustifyda/providers/HelperExtension.java similarity index 92% rename from src/test/java/com/redhat/exhort/providers/HelperExtension.java rename to src/test/java/io/github/guacsec/trustifyda/providers/HelperExtension.java index 177e7dab..24c2b089 100644 --- a/src/test/java/com/redhat/exhort/providers/HelperExtension.java +++ b/src/test/java/io/github/guacsec/trustifyda/providers/HelperExtension.java @@ -14,10 +14,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.redhat.exhort.providers; +package io.github.guacsec.trustifyda.providers; -import com.redhat.exhort.impl.ExhortApi; -import com.redhat.exhort.logging.LoggersFactory; +import io.github.guacsec.trustifyda.impl.ExhortApi; +import io.github.guacsec.trustifyda.logging.LoggersFactory; import java.util.logging.Logger; import org.junit.jupiter.api.extension.AfterAllCallback; import org.junit.jupiter.api.extension.AfterEachCallback; diff --git a/src/test/java/com/redhat/exhort/providers/Java_Envs_Test.java b/src/test/java/io/github/guacsec/trustifyda/providers/Java_Envs_Test.java similarity index 95% rename from src/test/java/com/redhat/exhort/providers/Java_Envs_Test.java rename to src/test/java/io/github/guacsec/trustifyda/providers/Java_Envs_Test.java index 63b1eaca..9631356a 100644 --- a/src/test/java/com/redhat/exhort/providers/Java_Envs_Test.java +++ b/src/test/java/io/github/guacsec/trustifyda/providers/Java_Envs_Test.java @@ -14,12 +14,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.redhat.exhort.providers; +package io.github.guacsec.trustifyda.providers; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNull; -import com.redhat.exhort.utils.Environment; +import io.github.guacsec.trustifyda.utils.Environment; import java.util.Collections; import org.junit.jupiter.api.Test; import org.junitpioneer.jupiter.SetSystemProperty; diff --git a/src/test/java/com/redhat/exhort/providers/Java_Maven_Provider_Test.java b/src/test/java/io/github/guacsec/trustifyda/providers/Java_Maven_Provider_Test.java similarity index 96% rename from src/test/java/com/redhat/exhort/providers/Java_Maven_Provider_Test.java rename to src/test/java/io/github/guacsec/trustifyda/providers/Java_Maven_Provider_Test.java index 9c42d892..ed70a06d 100644 --- a/src/test/java/com/redhat/exhort/providers/Java_Maven_Provider_Test.java +++ b/src/test/java/io/github/guacsec/trustifyda/providers/Java_Maven_Provider_Test.java @@ -14,16 +14,16 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.redhat.exhort.providers; +package io.github.guacsec.trustifyda.providers; import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.Mockito.mockStatic; -import com.redhat.exhort.Api; -import com.redhat.exhort.ExhortTest; -import com.redhat.exhort.tools.Operations; +import io.github.guacsec.trustifyda.Api; +import io.github.guacsec.trustifyda.ExhortTest; +import io.github.guacsec.trustifyda.tools.Operations; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; @@ -63,7 +63,7 @@ static Stream testFolders() { @MethodSource("testFolders") void test_the_provideStack(String testFolder) throws IOException { // create temp file hosting our sut pom.xml - var tmpPomFile = Files.createTempFile("exhort_test_", ".xml"); + var tmpPomFile = Files.createTempFile("TRUSTIFY_DA_test_", ".xml"); try (var is = getResourceAsStreamDecision( getClass(), String.format("tst_manifests/maven/%s/pom.xml", testFolder))) { @@ -168,7 +168,7 @@ void test_the_provideComponent(String testFolder) throws IOException { void test_the_provideComponent_With_Path(String testFolder) throws IOException { // load the pom target pom file // create temp file hosting our sut pom.xml - var tmpPomFile = Files.createTempFile("exhort_test_", ".xml"); + var tmpPomFile = Files.createTempFile("TRUSTIFY_DA_test_", ".xml"); try (var is = getResourceAsStreamDecision( getClass(), String.format("tst_manifests/maven/%s/pom.xml", testFolder))) { diff --git a/src/test/java/com/redhat/exhort/providers/Javascript_Envs_Test.java b/src/test/java/io/github/guacsec/trustifyda/providers/Javascript_Envs_Test.java similarity index 95% rename from src/test/java/com/redhat/exhort/providers/Javascript_Envs_Test.java rename to src/test/java/io/github/guacsec/trustifyda/providers/Javascript_Envs_Test.java index 151fcf28..9e34eaba 100644 --- a/src/test/java/com/redhat/exhort/providers/Javascript_Envs_Test.java +++ b/src/test/java/io/github/guacsec/trustifyda/providers/Javascript_Envs_Test.java @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.redhat.exhort.providers; +package io.github.guacsec.trustifyda.providers; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNull; @@ -22,8 +22,8 @@ import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.Mockito.mockStatic; -import com.redhat.exhort.tools.Operations; -import com.redhat.exhort.utils.Environment; +import io.github.guacsec.trustifyda.tools.Operations; +import io.github.guacsec.trustifyda.utils.Environment; import java.io.File; import java.nio.file.Path; import java.util.Collections; diff --git a/src/test/java/com/redhat/exhort/providers/Javascript_Provider_Test.java b/src/test/java/io/github/guacsec/trustifyda/providers/Javascript_Provider_Test.java similarity index 96% rename from src/test/java/com/redhat/exhort/providers/Javascript_Provider_Test.java rename to src/test/java/io/github/guacsec/trustifyda/providers/Javascript_Provider_Test.java index f7664eda..f81fe025 100644 --- a/src/test/java/com/redhat/exhort/providers/Javascript_Provider_Test.java +++ b/src/test/java/io/github/guacsec/trustifyda/providers/Javascript_Provider_Test.java @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.redhat.exhort.providers; +package io.github.guacsec.trustifyda.providers; import static org.assertj.core.api.Assertions.assertThat; import static org.junit.jupiter.api.Assertions.fail; @@ -24,10 +24,10 @@ import static org.mockito.ArgumentMatchers.isNull; import static org.mockito.Mockito.mockStatic; -import com.redhat.exhort.Api; -import com.redhat.exhort.ExhortTest; -import com.redhat.exhort.tools.Ecosystem; -import com.redhat.exhort.tools.Operations; +import io.github.guacsec.trustifyda.Api; +import io.github.guacsec.trustifyda.ExhortTest; +import io.github.guacsec.trustifyda.tools.Ecosystem; +import io.github.guacsec.trustifyda.tools.Operations; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; @@ -61,7 +61,7 @@ static Stream testCases() { @MethodSource({"testCases"}) void test_the_provideStack(String pkgManager, String testFolder) throws IOException { // create temp file hosting our sut package.json - var tmpFolder = Files.createTempDirectory("exhort_test_"); + var tmpFolder = Files.createTempDirectory("TRUSTIFY_DA_test_"); var tmpFile = Files.createFile(tmpFolder.resolve("package.json")); var tmpLockFile = Files.createFile(tmpFolder.resolve(getLockFile(pkgManager))); try (var is = @@ -151,7 +151,7 @@ void test_the_provideComponent_with_Path(String pkgManager, String testFolder) t // load the pom target pom file // create temp file hosting our sut package.json - var tmpFolder = Files.createTempDirectory("exhort_test_"); + var tmpFolder = Files.createTempDirectory("TRUSTIFY_DA_test_"); var tmpFile = Files.createFile(tmpFolder.resolve("package.json")); try (var is = diff --git a/src/test/java/com/redhat/exhort/providers/PythonEnvironmentExtension.java b/src/test/java/io/github/guacsec/trustifyda/providers/PythonEnvironmentExtension.java similarity index 93% rename from src/test/java/com/redhat/exhort/providers/PythonEnvironmentExtension.java rename to src/test/java/io/github/guacsec/trustifyda/providers/PythonEnvironmentExtension.java index f462211d..32e0d464 100644 --- a/src/test/java/com/redhat/exhort/providers/PythonEnvironmentExtension.java +++ b/src/test/java/io/github/guacsec/trustifyda/providers/PythonEnvironmentExtension.java @@ -14,11 +14,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.redhat.exhort.providers; +package io.github.guacsec.trustifyda.providers; -import com.redhat.exhort.tools.Operations; -import com.redhat.exhort.utils.PythonControllerBase; -import com.redhat.exhort.utils.PythonControllerTestEnv; +import io.github.guacsec.trustifyda.tools.Operations; +import io.github.guacsec.trustifyda.utils.PythonControllerBase; +import io.github.guacsec.trustifyda.utils.PythonControllerTestEnv; import org.junit.jupiter.api.extension.AfterAllCallback; import org.junit.jupiter.api.extension.AfterEachCallback; import org.junit.jupiter.api.extension.BeforeAllCallback; @@ -62,7 +62,7 @@ public void beforeAll(ExtensionContext extensionContext) { String pip3 = Operations.getCustomPathOrElse("pip3"); this.pythonController = new PythonControllerTestEnv(python3, pip3); log.log(System.Logger.Level.INFO, "Finished Preparing environment for testing"); - // var tmpPythonModuleDir = Files.createTempDirectory("exhort_test_"); + // var tmpPythonModuleDir = Files.createTempDirectory("TRUSTIFY_DA_test_"); // var tmpPythonFile = Files.createFile(tmpPythonModuleDir.resolve("requirements.txt")); // Python_Provider_Test.testFolders().forEach( test -> { // try (var is = diff --git a/src/test/java/com/redhat/exhort/providers/Python_Provider_Test.java b/src/test/java/io/github/guacsec/trustifyda/providers/Python_Provider_Test.java similarity index 85% rename from src/test/java/com/redhat/exhort/providers/Python_Provider_Test.java rename to src/test/java/io/github/guacsec/trustifyda/providers/Python_Provider_Test.java index 59e13fd0..efec78bb 100644 --- a/src/test/java/com/redhat/exhort/providers/Python_Provider_Test.java +++ b/src/test/java/io/github/guacsec/trustifyda/providers/Python_Provider_Test.java @@ -14,18 +14,18 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.redhat.exhort.providers; +package io.github.guacsec.trustifyda.providers; -import static com.redhat.exhort.utils.PythonControllerBase.PROP_EXHORT_PIP_FREEZE; -import static com.redhat.exhort.utils.PythonControllerBase.PROP_EXHORT_PIP_PIPDEPTREE; -import static com.redhat.exhort.utils.PythonControllerBase.PROP_EXHORT_PIP_SHOW; -import static com.redhat.exhort.utils.PythonControllerBase.PROP_EXHORT_PIP_USE_DEP_TREE; +import static io.github.guacsec.trustifyda.utils.PythonControllerBase.PROP_TRUSTIFY_DA_PIP_FREEZE; +import static io.github.guacsec.trustifyda.utils.PythonControllerBase.PROP_TRUSTIFY_DA_PIP_PIPDEPTREE; +import static io.github.guacsec.trustifyda.utils.PythonControllerBase.PROP_TRUSTIFY_DA_PIP_SHOW; +import static io.github.guacsec.trustifyda.utils.PythonControllerBase.PROP_TRUSTIFY_DA_PIP_USE_DEP_TREE; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException; -import com.redhat.exhort.Api; -import com.redhat.exhort.ExhortTest; -import com.redhat.exhort.utils.PythonControllerBase; +import io.github.guacsec.trustifyda.Api; +import io.github.guacsec.trustifyda.ExhortTest; +import io.github.guacsec.trustifyda.utils.PythonControllerBase; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; @@ -57,7 +57,7 @@ public Python_Provider_Test(PythonControllerBase pythonController) { @MethodSource("testFolders") void test_the_provideStack(String testFolder) throws IOException { // create temp file hosting our sut package.json - var tmpPythonModuleDir = Files.createTempDirectory("exhort_test_"); + var tmpPythonModuleDir = Files.createTempDirectory("trustify_da_test_"); var tmpPythonFile = Files.createFile(tmpPythonModuleDir.resolve("requirements.txt")); var provider = new PythonPipProvider(tmpPythonFile); provider.setPythonController(pythonController); @@ -110,11 +110,11 @@ void test_the_provideComponent(String testFolder) throws IOException { @ParameterizedTest @MethodSource("testFolders") - @SetSystemProperty(key = PythonControllerBase.PROP_EXHORT_PYTHON_VIRTUAL_ENV, value = "true") + @SetSystemProperty(key = PythonControllerBase.PROP_TRUSTIFY_DA_PYTHON_VIRTUAL_ENV, value = "true") @RestoreSystemProperties void test_the_provideStack_with_properties(String testFolder) throws IOException { // create temp file hosting our sut package.json - var tmpPythonModuleDir = Files.createTempDirectory("exhort_test_"); + var tmpPythonModuleDir = Files.createTempDirectory("trustify_da_test_"); var tmpPythonFile = Files.createFile(tmpPythonModuleDir.resolve("requirements.txt")); try (var is = getResourceAsStreamDecision( @@ -135,8 +135,8 @@ void test_the_provideStack_with_properties(String testFolder) throws IOException String pipFreezeContent = this.getStringFromFile("tst_manifests/pip/pip-freeze-all.txt"); String base64PipShow = new String(Base64.getEncoder().encode(pipShowContent.getBytes())); String base64PipFreeze = new String(Base64.getEncoder().encode(pipFreezeContent.getBytes())); - System.setProperty(PROP_EXHORT_PIP_SHOW, base64PipShow); - System.setProperty(PROP_EXHORT_PIP_FREEZE, base64PipFreeze); + System.setProperty(PROP_TRUSTIFY_DA_PIP_SHOW, base64PipShow); + System.setProperty(PROP_TRUSTIFY_DA_PIP_FREEZE, base64PipFreeze); // cleanup Files.deleteIfExists(tmpPythonFile); Files.deleteIfExists(tmpPythonModuleDir); @@ -147,12 +147,12 @@ void test_the_provideStack_with_properties(String testFolder) throws IOException @ParameterizedTest @MethodSource("testFolders") - @SetSystemProperty(key = PythonControllerBase.PROP_EXHORT_PYTHON_VIRTUAL_ENV, value = "true") - @SetSystemProperty(key = PROP_EXHORT_PIP_USE_DEP_TREE, value = "true") + @SetSystemProperty(key = PythonControllerBase.PROP_TRUSTIFY_DA_PYTHON_VIRTUAL_ENV, value = "true") + @SetSystemProperty(key = PROP_TRUSTIFY_DA_PIP_USE_DEP_TREE, value = "true") @RestoreSystemProperties void test_the_provideStack_with_pipdeptree(String testFolder) throws IOException { // create temp file hosting our sut package.json - var tmpPythonModuleDir = Files.createTempDirectory("exhort_test_"); + var tmpPythonModuleDir = Files.createTempDirectory("trustify_da_test_"); var tmpPythonFile = Files.createFile(tmpPythonModuleDir.resolve("requirements.txt")); try (var is = getResourceAsStreamDecision( @@ -171,7 +171,7 @@ void test_the_provideStack_with_pipdeptree(String testFolder) throws IOException var content = new PythonPipProvider(tmpPythonFile).provideStack(); String pipdeptreeContent = this.getStringFromFile("tst_manifests/pip/pipdeptree.json"); String base64Pipdeptree = new String(Base64.getEncoder().encode(pipdeptreeContent.getBytes())); - System.setProperty(PROP_EXHORT_PIP_PIPDEPTREE, base64Pipdeptree); + System.setProperty(PROP_TRUSTIFY_DA_PIP_PIPDEPTREE, base64Pipdeptree); // cleanup Files.deleteIfExists(tmpPythonFile); Files.deleteIfExists(tmpPythonModuleDir); @@ -200,8 +200,8 @@ void test_the_provideComponent_with_properties(String testFolder) throws IOExcep String pipFreezeContent = this.getStringFromFile("tst_manifests/pip/pip-freeze-all.txt"); String base64PipShow = new String(Base64.getEncoder().encode(pipShowContent.getBytes())); String base64PipFreeze = new String(Base64.getEncoder().encode(pipFreezeContent.getBytes())); - System.setProperty(PROP_EXHORT_PIP_SHOW, base64PipShow); - System.setProperty(PROP_EXHORT_PIP_FREEZE, base64PipFreeze); + System.setProperty(PROP_TRUSTIFY_DA_PIP_SHOW, base64PipShow); + System.setProperty(PROP_TRUSTIFY_DA_PIP_FREEZE, base64PipFreeze); // when providing component content for our pom var content = new PythonPipProvider(Path.of(targetRequirements)).provideComponent(); // verify expected SBOM is returned diff --git a/src/test/java/com/redhat/exhort/tools/Ecosystem_Test.java b/src/test/java/io/github/guacsec/trustifyda/tools/Ecosystem_Test.java similarity index 93% rename from src/test/java/com/redhat/exhort/tools/Ecosystem_Test.java rename to src/test/java/io/github/guacsec/trustifyda/tools/Ecosystem_Test.java index 7de7cd1e..bd066b84 100644 --- a/src/test/java/com/redhat/exhort/tools/Ecosystem_Test.java +++ b/src/test/java/io/github/guacsec/trustifyda/tools/Ecosystem_Test.java @@ -14,13 +14,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.redhat.exhort.tools; +package io.github.guacsec.trustifyda.tools; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatExceptionOfType; import static org.junit.jupiter.api.Assertions.assertThrows; -import com.redhat.exhort.providers.JavaMavenProvider; +import io.github.guacsec.trustifyda.providers.JavaMavenProvider; import java.nio.file.Path; import org.junit.jupiter.api.Test; diff --git a/src/test/java/com/redhat/exhort/tools/OperationsTest.java b/src/test/java/io/github/guacsec/trustifyda/tools/OperationsTest.java similarity index 97% rename from src/test/java/com/redhat/exhort/tools/OperationsTest.java rename to src/test/java/io/github/guacsec/trustifyda/tools/OperationsTest.java index 4cdfecdb..8aefaf38 100644 --- a/src/test/java/com/redhat/exhort/tools/OperationsTest.java +++ b/src/test/java/io/github/guacsec/trustifyda/tools/OperationsTest.java @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.redhat.exhort.tools; +package io.github.guacsec.trustifyda.tools; import static org.assertj.core.api.Assertions.assertThatNoException; import static org.assertj.core.api.Assertions.assertThatRuntimeException; diff --git a/src/test/java/com/redhat/exhort/tools/Operations_Test.java b/src/test/java/io/github/guacsec/trustifyda/tools/Operations_Test.java similarity index 93% rename from src/test/java/com/redhat/exhort/tools/Operations_Test.java rename to src/test/java/io/github/guacsec/trustifyda/tools/Operations_Test.java index 5f87053c..823229f9 100644 --- a/src/test/java/com/redhat/exhort/tools/Operations_Test.java +++ b/src/test/java/io/github/guacsec/trustifyda/tools/Operations_Test.java @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.redhat.exhort.tools; +package io.github.guacsec.trustifyda.tools; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatNoException; @@ -42,7 +42,7 @@ void when_running_process_for_non_existing_command_should_throw_runtime_exceptio class Test_getCustomPathOrElse { @Test - @SetSystemProperty(key = "EXHORT_MADE_UP_CMD_PATH", value = "/path/to/made_up_cmd") + @SetSystemProperty(key = "TRUSTIFY_DA_MADE_UP_CMD_PATH", value = "/path/to/made_up_cmd") void when_custom_path_exists_as_property() { assertThat(Operations.getCustomPathOrElse("made-up cmd")).isEqualTo("/path/to/made_up_cmd"); } diff --git a/src/test/java/com/redhat/exhort/utils/PythonControllerBaseTest.java b/src/test/java/io/github/guacsec/trustifyda/utils/PythonControllerBaseTest.java similarity index 99% rename from src/test/java/com/redhat/exhort/utils/PythonControllerBaseTest.java rename to src/test/java/io/github/guacsec/trustifyda/utils/PythonControllerBaseTest.java index 0bce9e7c..729a0dce 100644 --- a/src/test/java/com/redhat/exhort/utils/PythonControllerBaseTest.java +++ b/src/test/java/io/github/guacsec/trustifyda/utils/PythonControllerBaseTest.java @@ -14,11 +14,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.redhat.exhort.utils; +package io.github.guacsec.trustifyda.utils; import static org.junit.jupiter.api.Assertions.assertEquals; -import com.redhat.exhort.ExhortTest; +import io.github.guacsec.trustifyda.ExhortTest; import java.util.Arrays; import java.util.LinkedList; import java.util.List; diff --git a/src/test/java/com/redhat/exhort/utils/PythonControllerRealEnvTest.java b/src/test/java/io/github/guacsec/trustifyda/utils/PythonControllerRealEnvTest.java similarity index 96% rename from src/test/java/com/redhat/exhort/utils/PythonControllerRealEnvTest.java rename to src/test/java/io/github/guacsec/trustifyda/utils/PythonControllerRealEnvTest.java index 5e01c07d..378cd1da 100644 --- a/src/test/java/com/redhat/exhort/utils/PythonControllerRealEnvTest.java +++ b/src/test/java/io/github/guacsec/trustifyda/utils/PythonControllerRealEnvTest.java @@ -14,11 +14,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.redhat.exhort.utils; +package io.github.guacsec.trustifyda.utils; -import static com.redhat.exhort.Provider.PROP_MATCH_MANIFEST_VERSIONS; -import static com.redhat.exhort.utils.PythonControllerBaseTest.matchCommandPipFreeze; -import static com.redhat.exhort.utils.PythonControllerBaseTest.matchCommandPipShow; +import static io.github.guacsec.trustifyda.Provider.PROP_MATCH_MANIFEST_VERSIONS; +import static io.github.guacsec.trustifyda.utils.PythonControllerBaseTest.matchCommandPipFreeze; +import static io.github.guacsec.trustifyda.utils.PythonControllerBaseTest.matchCommandPipShow; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertThrows; @@ -26,8 +26,8 @@ import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.argThat; -import com.redhat.exhort.ExhortTest; -import com.redhat.exhort.tools.Operations; +import io.github.guacsec.trustifyda.ExhortTest; +import io.github.guacsec.trustifyda.tools.Operations; import java.nio.file.Path; import java.util.HashSet; import java.util.List; diff --git a/src/test/java/com/redhat/exhort/utils/PythonControllerVirtualEnvTest.java b/src/test/java/io/github/guacsec/trustifyda/utils/PythonControllerVirtualEnvTest.java similarity index 90% rename from src/test/java/com/redhat/exhort/utils/PythonControllerVirtualEnvTest.java rename to src/test/java/io/github/guacsec/trustifyda/utils/PythonControllerVirtualEnvTest.java index 1027f576..a116589c 100644 --- a/src/test/java/com/redhat/exhort/utils/PythonControllerVirtualEnvTest.java +++ b/src/test/java/io/github/guacsec/trustifyda/utils/PythonControllerVirtualEnvTest.java @@ -14,10 +14,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.redhat.exhort.utils; +package io.github.guacsec.trustifyda.utils; -import static com.redhat.exhort.Provider.PROP_MATCH_MANIFEST_VERSIONS; -import static com.redhat.exhort.utils.PythonControllerBase.PROP_EXHORT_PYTHON_INSTALL_BEST_EFFORTS; +import static io.github.guacsec.trustifyda.Provider.PROP_MATCH_MANIFEST_VERSIONS; +import static io.github.guacsec.trustifyda.utils.PythonControllerBase.PROP_TRUSTIFY_DA_PYTHON_INSTALL_BEST_EFFORTS; import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertThrows; import static org.junit.jupiter.api.Assertions.assertTrue; @@ -29,7 +29,7 @@ import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; -import com.redhat.exhort.ExhortTest; +import io.github.guacsec.trustifyda.ExhortTest; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; @@ -58,7 +58,7 @@ static void setUp() { @Test @RestoreSystemProperties void test_Virtual_Environment_Install_Best_Efforts() throws JsonProcessingException { - System.setProperty(PROP_EXHORT_PYTHON_INSTALL_BEST_EFFORTS, "true"); + System.setProperty(PROP_TRUSTIFY_DA_PYTHON_INSTALL_BEST_EFFORTS, "true"); System.setProperty(PROP_MATCH_MANIFEST_VERSIONS, "false"); String requirementsTxt = getFileFromString("requirements.txt", "flask==9.9.9\ndeprecated==15.15.99\n"); @@ -70,7 +70,7 @@ void test_Virtual_Environment_Install_Best_Efforts() throws JsonProcessingExcept @Test @RestoreSystemProperties - @SetSystemProperty(key = PROP_EXHORT_PYTHON_INSTALL_BEST_EFFORTS, value = "true") + @SetSystemProperty(key = PROP_TRUSTIFY_DA_PYTHON_INSTALL_BEST_EFFORTS, value = "true") void test_Virtual_Environment_Install_Best_Efforts_Conflict_MMV_Should_Throw_Runtime_Exception() { String requirementsTxt = getFileFromString("requirements.txt", "flask==9.9.9\ndeprecated==15.15.99\n"); diff --git a/src/test/java/module-info.test b/src/test/java/module-info.test index 70b4d39b..9581cbeb 100644 --- a/src/test/java/module-info.test +++ b/src/test/java/module-info.test @@ -2,22 +2,22 @@ jdk.attach,jdk.unsupported,org.assertj.core,org.junit.jupiter.params,org.mockito,org.mockito.junit.jupiter,net.bytebuddy,net.bytebuddy.agent --add-reads - com.redhat.exhort=org.assertj.core,org.junit.jupiter.api + io.github.guacsec.trustifyda=org.assertj.core,org.junit.jupiter.api --add-reads - com.redhat.exhort=org.junit.jupiter.params,org.mockito + io.github.guacsec.trustifyda=org.junit.jupiter.params,org.mockito --add-reads org.mockito=java.net.http --add-opens - com.redhat.exhort/com.redhat.exhort.impl=org.junit.platform.commons + io.github.guacsec.trustifyda/io.github.guacsec.trustifyda.impl=org.junit.platform.commons --add-opens - com.redhat.exhort/com.redhat.exhort.providers=org.junit.platform.commons + io.github.guacsec.trustifyda/io.github.guacsec.trustifyda.providers=org.junit.platform.commons --add-opens - com.redhat.exhort/com.redhat.exhort.tools=org.junit.platform.commons + io.github.guacsec.trustifyda/io.github.guacsec.trustifyda.tools=org.junit.platform.commons --add-opens - com.redhat.exhort/com.redhat.exhort.image=org.junit.platform.commons + io.github.guacsec.trustifyda/io.github.guacsec.trustifyda.image=org.junit.platform.commons --add-opens - com.redhat.exhort/com.redhat.exhort.image=org.mockito + io.github.guacsec.trustifyda/io.github.guacsec.trustifyda.image=org.mockito --add-opens java.base/java.lang=org.junitpioneer --add-opens diff --git a/src/test/resources/dummy_responses/maven/analysis-report.html b/src/test/resources/dummy_responses/maven/analysis-report.html index 14a74c61..def12152 100644 --- a/src/test/resources/dummy_responses/maven/analysis-report.html +++ b/src/test/resources/dummy_responses/maven/analysis-report.html @@ -192,7 +192,7 @@ # Transitive Highest CVSS Highest Severity - Red Hat remediation available + Trustify remediation available @@ -232,7 +232,7 @@ - SNYK-JAVA-LOG4J-1300176 @@ -289,7 +289,7 @@ CVE-2019-17571 - SNYK-JAVA-LOG4J-572732 @@ -325,7 +325,7 @@ CVE-2022-23305 - SNYK-JAVA-LOG4J-2342645 @@ -361,7 +361,7 @@ CVE-2022-23307 - SNYK-JAVA-LOG4J-2342646 @@ -397,7 +397,7 @@ CVE-2022-23302 - SNYK-JAVA-LOG4J-2342647 @@ -433,7 +433,7 @@ CVE-2021-4104 - SNYK-JAVA-LOG4J-2316893 @@ -469,7 +469,7 @@ CVE-2023-26464 - SNYK-JAVA-LOG4J-3358774 @@ -505,7 +505,7 @@ CVE-2020-9488 - SNYK-JAVA-LOG4J-1300176 @@ -590,4 +590,4 @@