-
Notifications
You must be signed in to change notification settings - Fork 0
release 2.0.0 #3
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
base: v2.0.0
Are you sure you want to change the base?
Conversation
|
This pull request sets up GitHub code scanning for this repository. Once the scans have completed and the checks have passed, the analysis results for this pull request branch will appear on this overview. Once you merge this pull request, the 'Security' tab will show more code scanning analysis results (for example, for the default branch). Depending on your configuration and choice of analysis tool, future pull requests will be annotated with code scanning analysis results. For more information about GitHub code scanning, check out the documentation. |
| Log.d("TAG", "onCreate: ") | ||
|
|
||
| if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { | ||
| WebView.setWebContentsDebuggingEnabled(true); |
Check failure
Code scanning / CodeQL
Android Webview debugging enabled High
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 2 months ago
To fix the problem, we need to ensure that WebView debugging is only enabled for debug builds, not for release builds. The best way is by checking if the application is marked as debuggable before enabling debugging. In Android/Kotlin, this can be done by checking the application's ApplicationInfo.flags for the FLAG_DEBUGGABLE bit. Specifically, wrap the call to WebView.setWebContentsDebuggingEnabled(true); with an if statement that only evaluates to true if the application is debuggable. This change is to be made in MyApp.kt, within the onCreate() method. Ensure imports are sufficient to access ApplicationInfo.
-
Copy modified line R7 -
Copy modified lines R18-R21
| @@ -4,6 +4,7 @@ | ||
| import android.os.Build | ||
| import android.util.Log | ||
| import android.webkit.WebView | ||
| import android.content.pm.ApplicationInfo | ||
| import io.pixelbin.galmar.sample.BuildConfig | ||
| import io.pixelbin.glamar.GlamAr | ||
| import io.pixelbin.glamar.PreviewMode | ||
| @@ -14,7 +15,10 @@ | ||
| Log.d("TAG", "onCreate: ") | ||
|
|
||
| if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { | ||
| WebView.setWebContentsDebuggingEnabled(true); | ||
| // Enable WebView debugging only for debug builds | ||
| if (0 != (applicationInfo.flags and android.content.pm.ApplicationInfo.FLAG_DEBUGGABLE)) { | ||
| WebView.setWebContentsDebuggingEnabled(true); | ||
| } | ||
| } | ||
| // Initialise SDK | ||
| GlamAr.initialize( |
release 2.0.0