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

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/integration-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ env:
FED_FILE: swagger-promote-7.7-20260228.fed
LOG_LEVEL: debug
reset_password: true
apimanager_password: ${{ secrets.APIMANAGER_PASSWORD }}
oadmin_password: ${{ secrets.OADMIN_PASSWORD }}

jobs:
integration-test:
Expand Down
8 changes: 3 additions & 5 deletions .github/workflows/release-choco-pack-publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,12 @@ jobs:
name: Publish Choco package
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v6.0.0
name: Check-Out
- name: Fetch release package
uses: wyozi/download-gh-release-asset@master
with:
args: axway-apimcli-${{ github.event.release.tag_name }}.zip
run: gh release download "${{ github.event.release.tag_name }}" --repo "$GITHUB_REPOSITORY" --pattern "axway-apimcli-${{ github.event.release.tag_name }}.zip"
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
GH_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
- name: Move release to tools
run: |
mv axway-apimcli-${{ github.event.release.tag_name }}.zip tools/choco/axway-apim-cli/tools
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,6 @@

.DS_Store
/.idea/
/.claude/
/CLAUDE.md
/.mcp.json
53 changes: 53 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# AGENTS.md

## What this repo is
- Multi-module Maven Java CLI for Axway API Manager; root module graph is in `pom.xml` (`modules/*` + `distribution`).
- Core behavior is "desired state -> actual state" sync ("Everything as code") from config files to API Manager (`README.md`).

## Architecture map (read these first)
- CLI bootstrap and command dispatch: `modules/apim-cli/src/main/java/com/axway/apim/cli/APIManagerCLI.java`.
- Plugin contract for command providers: `modules/apim-cli/src/main/java/com/axway/apim/cli/APIMCLIServiceProvider.java`.
- Service registration uses Java `ServiceLoader` files at `modules/*/src/main/resources/META-INF/services/com.axway.apim.cli.APIMCLIServiceProvider`.
- API management command flow example: `modules/apis/src/main/java/com/axway/apim/APIImportApp.java`.
- Remote system abstraction (HTTP/API Manager integration) lives in `modules/apim-adapter`.
- Shared test utilities and integration framework support live in `modules/apim-cli-tests`.

## How commands are added here (project-specific pattern)
- Implement `APIMCLIServiceProvider` in the owning module (example: `APIImportApp`).
- Expose each CLI action with `@CLIServiceMethod(name = "...", description = "...")`.
- Register provider class name in the module ServiceLoader file under `META-INF/services/...APIMCLIServiceProvider`.
- Group routing is based on `getGroupId()`; usage output comes from `getGroupDescription()`.

## Build and test workflows
- Baseline build (unit tests only by default):
```bash
mvn clean verify
```
- Integration tests profile (disables unit tests, enables failsafe ITs):
```bash
mvn clean verify -Pintegration-tests
```
- Skip all tests profile:
```bash
mvn clean verify -Pno-tests
```
- Distribution artifacts are produced by module `distribution` (see `distribution/target/*.tar.gz` and `*.zip`).
- Java target is 11 at parent level (`pom.xml`), while `apim-cli-tests` compiles for Java 8 (`modules/apim-cli-tests/pom.xml`).

## Integration and runtime assumptions
- API Manager access credentials/host are supplied via environment property files (sample: `examples/conf/env.api-env.properties`).
- API/app desired state payloads are JSON/YAML config files (see `examples/basic`, `examples/complex`, `examples/orgsAndApps`).
- Adapter dependencies indicate supported API styles/formats: Swagger/OpenAPI parser, OData (v2/v4), GraphQL, Jackson YAML/XML, HTTP client (`modules/apim-adapter/pom.xml`).

## Testing + CI nuances
- Unit tests run via Surefire; integration tests via Failsafe with explicit exclusions in root `pom.xml`.
- Integration tests are Docker/API-Manager based; setup expectations and required GitHub secrets are documented in `Integration_test_setup.md`.
- For config-driven behavior changes, prefer adding/adjusting scenario-style tests in `modules/*/src/test` using patterns from existing ITs.

## Release workflow anchors
- Release process is branch-based (`develop` -> `master`) and documented in `DEVELOPMENT.md`.
- Release profile (`-Prelease`) enables sources/javadocs/GPG signing/Nexus staging plugins in root `pom.xml`.

## Existing AI guidance in repo
- No dedicated AI instruction files were found in the searched convention paths; `README.md` is the primary project-level guidance.

24 changes: 22 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,30 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).

# [Unreleased]
# [1.14.16] In progress

### Fixed
- API import of a WSDL based API with `-overrideSpecBasePath` ignores `backendBasepath` and uses the endpoint from the WSDL
API import of a WSDL based API with -overrideSpecBasePath ignores backendBasepath and uses the endpoint from the WSDL

### Changed
- Quota restrictions are now added, updated and removed individually using the API-Manager endpoints below
`/quotas/{id}/constraints` instead of replacing the complete quota document. This leaves the restrictions of
other APIs untouched and avoids lost updates. API-Managers older than 7.7.20261130 keep using the previous
document level update, and the CLI falls back to it automatically if the endpoints are not served.

### Added
- API import supports `-quotaUpdateMode` (`auto`, `legacy`, `constraints`) to control how quotas are written to
API-Manager. Defaults to `auto`.

### Deprecated
- **OData support is deprecated and will be removed in the next release.** Passing an OData `$metadata` / EDMX
document as the API definition, which the CLI detects and converts to OpenAPI before importing, is affected for
all three versions: OData V2, V3 and V4.
The conversion is built on [Apache Olingo](https://olingo.apache.org/), which is no longer maintained, so it
cannot be kept up to date or secured within this project.
The conversion will move to a separate project that turns OData metadata into an OpenAPI definition. Convert the
metadata there first, then import the resulting OpenAPI document with the CLI as usual. Everything else about
importing such an API, including the generated API-Methods, stays the same.

# [1.14.15] 2026-8-26

Expand Down
20 changes: 20 additions & 0 deletions Integration_test_setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,25 @@ For that TravisCI is using, which is starting an API-Manager V7.x Docker-Contain
Perform the following steps:
- Update Github variable AXWAY_DOCKER_REG_PASS with client_id
- Update Github variable AXWAY_DOCKER_REG_USER with client_secret
- Credentials are not stored in the repository. Add the following Github secrets, which the workflow exposes as
environment variables:
- `APIMANAGER_PASSWORD` - password of the `apiadmin` account, exposed as `apimanager_password`
- `OADMIN_PASSWORD` - password of the `testoadmin` organization admin, exposed as `oadmin_password`

## Running the integration tests locally
`modules/apim-cli-tests/src/main/resources/citrus-global-variables.properties` only holds the defaults. Override
the credentials, and optionally the host, through environment variables before running the tests:

```bash
export apimanager_password='<password of apiadmin>'
export oadmin_password='<password of testoadmin>'
export apimanager_host=localhost # optional, defaults to localhost
mvn clean verify -Pintegration-tests
```

Note that this properties file must not contain `${...}` placeholders. It is read twice: by Spring as a
`@PropertySource` and by the Citrus `GlobalVariablesPropertyLoader`, and the latter resolves `${...}` as a Citrus
test variable and fails on anything it does not know. The mapping from environment variable to property is done in
`EndpointConfig` instead.


80 changes: 80 additions & 0 deletions TODO.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
# TODO — Security & Dependency Hygiene

Generated: 2026-08-26
Branch: `fix/jackson-2.22-upgrade`

---

## Security Scan Results

**CVE scan date:** 2026-08-26
**Result:** ✅ No known CVEs found in any direct or transitive dependency.

---

## Dependency Hygiene Findings

The items below are not CVEs today but represent outdated or end-of-life libraries
that carry long-term security and maintenance risk.

### 🔴 High Priority

#### 1. `io.swagger.core.v3:swagger-models` — version mismatch
- **Managed version:** `2.2.0`
- **Effective version (transitive via `swagger-parser:2.1.19`):** `2.2.19`
- **Issue:** The pinned version in `dependencyManagement` is 19 minor releases behind the
version already on the classpath. This means `swagger-models` is never actually
overriding the transitive resolution and gives a false sense of control.
- **Fix:** Update `swagger-models` version in `pom.xml` `dependencyManagement` to `2.2.19`.
- **File:** `pom.xml`

---

### 🟠 Medium Priority

#### 2. `org.apache.httpcomponents:httpclient` — EOL library
- **Managed version:** `4.5.14`
- **Issue:** Apache HttpClient 4.x is **end-of-life**. The successor is
`org.apache.hc.client5:httpclient5` (HttpClient 5.x), which is already used in
`modules/apim-cli-tests`. No CVE at 4.5.14 today, but the 4.x line will not receive
security patches.
- **Fix:** Migrate usages in `modules/apim-adapter` and `modules/apis` from
`org.apache.httpcomponents:httpclient` to `org.apache.hc.client5:httpclient5`.
- **Files:** `pom.xml`, `modules/apim-adapter/pom.xml`, `modules/apis/pom.xml`

#### ~~3. `org.apache.logging.log4j:log4j-slf4j-impl` — behind current release~~ ✅ DONE
- **Was:** `log4j-slf4j-impl:2.20.0` + `slf4j-api:1.7.36`
- **Now:** `log4j-slf4j2-impl:2.25.4` + `log4j-api/core:2.25.4` + `slf4j-api:2.0.18`
- `log4j-slf4j-impl` (SLF4J 1.x bridge) was discontinued at 2.20.0; replaced with
`log4j-slf4j2-impl` (SLF4J 2.x bridge). Source unchanged — only `Logger`/`LoggerFactory`
used, both backward-compatible in SLF4J 2.x.

---

### 🟡 Low Priority

#### 4. `org.slf4j:slf4j-api` — legacy branch
- **Managed version:** `1.7.36`
- **Current release:** `2.0.x`
- **Issue:** SLF4J 1.x is the legacy branch. 2.x has been stable for over a year. No CVE
at 1.7.36.
- **Fix:** Upgrade to `slf4j-api:2.0.x` (requires aligning `log4j-slf4j-impl` →
`log4j-slf4j2-impl` artifact rename).
- **File:** `pom.xml`

#### 5. `org.glassfish.jaxb:jaxb-runtime` — dated release
- **Managed version:** `2.3.9`
- **Current release:** `4.x` (under Eclipse EE4J)
- **Issue:** The 2.3.x line is a legacy Jakarta EE 8 artefact. No CVE at 2.3.9.
- **Fix:** Evaluate upgrade to `4.0.x` (requires Jakarta EE 10 namespace migration:
`javax.*` → `jakarta.*`).
- **File:** `pom.xml`

#### 6. `commons-logging:commons-logging` — transitive, slightly outdated
- **Effective version (transitive):** `1.2`
- **Current release:** `1.3.x`
- **Issue:** Pulled transitively via `httpclient:4.5.14`. No CVE at 1.2.
- **Fix:** Add `commons-logging:commons-logging:1.3.x` to `dependencyManagement` to force
the newer version, or resolve as part of the HttpClient 5.x migration (item #2 above).
- **File:** `pom.xml`

11 changes: 4 additions & 7 deletions modules/apim-adapter/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@

<dependencies>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<groupId>org.apache.httpcomponents.client5</groupId>
<artifactId>httpclient5</artifactId>
</dependency>
<dependency>
<groupId>commons-cli</groupId>
Expand All @@ -35,10 +35,7 @@
<groupId>org.apache.commons</groupId>
<artifactId>commons-text</artifactId>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpmime</artifactId>
</dependency>
<!-- httpmime is bundled in httpclient5 -->
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
Expand Down Expand Up @@ -89,7 +86,7 @@
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-slf4j-impl</artifactId>
<artifactId>log4j-slf4j2-impl</artifactId>
</dependency>
<dependency>
<groupId>dev.failsafe</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,18 @@
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.apache.commons.io.IOUtils;
import org.apache.http.Header;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.NameValuePair;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.utils.URIBuilder;
import org.apache.http.entity.ContentType;
import org.apache.http.entity.mime.MultipartEntityBuilder;
import org.apache.http.message.BasicNameValuePair;
import org.apache.http.util.EntityUtils;
import org.apache.hc.core5.http.Header;
import org.apache.hc.core5.http.HttpEntity;
import org.apache.hc.core5.http.HttpResponse;
import org.apache.hc.core5.http.NameValuePair;
import org.apache.hc.client5.http.entity.UrlEncodedFormEntity;
import org.apache.hc.client5.http.impl.classic.CloseableHttpResponse;
import org.apache.hc.core5.net.URIBuilder;
import org.apache.hc.core5.http.ContentType;
import org.apache.hc.client5.http.entity.mime.MultipartEntityBuilder;
import org.apache.hc.core5.http.message.BasicNameValuePair;
import org.apache.hc.core5.http.io.entity.EntityUtils;
import org.apache.hc.core5.http.ParseException;
import org.ehcache.Cache;
import org.ehcache.CacheManager;
import org.ehcache.StateTransitionException;
Expand Down Expand Up @@ -231,7 +232,7 @@ public void loginToAPIManager() throws AppException {
User user = getCurrentUser();
String role = getHigherRole(user);
assignRoles(role);
} catch (IOException | URISyntaxException e) {
} catch (IOException | URISyntaxException | ParseException e) {
throw new AppException("Can't login to API-Manager", ErrorCode.API_MANAGER_COMMUNICATION, e);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
Expand Down Expand Up @@ -294,7 +295,7 @@ public void logoutFromAPIManager() throws AppException {
URI uri = new URIBuilder(cmd.getAPIManagerURL()).setPath(cmd.getApiBasepath() + "/login").build();
DELRequest logoutRequest = new DELRequest(uri);
try (CloseableHttpResponse httpResponse = (CloseableHttpResponse) logoutRequest.execute()) {
int statusCode = httpResponse.getStatusLine().getStatusCode();
int statusCode = httpResponse.getCode();
if (statusCode != 204) {
String response = EntityUtils.toString(httpResponse.getEntity());
LOG.warn("Logout failed with statusCode: {} Got response: {}", statusCode, response);
Expand All @@ -313,7 +314,7 @@ public static User getCurrentUser() throws AppException {
try (CloseableHttpResponse httpResponse = (CloseableHttpResponse) currentUserRequest.execute()) {
getCsrfToken(httpResponse);
String currentUser = EntityUtils.toString(httpResponse.getEntity());
int statusCode = httpResponse.getStatusLine().getStatusCode();
int statusCode = httpResponse.getCode();
if (statusCode != 200) {
throw new AppException("Status-Code: " + statusCode + ", Can't get current-user for user '" + currentUser + "'",
ErrorCode.API_MANAGER_COMMUNICATION);
Expand All @@ -332,7 +333,7 @@ public static User getCurrentUser() throws AppException {
}

private static void getCsrfToken(HttpResponse response) throws AppException {
for (Header header : response.getAllHeaders()) {
for (Header header : response.getHeaders()) {
if (header.getName().equalsIgnoreCase("csrf-token")) {
APIMHttpClient.getInstance().setCsrfToken(header.getValue());
break;
Expand Down Expand Up @@ -532,7 +533,7 @@ public static Image getImageFromAPIM(URI uri, String baseFilename) throws AppExc
try {
RestAPICall getRequest = new GETRequest(uri);
try (CloseableHttpResponse httpResponse = (CloseableHttpResponse) getRequest.execute()) {
int statusCode = httpResponse.getStatusLine().getStatusCode();
int statusCode = httpResponse.getCode();
if (statusCode == 404) return null; // No Image found
if (statusCode != 200) {
String response = EntityUtils.toString(httpResponse.getEntity());
Expand Down Expand Up @@ -583,7 +584,7 @@ public static String getCertInfo(InputStream certificate, String password, CaCer
.build();
POSTRequest postRequest = new POSTRequest(entity, uri);
try (CloseableHttpResponse httpResponse = (CloseableHttpResponse) postRequest.execute()) {
int statusCode = httpResponse.getStatusLine().getStatusCode();
int statusCode = httpResponse.getCode();
String response = EntityUtils.toString(httpResponse.getEntity());
if (statusCode != 200) {
if (response != null && response.contains("Bad password")) {
Expand All @@ -608,7 +609,7 @@ public List<CaCert> getCertInfoFromUrl(String url) throws AppException {
params.add(new BasicNameValuePair("outbound", "true"));
POSTRequest postRequest = new POSTRequest(new UrlEncodedFormEntity(params), uri);
try (CloseableHttpResponse httpResponse = (CloseableHttpResponse) postRequest.execute()) {
int statusCode = httpResponse.getStatusLine().getStatusCode();
int statusCode = httpResponse.getCode();
if (statusCode != 200) {
String response = EntityUtils.toString(httpResponse.getEntity());
throw new AppException("API-Manager failed to read certificate information from URL. Got response: '" + response + "'", ErrorCode.API_MANAGER_COMMUNICATION);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
package com.axway.apim.adapter;

import com.axway.apim.lib.utils.rest.RestAPICall;
import org.apache.http.HttpEntity;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.util.EntityUtils;
import org.apache.hc.core5.http.HttpEntity;
import org.apache.hc.client5.http.impl.classic.CloseableHttpResponse;
import org.apache.hc.core5.http.io.entity.EntityUtils;
import org.apache.hc.core5.http.ParseException;

import java.io.IOException;

public class HttpHelper {

public Response execute(RestAPICall restAPICall, boolean responseBody) throws IOException {
public Response execute(RestAPICall restAPICall, boolean responseBody) throws IOException, ParseException {
try(CloseableHttpResponse closeableHttpResponse = (CloseableHttpResponse) restAPICall.execute()){
Response response = new Response();
response.setStatusCode(closeableHttpResponse.getStatusLine().getStatusCode());
response.setStatusCode(closeableHttpResponse.getCode());
HttpEntity httpEntity = closeableHttpResponse.getEntity();
if(responseBody && httpEntity != null)
response.setResponseBody(EntityUtils.toString(httpEntity));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
import com.axway.apim.lib.utils.Utils;
import com.axway.apim.lib.utils.Utils.FedKeyType;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.NameValuePair;
import org.apache.http.message.BasicNameValuePair;
import org.apache.hc.core5.http.NameValuePair;
import org.apache.hc.core5.http.message.BasicNameValuePair;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand Down
Loading
Loading