-
Notifications
You must be signed in to change notification settings - Fork 200
chore: update dev with staging 09/06/25 #1007
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 42 commits
a50f6e4
ed4aff6
b811ab9
568908e
2536db7
53b8790
4d956b1
cd3671e
ef87c2a
130f192
ffc482b
7ffd52b
76c08e2
d17f1c2
9dae851
82c57a6
3156c3a
865af1f
353b57d
462c8c5
46041fd
3af32f5
867f23a
1488979
fb586af
3796823
4e49d53
779f865
265fec6
37fab14
fdfa109
e84dea8
46de8cd
99490be
60fc1f2
f4dadcb
4e53f2a
e208477
81db85f
85711e0
3627364
2c0087f
33e9d1e
32fff12
d0a24cb
ee5419c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -86,6 +86,8 @@ These guides provide comprehensive context for AI-assisted development with Chat | |
|
|
||
| We are actively looking for contributors. Please check the [open issues](https://github.com/selfxyz/self/issues) if you don't know were to start! We offer bounties for significant contributions. | ||
coderabbitai[bot] marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| > **Important:** Please open your pull request from the `staging` branch. Pull requests from other branches will be automatically closed. | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. opening from staging makes sense 👍 |
||
|
|
||
| ## Contact us | ||
|
|
||
| [Contact us](https://t.me/selfprotocolbuilder) on telegram for feedback or questions. | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -121,7 +121,7 @@ android { | |
| applicationId "com.proofofpassportapp" | ||
| minSdkVersion rootProject.ext.minSdkVersion | ||
| targetSdkVersion rootProject.ext.targetSdkVersion | ||
| versionCode 85 | ||
| versionCode 90 | ||
| versionName "2.6.4" | ||
| manifestPlaceholders = [appAuthRedirectScheme: 'com.proofofpassportapp'] | ||
|
Comment on lines
+124
to
126
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Android versionCode likely out of sync with app/version.json. AI summary indicates version.json Android build moved to 96, but Gradle uses 90. This can break Play uploads (non-monotonic versionCode). Run to confirm and align: #!/bin/bash
set -euo pipefail
echo "Gradle versionCode:"
rg -nP '^\s*versionCode\s+(\d+)' app/android/app/build.gradle
echo "version.json Android buildCode:"
jq '.android.buildCode' app/version.json
echo "If mismatched, update app/android/app/build.gradle versionCode to match version.json (or vice versa) and ensure monotonic increments."🤖 Prompt for AI Agents |
||
| externalNativeBuild { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,114 @@ | ||
| package io.tradle.nfc | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @seshanthS migrating this over to |
||
|
|
||
| import net.sf.scuba.smartcards.APDUEvent | ||
| import net.sf.scuba.smartcards.APDUListener | ||
| import net.sf.scuba.smartcards.CommandAPDU | ||
| import net.sf.scuba.smartcards.ResponseAPDU | ||
| import org.jmrtd.WrappedAPDUEvent | ||
| import android.util.Log | ||
|
|
||
| class APDULogger : APDUListener { | ||
|
|
||
| private var moduleReference: RNPassportReaderModule? = null | ||
|
|
||
| private val sessionContext = mutableMapOf<String, Any>() | ||
|
|
||
| fun setModuleReference(module: RNPassportReaderModule) { | ||
| moduleReference = module | ||
| } | ||
|
|
||
| fun setContext(key: String, value: Any) { | ||
| sessionContext[key] = value | ||
| } | ||
|
|
||
| fun clearContext() { | ||
| sessionContext.clear() | ||
| } | ||
|
|
||
| override fun exchangedAPDU(event: APDUEvent) { | ||
| try { | ||
| val entry = createLogEntry(event) | ||
|
|
||
| logToAnalytics(entry) | ||
|
|
||
| } catch (e: Exception) { | ||
| Log.e("APDULogger", "Error exchanging APDU", e) | ||
| } | ||
| } | ||
|
|
||
| private fun createLogEntry(event: APDUEvent): APDULogEntry { | ||
| val command = event.commandAPDU | ||
| val response = event.responseAPDU | ||
| val timestamp = System.currentTimeMillis() | ||
|
|
||
| val entry = APDULogEntry( | ||
| timestamp = timestamp, | ||
| commandHex = command.bytes.toHexString(), | ||
| responseHex = response.bytes.toHexString(), | ||
| statusWord = response.sw, | ||
| statusWordHex = "0x${response.sw.toString(16).uppercase().padStart(4, '0')}", | ||
| commandLength = command.bytes.size, | ||
| responseLength = response.bytes.size, | ||
| dataLength = response.data.size, | ||
| isWrapped = event is WrappedAPDUEvent, | ||
| plainCommandHex = if (event is WrappedAPDUEvent) event.plainTextCommandAPDU.bytes.toHexString() else null, | ||
| plainResponseHex = if (event is WrappedAPDUEvent) event.plainTextResponseAPDU.bytes.toHexString() else null, | ||
| plainCommandLength = if (event is WrappedAPDUEvent) event.plainTextCommandAPDU.bytes.size else null, | ||
| plainResponseLength = if (event is WrappedAPDUEvent) event.plainTextResponseAPDU.bytes.size else null, | ||
| plainDataLength = if (event is WrappedAPDUEvent) event.plainTextResponseAPDU.data.size else null, | ||
| context = sessionContext.toMap() | ||
| ) | ||
|
|
||
| return entry | ||
| } | ||
|
|
||
| private fun ByteArray.toHexString(): String { | ||
| return joinToString("") { "%02X".format(it) } | ||
| } | ||
|
|
||
| private fun logToAnalytics(entry: APDULogEntry) { | ||
| try { | ||
| val params = mutableMapOf<String, Any>().apply { | ||
| put("timestamp", entry.timestamp) | ||
| put("command_hex", entry.commandHex) | ||
| put("response_hex", entry.responseHex) | ||
| put("status_word", entry.statusWord) | ||
| put("status_word_hex", entry.statusWordHex) | ||
| put("command_length", entry.commandLength) | ||
| put("response_length", entry.responseLength) | ||
| put("data_length", entry.dataLength) | ||
| put("is_wrapped", entry.isWrapped) | ||
| put("context", entry.context) | ||
|
|
||
| entry.plainCommandHex?.let { put("plain_command_hex", it) } | ||
| entry.plainResponseHex?.let { put("plain_response_hex", it) } | ||
| entry.plainCommandLength?.let { put("plain_command_length", it) } | ||
| entry.plainResponseLength?.let { put("plain_response_length", it) } | ||
| entry.plainDataLength?.let { put("plain_data_length", it) } | ||
| } | ||
|
|
||
| moduleReference?.logAnalyticsEvent("nfc_apdu_exchange", params) | ||
|
|
||
|
Comment on lines
+69
to
+91
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do not send raw APDU payloads to analytics (PII leakage, high risk). command_hex/response_hex and “plain” fields can contain MRZ/DG1/DG2 and other sensitive data. Shipping these off-device violates least-privilege and may breach privacy/compliance. Log only safe metadata (timestamp, SW, lengths, wrapped flag, minimal header bytes), and gate any content logging behind an explicit debug-only flag with size caps and redaction. @@ class APDULogger : APDUListener {
- private fun logToAnalytics(entry: APDULogEntry) {
+ private var enableSensitiveApduLogging: Boolean = false
+ fun setSensitiveApduLoggingEnabled(enabled: Boolean) { enableSensitiveApduLogging = enabled }
+
+ private fun logToAnalytics(entry: APDULogEntry) {
try {
- val params = mutableMapOf<String, Any>().apply {
+ val params = mutableMapOf<String, Any>().apply {
put("timestamp", entry.timestamp)
- put("command_hex", entry.commandHex)
- put("response_hex", entry.responseHex)
put("status_word", entry.statusWord)
put("status_word_hex", entry.statusWordHex)
put("command_length", entry.commandLength)
put("response_length", entry.responseLength)
put("data_length", entry.dataLength)
put("is_wrapped", entry.isWrapped)
put("context", entry.context)
-
- entry.plainCommandHex?.let { put("plain_command_hex", it) }
- entry.plainResponseHex?.let { put("plain_response_hex", it) }
- entry.plainCommandLength?.let { put("plain_command_length", it) }
- entry.plainResponseLength?.let { put("plain_response_length", it) }
- entry.plainDataLength?.let { put("plain_data_length", it) }
+ // Optional, debug-only: include minimal headers and cap size
+ if (enableSensitiveApduLogging) {
+ put("command_header_hex", entry.commandHex.take(8)) // CLA+INS+P1+P2
+ put("response_header_hex", entry.responseHex.take(2)) // SW1 (best-effort)
+ }
}
moduleReference?.logAnalyticsEvent("nfc_apdu_exchange", params)
} catch (e: Exception) {
Log.e("APDULogger", "Error logging to analytics", e)
}
}
@@
-data class APDULogEntry(
+data class APDULogEntry(
val timestamp: Long,
- val commandHex: String,
- val responseHex: String,
+ val commandHex: String, // retained in-memory; not sent unless debug flag
+ val responseHex: String, // retained in-memory; not sent unless debug flag
val statusWord: Int,
val statusWordHex: String,
val commandLength: Int,
val responseLength: Int,
val dataLength: Int,
val isWrapped: Boolean,
- val plainCommandHex: String?,
- val plainResponseHex: String?,
- val plainCommandLength: Int?,
- val plainResponseLength: Int?,
- val plainDataLength: Int?,
+ val plainCommandHex: String?, // never sent to analytics
+ val plainResponseHex: String?, // never sent to analytics
+ val plainCommandLength: Int?,
+ val plainResponseLength: Int?,
+ val plainDataLength: Int?,
val context: Map<String, Any>
)Follow-up:
Also applies to: 98-114, 39-63 |
||
| } catch (e: Exception) { | ||
| Log.e("APDULogger", "Error logging to analytics", e) | ||
| } | ||
| } | ||
| } | ||
|
|
||
| data class APDULogEntry( | ||
| val timestamp: Long, | ||
| val commandHex: String, | ||
| val responseHex: String, | ||
| val statusWord: Int, | ||
| val statusWordHex: String, | ||
| val commandLength: Int, | ||
| val responseLength: Int, | ||
| val dataLength: Int, | ||
| val isWrapped: Boolean, | ||
| val plainCommandHex: String?, | ||
| val plainResponseHex: String?, | ||
| val plainCommandLength: Int?, | ||
| val plainResponseLength: Int?, | ||
| val plainDataLength: Int?, | ||
| val context: Map<String, Any> | ||
| ) | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@remicolin migrated your changes over