misc 0.6.9 improvements - #1359
Conversation
Support trimming a configured path prefix and function name before rule matching and outbound URL construction, with host-module Terraform wiring on AWS and GCP. Co-authored-by: Cursor <cursoragent@cursor.com>
There was a problem hiding this comment.
Claude Code Review
Claude Code Review is paused for this repository. To reconnect it, an admin of this repository's GitHub organization (or the account owner, for personal repositories) who can also manage your Claude organization's Code Review settings needs to re-link GitHub in Code Review settings. This is a one-time step.
Tip: disable this comment in your organization's Code Review settings.
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
There was a problem hiding this comment.
Pull request overview
Adds API-mode request path normalization to support deployments behind a fixed inbound base path, makes allowedQueryParams checks case-insensitive, and updates OpenNLP model-download behavior to be skipped by default (with CI explicitly enabling downloads).
Changes:
- Introduces
REQUEST_PATH_PREFIX_TO_TRIM(config + Terraform wiring) and normalizes inbound paths for both rule-matching and outbound target URL construction. - Makes
allowedQueryParamsenforcement case-insensitive and documents the behavior. - Sets OpenNLP model download to skipped by default in Maven, removing now-redundant flags from scripts and updating CI to opt-in.
Reviewed changes
Copilot reviewed 30 out of 30 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| tools/release/generate-sbom.sh | Removes explicit OpenNLP skip flags relying on new default behavior. |
| tools/lib/maven-local-repo.sh | Removes documentation of PSOXY_SKIP_OPENNLP (no longer used). |
| tools/build.sh | Removes PSOXY_SKIP_OPENNLP plumbing and related Maven flags. |
| java/pom.xml | Sets <skipOpenNlpModelDownload> default to true. |
| java/impl/gcp/src/main/java/co/worklytics/psoxy/CloudFunctionRequest.java | Stops stripping function name in adapter; defers to shared normalizer/handler logic. |
| java/gateway-core/src/test/java/com/avaulta/gateway/rules/augments/SentenceMetadataProcessorTest.java | Updates guidance text to reflect new default skip behavior. |
| java/gateway-core/src/main/java/com/avaulta/gateway/rules/Endpoint.java | Clarifies allowed query params are matched case-insensitively. |
| java/core/src/test/java/co/worklytics/test/TestModules.java | Adds mock config for new requestPathPrefixToTrim config getter. |
| java/core/src/test/java/co/worklytics/psoxy/storage/impl/BulkDataSanitizerImplTest.java | Adds HostEnvironment module to satisfy new injection dependency. |
| java/core/src/test/java/co/worklytics/psoxy/rules/RulesBaseTestCase.java | Adds HostEnvironment module to satisfy new injection dependency. |
| java/core/src/test/java/co/worklytics/psoxy/impl/SanitizerUtilsTest.java | Adds HostEnvironment module to satisfy new injection dependency. |
| java/core/src/test/java/co/worklytics/psoxy/impl/RESTApiSanitizerImplTest.java | Adds coverage for path normalization and case-insensitive allowed query params. |
| java/core/src/test/java/co/worklytics/psoxy/impl/RESTApiSanitizerImplConcurrencyTest.java | Adds HostEnvironment module to satisfy new injection dependency. |
| java/core/src/test/java/co/worklytics/psoxy/gateway/InboundRequestPathNormalizerTest.java | New unit tests for inbound path prefix trimming and function-name stripping. |
| java/core/src/test/java/co/worklytics/psoxy/gateway/impl/ApiDataRequestHandlerTest.java | Adds HostEnvironment module to satisfy new injection dependency. |
| java/core/src/test/java/co/worklytics/psoxy/gateway/impl/ApiDataRequestHandlerConcurrencyTest.java | Adds HostEnvironment module to satisfy new injection dependency. |
| java/core/src/test/java/co/worklytics/psoxy/gateway/ApiModeConfigTest.java | Adds coverage for new REQUEST_PATH_PREFIX_TO_TRIM config property parsing. |
| java/core/src/main/java/co/worklytics/psoxy/impl/RESTApiSanitizerImpl.java | Implements case-insensitive allowed query param checks; adds shared path normalization before rule matching. |
| java/core/src/main/java/co/worklytics/psoxy/gateway/InboundRequestPathNormalizer.java | New shared path normalizer to trim configured prefix and function-name segment. |
| java/core/src/main/java/co/worklytics/psoxy/gateway/impl/ApiDataRequestHandler.java | Uses shared normalizer when constructing the outbound upstream URL. |
| java/core/src/main/java/co/worklytics/psoxy/gateway/ApiModeConfig.java | Adds REQUEST_PATH_PREFIX_TO_TRIM property and accessor. |
| infra/modules/psoxy-package/build.sh | Removes explicit OpenNLP skip flags relying on new default behavior. |
| infra/modules/gcp-host/variables.tf | Adds api_connector_path_prefix_to_trim variable for GCP host module. |
| infra/modules/gcp-host/main.tf | Wires REQUEST_PATH_PREFIX_TO_TRIM env var into API connectors (GCP). |
| infra/modules/aws-host/variables.tf | Adds api_connector_path_prefix_to_trim variable for AWS host module. |
| infra/modules/aws-host/main.tf | Wires REQUEST_PATH_PREFIX_TO_TRIM env var into API connectors (AWS). |
| docs/configuration/api-data-sanitization.md | Documents case-insensitive allowedQueryParams behavior. |
| CHANGELOG.md | Adds 0.6.9 note for case-insensitive allowedQueryParams. |
| AGENTS.md | Adds agent guidance on DI preference and config property placement. |
| .github/workflows/build-java.yaml | Forces OpenNLP model download in CI compile/test steps. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| import javax.inject.Inject; | ||
| import lombok.NoArgsConstructor; | ||
| import org.apache.commons.lang3.StringUtils; | ||
|
|
||
| /** | ||
| * Normalizes inbound HTTP paths for API-mode rule matching and outbound URL construction. | ||
| * | ||
| * <p>Strips an optional configured path prefix ({@link ApiModeConfig.ApiModeConfigProperty#REQUEST_PATH_PREFIX_TO_TRIM}), | ||
| * then removes the deployed function name segment ({@link HostEnvironment#getInstanceId()}). | ||
| */ | ||
| @NoArgsConstructor(onConstructor_ = @Inject) | ||
| public class InboundRequestPathNormalizer { | ||
|
|
||
| @Inject | ||
| ApiModeConfig apiModeConfig; | ||
| @Inject | ||
| HostEnvironment hostEnvironment; | ||
|
|
||
| public String normalize(String rawPath) { | ||
| String path = apiModeConfig.getRequestPathPrefixToTrim() | ||
| .map(prefix -> stripLeadingPathPrefix(rawPath, prefix)) | ||
| .orElse(rawPath); | ||
| String functionName = hostEnvironment.getInstanceId(); | ||
| if (StringUtils.isNotBlank(functionName)) { | ||
| path = path.replace(functionName + "/", ""); | ||
| } | ||
| return path; | ||
| } |
| working-directory: java/ | ||
| run: | | ||
| mvn clean compile -T 2C -Dversions.logOutput=false | ||
| mvn clean compile -T 2C -Dversions.logOutput=false -DskipOpenNlpModelDownload=false |
There was a problem hiding this comment.
it should skip by default; and we should need to download ONLY when it's running tests that use NLP transforms in CI.
Add Dependabot config for /java and publish resolved transitive deps on main/rc pushes so GitHub can surface Maven CVEs; bump single-JDK workflows to JDK 25 while pom.xml remains Java 21. Co-authored-by: Cursor <cursoragent@cursor.com>
|
|
||
| ## [Unreleased] | ||
| ## [0.6.9] | ||
| - `allowedQueryParams` rule checks are now case-insensitive (e.g., `$top` and `$TOP` are treated as equivalent). |
There was a problem hiding this comment.
Thanks, forgot to include this
| working-directory: java/ | ||
| run: | | ||
| mvn clean compile -T 2C -Dversions.logOutput=false | ||
| mvn clean compile -T 2C -Dversions.logOutput=false -DskipOpenNlpModelDownload=false |
- Strip function-name path segment only when leading, including bare /functionName - Quote target host path literals before regex stripping in rule matching - Download OpenNLP models only during CI test step, not compile Co-authored-by: Cursor <cursoragent@cursor.com>
Resolve additive conflicts: combine 0.6.9 changelog entries, keep both api_connector_path_prefix_to_trim and external_api_alb variables, and retain allMatch-based case-insensitive allowedQueryParams check. Co-authored-by: Cursor <cursoragent@cursor.com>
Features
REQUEST_PATH_PREFIX_TO_TRIMso API connectors can strip a configured inbound path prefix before routing requests to the upstream API. This supports deployments where clients hit the proxy under a fixed base path that should not be forwarded downstream.Change implications
CHANGELOG.mdanything that will show up interraform plan/applythat isn't obviously a no-op?REQUEST_PATH_PREFIX_TO_TRIM; no Terraform plan/apply impact unless explicitly configured.alpha, requires major version change