Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 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 .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[submodule "sdk-fraud"]
path = sdk-fraud
url = git@github.com:radarlabs/radar-lib-fraud-android.git
branch = initial-setup
Copy link

Copilot AI Jan 29, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The submodule is pinned to the 'initial-setup' branch rather than a specific commit or stable branch like 'main'. Consider whether this development branch should be used in production code, or if it should reference a more stable branch or tag.

Suggested change
branch = initial-setup
branch = main

Copilot uses AI. Check for mistakes.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we'll probably wanna commit "master"

9 changes: 9 additions & 0 deletions example/src/main/res/xml/network_security_config.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
<!-- For debugging local development server trackVerified -->
<!-- Allow connections to local development server without certificate validation -->
<!-- <domain-config cleartextTrafficPermitted="false">
<domain includeSubdomains="true">192.168.68.112</domain>
<trust-anchors>
<certificates src="system"/>
<certificates src="user"/>
</trust-anchors>
</domain-config> -->
Comment on lines +3 to +11
Copy link

Copilot AI Jan 29, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove commented-out network security configuration containing the hardcoded IP address (192.168.68.112). Even though commented out, this presents a security concern as it documents trust anchor modifications for development purposes.

Suggested change
<!-- For debugging local development server trackVerified -->
<!-- Allow connections to local development server without certificate validation -->
<!-- <domain-config cleartextTrafficPermitted="false">
<domain includeSubdomains="true">192.168.68.112</domain>
<trust-anchors>
<certificates src="system"/>
<certificates src="user"/>
</trust-anchors>
</domain-config> -->

Copilot uses AI. Check for mistakes.
<domain-config cleartextTrafficPermitted="false">
<domain includeSubdomains="true">api-verified.radar.io</domain>
<pin-set>
Expand Down
1 change: 1 addition & 0 deletions sdk-fraud
Submodule sdk-fraud added at c35e99
6 changes: 6 additions & 0 deletions sdk/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,12 @@ dependencies {
implementation "androidx.fragment:fragment:1.3.0"
compileOnly "com.huawei.hms:location:6.16.0.302"
compileOnly "com.google.android.play:integrity:1.2.0"

// Optional fraud detection module (Git submodule)
if (findProject(':sdk-fraud') != null) {
implementation project(':sdk-fraud')
}

testImplementation "androidx.test.ext:junit:1.1.5"
testImplementation "org.robolectric:robolectric:4.10"
testImplementation 'org.json:json:20211205'
Expand Down
4 changes: 4 additions & 0 deletions sdk/src/main/java/io/radar/sdk/RadarApiClient.kt
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,7 @@ internal class RadarApiClient(
expectedStateCode: String? = null,
reason: String? = null,
transactionId: String? = null,
fraudPayload: String? = null,
callback: RadarTrackApiCallback? = null
) {
val publishableKey = RadarSettings.getPublishableKey(context)
Expand Down Expand Up @@ -401,6 +402,9 @@ internal class RadarApiClient(
params.putOpt("integrityToken", integrityToken)
params.putOpt("integrityException", integrityException)
params.putOpt("encrypted", encrypted)
if (fraudPayload != null) {
params.putOpt("fraudPayload", fraudPayload)
}
if (expectedCountryCode != null) {
params.putOpt("expectedCountryCode", expectedCountryCode)
}
Expand Down
29 changes: 29 additions & 0 deletions sdk/src/main/java/io/radar/sdk/RadarApiHelper.kt
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,37 @@ import java.util.Scanner
import java.util.concurrent.Executors
import javax.net.ssl.HttpsURLConnection

// // For debugging local development server trackVerified
// import javax.net.ssl.SSLContext
// import javax.net.ssl.TrustManager
// import javax.net.ssl.X509TrustManager
// import javax.net.ssl.HostnameVerifier
// import java.security.cert.X509Certificate

internal open class RadarApiHelper(
private var logger: RadarLogger? = null
) {

private val executor = Executors.newSingleThreadExecutor()
private val handler = Handler(Looper.getMainLooper())

// // For debugging local development server trackVerified
// // Custom TrustManager that accepts all certificates
// private val trustAllCerts = arrayOf<TrustManager>(object : X509TrustManager {
// override fun getAcceptedIssuers(): Array<X509Certificate> = arrayOf()
// override fun checkClientTrusted(certs: Array<X509Certificate>, authType: String) {}
// override fun checkServerTrusted(certs: Array<X509Certificate>, authType: String) {}
// })

// // SSLContext that uses the custom TrustManager
// private val sslContext: SSLContext by lazy {
// val context = SSLContext.getInstance("TLS")
// context.init(null, trustAllCerts, java.security.SecureRandom())
// context
// }

// // Custom HostnameVerifier that accepts all hostnames
// private val hostnameVerifier = HostnameVerifier { _, _ -> true }

interface RadarApiCallback {
fun onComplete(status: Radar.RadarStatus, res: JSONObject? = null)
Expand Down Expand Up @@ -64,6 +89,10 @@ internal open class RadarApiHelper(
executor.execute {
try {
val urlConnection = url.openConnection() as HttpsURLConnection
// // For debugging local development server trackVerified
// // Configure SSL to accept any certificate and hostname
// urlConnection.sslSocketFactory = sslContext.socketFactory
// urlConnection.hostnameVerifier = hostnameVerifier
if (headers != null) {
for ((key, value) in headers) {
try {
Expand Down
Loading
Loading