Repository navigation
Keep bridge call parameters and results out of release logcat - #523
Merged
shanerbaner82 merged 1 commit intoOct 11, 2026
Merged
shanerbaner82 merged 1 commit into
shanerbaner82 merged 1 commit into
Conversation
bridge_jni.cpp logged every NativePHPCall's parameter JSON and result JSON (and each NativePHPCan lookup) with LOGI, in release builds too. Bridge payloads can carry tokens, keys and user data, and logcat is readable over adb and in bug reports. Per-call tracing now goes through LOGT, which is LOGI in debug builds and compiled out when NDEBUG is defined (CMake Release/RelWithDebInfo, which Gradle uses for release builds). LOGE error lines and the one-time init lines are unchanged. A source test guards the macro and that no always-on log receives parametersJSON or resultStr. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
resources/androidstudio/app/src/main/cpp/bridge_jni.cpplogs everyNativePHPCallwithLOGI: the function name, the full parameter JSON and the full result JSON. It also logs everyNativePHPCanlookup. Nothing guards these lines, so release builds write all bridge traffic to logcat.Bridge payloads can carry tokens, keys and user data. Logcat is readable over adb and ends up in bug reports. In a release build installed from Play internal testing (installer
com.android.vending), logcat showed theParameters JSON/Result JSONlines for each bridge call. That included the full result of a Play Integrity call (the plugin's integrity-token payload), in plain text.Fix
LOGTmacro. It isLOGIin debug builds and a no-op whenNDEBUGis defined. CMake definesNDEBUGforRelease/RelWithDebInfo, which Gradle uses for release builds.NativePHPCan/NativePHPCalluseLOGT. Debug output keeps the same text at the same INFO level.LOGEerror lines (function name only, no payloads) and the one-time init lines are unchanged.Tests
tests/Unit/Support/BridgeJniLoggingTest.phpchecks:NDEBUGguard onLOGTNativePHPCan/NativePHPCallcontain noLOGIparametersJSONorresultStrThe 4 tests fail on main and pass here. Full suite: 1496 passed, 3 skipped, 4 risky (same as main).
Tested on real devices
Galaxy A54 (SM-A546U1), app on core 4.5.2 with this change:
assembleDebug):BridgeJNIstill logs every call. One launch gave 58Parameters JSON/Result JSONlines, for exampleNativeUI.Theme.Setwith its parameters andResult JSON: {}.assembleRelease): the compiledlibphp_wrapper.sono longer contains theParameters JSON/Result JSONformat strings (0 matches, against 2 and 1 in the debug.so). The error strings are still there.assembleRelease, not debuggable): one launch made 13 bridge calls, among themBiometric.Prompt,AppLock.StateandDevice.GetInfo.BridgeJNIlogged only its init and Element lines. The logcat buffer had 0Parameters JSON/Result JSONlines.Not in this PR (follow-ups)
Other native logs that also run in release builds:
PHP.clogs request cookies at INFO (HTTP_COOKIE from env: ...andParsed cookie → key = value). That includes the Laravel session cookie.php_bridge.clogs every SAPI response header at INFO (SAPI header: ...), includingSet-Cookie.BridgeRouter.swiftprint()s call parameters. That goes to stdout, which isn't in the device's unified log unless a debugger is attached.The same
LOGTpattern would cover the Android ones. I'm happy to send that separately.🤖 Generated with Claude Code