Skip to content
Open
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
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Change Log

## [5.47.1](https://github.com/plivo/plivo-java/tree/v5.47.1) (2026-04-17)
**Bug Fix - PhoneNumber Compliance API**
- Fixed PhoneNumberComplianceGetter to exclude `id` from query parameters via toMap() override

## [5.47.0](https://github.com/plivo/plivo-java/tree/v5.47.0) (2026-04-08)
**Feature - PhoneNumber Compliance API support**
- Added `PhoneNumberComplianceRequirement` resource with `lister()` for discovering compliance requirements by country, number type, and user type
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.plivo</groupId>
<artifactId>plivo-java</artifactId>
<version>5.47.0</version>
<version>5.47.1</version>
<name>plivo-java</name>
<description>A Java SDK to make voice calls &amp; send SMS using Plivo and to generate Plivo XML</description>
<licenses>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.plivo.api.models.phonenumbercompliance;

import com.plivo.api.models.base.Getter;
import java.util.Map;
import retrofit2.Call;

public class PhoneNumberComplianceGetter extends Getter<PhoneNumberComplianceGetResponse> {
Expand All @@ -20,6 +21,14 @@ public PhoneNumberComplianceGetter expand(String expand) {
return this;
}

@Override
protected Map<String, Object> toMap() {
Map<String, Object> map = super.toMap();
map.remove("id");
map.remove("secondaryId");
return map;
}

@Override
protected Call<PhoneNumberComplianceGetResponse> obtainCall() {
return client().getApiService().phoneNumberComplianceGet(client().getAuthId(), id, toMap());
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/com/plivo/api/version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
5.46.7
5.47.1
26 changes: 26 additions & 0 deletions src/test/java/com/plivo/api/PhoneNumberComplianceTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import static com.plivo.api.TestUtil.loadFixture;
import static junit.framework.TestCase.assertEquals;
import static junit.framework.TestCase.assertNotNull;
import static junit.framework.TestCase.assertFalse;
import static junit.framework.TestCase.assertNull;
import static junit.framework.TestCase.assertTrue;

Expand Down Expand Up @@ -534,4 +535,29 @@ public void linkCreateVerifyRequestBodyShouldSucceed() throws Exception {
recordedRequest.getPath()
);
}

// =========================================================================
// Test 21: Getter - toMap() should NOT contain id in query parameters
// =========================================================================
@Test
public void getterShouldNotLeakIdInQueryParams() throws Exception {
String complianceId = "comp-uuid-leak-test";
expectResponse("phoneNumberComplianceGetResponse.json", 200);

PhoneNumberCompliance.getter(complianceId)
.expand("end_user")
.get();

RecordedRequest recordedRequest = server.takeRequest();
assertEquals("GET", recordedRequest.getMethod());
String path = recordedRequest.getPath();
// The URL path must contain the compliance ID
assertTrue(path.contains(
String.format("PhoneNumber/Compliance/%s/", complianceId)));
// The query string must NOT contain id= (the bug we fixed via toMap() override)
String query = path.contains("?") ? path.substring(path.indexOf("?")) : "";
assertFalse("Query string should not contain 'id=' parameter", query.contains("id="));
// expand should still be present
assertTrue(query.contains("expand=end_user"));
}
}
Loading