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
57 changes: 57 additions & 0 deletions .github/workflows/docs_enforcement.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: Documentation Enforcement

env:
PLATFORM: java-sdk

on:
pull_request:
branches:
- 'master'

jobs:
extract_version:
runs-on: ubuntu-latest
name: Extract release version
outputs:
version: ${{ steps.version.outputs.value }}
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '22'

- name: Get package version
id: version
run: echo "value=$(node -p -e "require('./px_metadata.json').version")" >> "$GITHUB_OUTPUT"

check_open_docs_pr:
runs-on: ubuntu-latest
name: Check for Open Docs PR
needs: extract_version
steps:
- name: Construct expected branch name
id: branch_details
run: |
VERSION=${{ needs.extract_version.outputs.version }}
BRANCH_NAME="${{ env.PLATFORM }}-${VERSION}-doc-update"
echo "Expected branch name is: $BRANCH_NAME"
echo "branch_name=$BRANCH_NAME" >> "$GITHUB_OUTPUT"

- name: Check for open PR from docs branch
env:
GH_TOKEN: ${{ secrets.CONNECT_PULL_TOKEN }}
DOCS_REPO: ${{ github.repository_owner }}/public-docs
EXPECTED_BRANCH_NAME: ${{ steps.branch_details.outputs.branch_name }}
run: |
echo "Searching for an open PR from branch '$EXPECTED_BRANCH_NAME' in repo '$DOCS_REPO'..."

if gh pr list --repo "$DOCS_REPO" --state open --base main --limit 100 --json headRefName --jq '.[].headRefName' | grep -qFx "$EXPECTED_BRANCH_NAME"; then
echo "✅ Success! Found an open PR from branch: '$EXPECTED_BRANCH_NAME'"
else
echo "❌ Failure! Could not find an open PR in '$DOCS_REPO' from a branch with the exact name: '$EXPECTED_BRANCH_NAME'"
echo "Please ensure a documentation PR has been opened against the 'main' branch before merging this release."
exit 1
fi
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Change Log

## [v6.15.0](https://github.com/PerimeterX/perimeterx-java-sdk/compare/6.15.0...HEAD) (2025-09-03)
- Added Documentation enforcement workflow - verify that the documentation is up to date with the latest changes in the codebase
- Added Telemetry by Risk support

## [v6.14.2](https://github.com/PerimeterX/perimeterx-java-sdk/compare/6.14.2...HEAD) (2025-06-15)
- Added Cross Tab Session cookie support on risk_api and async activities

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

# [PerimeterX](http://www.perimeterx.com) Java SDK

> Latest stable version: [v6.14.2](https://search.maven.org/#artifactdetails%7Ccom.perimeterx%7Cperimeterx-sdk%7C6.15.0%7Cjar)
> Latest stable version: [v6.15.0](https://search.maven.org/#artifactdetails%7Ccom.perimeterx%7Cperimeterx-sdk%7C6.15.0%7Cjar)

## Table of Contents

Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<name>PerimeterX JAVA SDK</name>
<groupId>com.perimeterx</groupId>
<artifactId>perimeterx-sdk</artifactId>
<version>6.14.2</version>
<version>6.15.0</version>

<packaging>jar</packaging>
<description>PerimeterX Java SDK</description>
Expand Down
2 changes: 1 addition & 1 deletion px_metadata.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "6.14.2",
"version": "6.15.0",
"supported_features": [
"advanced_blocking_response",
"bypass_monitor_header",
Expand Down
10 changes: 10 additions & 0 deletions src/main/java/com/perimeterx/api/PerimeterX.java
Original file line number Diff line number Diff line change
Expand Up @@ -266,11 +266,21 @@ public void pxPostVerify(ResponseWrapper response, PXContext context) throws PXE
if (response != null && !configuration.isAdditionalS2SActivityHeaderEnabled() && context.isContainCredentialsIntelligence()) {
handleAdditionalS2SActivityWithCI(response, context);
}

context.logger.sendMemoryLogs(this.configuration, context);
}
} catch (Exception e) {
context.logger.error("Failed to post verify response. Error :: ", e.getMessage());
}

// Handle telemetry separately with more specific error handling
if (context != null && context.isShouldSendTelemetry()) {
try {
activityHandler.handleEnforcerTelemetryActivity(this.configuration, UpdateReason.COMMAND, context);
} catch (Exception e) {
context.logger.error("Failed to send telemetry activity: " + e.getMessage());
}
}
}

private void handleAdditionalS2SActivityWithCI(ResponseWrapper response, PXContext context) throws PXException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ private MockPXClientFactory() {

public static PXClient createPassAllPXClient() {
return MockPXClient.builder()
.riskResponse(new RiskResponse("uuid", 0, 0, "c", null, null, "", "", "", ""))
.riskResponse(new RiskResponse("uuid", 0, 0, "c", null, null, "", "", "", "", null))
.build();
}

public static PXClient createBlockAllPXClient() {
return MockPXClient.builder()
.riskResponse(new RiskResponse("uuid", 0, 100, "c", null, null, "", "", "", ""))
.riskResponse(new RiskResponse("uuid", 0, 100, "c", null, null, "", "", "", "", null))
.build();
}
}
3 changes: 3 additions & 0 deletions src/main/java/com/perimeterx/internals/PXS2SValidator.java
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,9 @@ private void updateContextFromResponse(PXContext pxContext, RiskResponse respons
if (response.getAdditionalRiskInfo() != null) {
pxContext.setAdditionalRiskInfo(response.getAdditionalRiskInfo());
}
if (response.getTelemetryRequested() != null && response.getTelemetryRequested()) {
pxContext.setShouldSendTelemetry(true);
}
}

private boolean isResponseValid(RiskResponse response) {
Expand Down
1 change: 1 addition & 0 deletions src/main/java/com/perimeterx/models/PXContext.java
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,7 @@ public class PXContext {
private String pxhd;
private PXHDSource pxhdSource;
private boolean isMonitoredRequest;
private boolean shouldSendTelemetry = false;
private LoginData loginData;
private UUID requestId;
private Set<String> sensitiveHeaders;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ public class RiskResponse {
@JsonProperty("additional_risk_info")
private String additionalRiskInfo;

@JsonProperty("telemetry_requested")
private Boolean telemetryRequested;

@JsonCreator
public RiskResponse(@JsonProperty(value = "uuid", required = true) String uuid) {
this.uuid = uuid;
Expand Down
2 changes: 1 addition & 1 deletion src/test/java/testutils/PXClientMock.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public RiskResponse riskApiCall(PXContext pxContext) {
ObjectMapper mapper = new ObjectMapper();
ObjectNode dataEnrichment = mapper.createObjectNode();
dataEnrichment.put("cookieMonster", "ilai");
RiskResponse riskResponse = new RiskResponse("uuid", 0, this.score, "c", null, dataEnrichment, "", "", "", "");
RiskResponse riskResponse = new RiskResponse("uuid", 0, this.score, "c", null, dataEnrichment, "", "", "", "", null);
if (forceChallenge) {
riskResponse.setAction("j");
riskResponse.setActionData(new RiskResponseBody());
Expand Down
2 changes: 1 addition & 1 deletion web/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
<properties>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
<com.perimeterx.version>6.14.2</com.perimeterx.version>
<com.perimeterx.version>6.15.0</com.perimeterx.version>
</properties>

</project>
Loading