当更新版本提交到 Google Play 商店时,我们被要求对我们的 React Native 应用程序进行更改。突出显示的问题是“意图重定向”漏洞。这是遗留代码,但尽管如此,迟到总比不到好。
Google 帮助指南中建议的方法之一是:
选项 2:确保提取的 Intent 来自可信赖的来源。
您可以使用 >getCallingActivity 之类的方法来验证是否可以信任发起的 Activity。例如:
// check if the originating Activity is from trusted package
if (getCallingActivity().getPackageName().equals(“known”)) {
Intent intent = getIntent();
// extract the nested Intent
Intent forward = (Intent) intent.getParcelableExtra(“key”);
// redirect the nested Intent
startActivity(forward);
}
Run Code Online (Sandbox Code Playgroud)
根据本指南更改代码时,构建显示了getCallingActivity一个未知符号的错误。代码已经使用getCurrentActivity和getApplicationContext。
我们在 React Native 应用程序中纠正本机 Java 代码中的这个漏洞的最佳方法是什么?
将深深感谢您在这里的快速支持。谢谢!
android google-play react-native android-security react-native-android
我试图使用 apktool (apktool-2.1.1) 重建一个 apk。
遇到错误
i) 找不到与给定名称“@android:style/Animation.OptionsPanel”匹配的资源
ii) 没有找到与给定名称 '@android:style/Animation.LockScreen' 匹配的资源
错误消息:
I: Using Apktool 2.1.1
I: Copying /home/workspace/debug/app-demo-release classes.dex file...
I: Building resources...
W: /home/workspace/debug/app-demo-release/res/values-v24/styles.xml:7: error: Error retrieving parent for item: No resource found that matches the given name '@android:style/Animation.OptionsPanel'.
W:
W: /home/workspace/debug/app-demo-release/res/values-v24/styles.xml:8: error: Error retrieving parent for item: No resource found that matches the given name '@android:style/Animation.LockScreen'.
W:
Exception in thread "main" brut.androlib.AndrolibException: brut.androlib.AndrolibException: brut.common.BrutException: could not exec (exit code = 1): [/tmp/brut_util_Jar_1478810839657812213.tmp, p, --forced-package-id, 127, --min-sdk-version, …Run Code Online (Sandbox Code Playgroud) 公共静态 String getDeviceID(Context mContext) {
String deviceId = Settings.Secure.getString(mContext.getContentResolver(),
Settings.Secure.ANDROID_ID);
return deviceId;
}
Run Code Online (Sandbox Code Playgroud)
这显示了安全警告,
“不建议使用‘getString’来获取设备标识符”
如何解决这个警告?
我们正在构建完全离线的商业电子学习应用程序。我们必须在应用程序本地存储一些重要的视频,我们不希望通过提取 apk 来窃取这些视频。
有没有什么好的方法可以在本机 android 或 React-native 上通过加密/解密或密码保护等来实现这一目标。
我们正在尝试各种解决方案,但您提出的更好的方法将帮助我们节省时间和学习。
我正在开发一个主要使用本机语言编写并支持Ice Cream Sandwich的应用程序。但是,我需要添加一些WebView。关于WebView安全性的讨论很多,当我使用setJavaScriptEnabled(true)时,它会向我发出警告:“使用setJavaScriptEnabled会将XSS漏洞引入您的应用程序中,请仔细检查。”
只是要非常小心使用WebView和setJavaScriptEnable(true)。我遵循了Android WebView安全提示和建议。但是没有最佳实践检查表。
到目前为止,我所做的是:
通过实施拦截来自WebView的所有请求
webView.setWebViewClient(new WebViewClient() {
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
// magic
return true;
}
});
Run Code Online (Sandbox Code Playgroud)还有一些其他不是专门针对WebView的保护,例如加密消息和越狱检查等。
还有什么我想念的吗?我的应用程序有多安全?
谢谢
前奏:
客户想要为其所有者的设备安装 EMM。有时用户希望将该设备用作工作设备(仅限出租车和快递应用程序),有时用户希望将该设备用作自己的设备(安装游戏、社交应用程序和自己的 Google 帐户)。
情况:
客户希望将其 gsuite 帐户存储在FRP 存储中(以便能够在员工离开组织时解锁手机),但不希望员工在 FR 输入其个人帐户凭据后解锁手机。
例子:
我以编程方式添加了两个工作帐户(如此处所述)。但用户拿到手机后,他进入了自己的个人 Gmail 帐户来使用 Gmail 和其他应用程序。我如何以编程方式或通过 DPC 应用程序阻止用户在恢复出厂设置后使用其个人帐户恢复对手机的访问?
在我的应用程序中,我需要传递client_id和client_secret来进行 API 调用。
在 Android 应用程序上存储client_id和client_secret最安全的方法是什么?
我读过有关SharedPreferences 的内容,我确信它们不安全。另请阅读有关密钥库的信息,但不确定这是否是正确的方法。您能否建议存储此类信息最安全的方式是什么?
谢谢R
如何将android密钥库签名算法名称:SHA1withRSA(弱)更新为强密钥
Signature algorithm name: SHA1withRSA (weak)
Subject Public Key Algorithm: 1024-bit RSA key (weak)
Version: 3
Warning:
The certificate uses the SHA1withRSA signature algorithm which is considered a security risk. This algorithm will be disabled in a future update.
The certificate uses a 1024-bit RSA key which is considered a security risk. This key size will be disabled in a future update.
Run Code Online (Sandbox Code Playgroud) 我们正在开发实时流媒体视频应用程序。
所以我们需要为音频和视频内容提供安全保障。
我的尝试
我可以在以下代码的帮助下限制屏幕截图和视频内容
activity.getWindow().setFlags(WindowManager.LayoutParams.FLAG_SECURE, WindowManager.LayoutParams.FLAG_SECURE);
但我无法通过其他应用程序限制录音。
如何限制其他应用的录音?
代码startActivity(intent.createChooser(shareIntentWithJpgFileName))在我的应用程序中运行良好多年,但我注意到大约一个月前它不再将图像文件传递给用户在选择器对话框中选择的应用程序.我怀疑Android操作系统安全改组(再次!),但不知道如何继续.
如果用户在选择器对话框中选择任意数量的选项,则应用程序将打开,但不会显示该.jpg部分是意图的一部分.如果用户选择Google云端硬盘,我会通过它的吐司得到一个错误的提示:
上传失败:请求中不包含任何数据
String fileName = data.getStringExtra(EXTRA_FILENAME);
Log.v(TAG, "Starting Share intent. fileName: " + fileName); //This shows fileName: /storage/emulated/0/dcim/DalesApp/IMG_20190103_142555_8445288886207383328.jpg
Intent shareIntentWithJpgFileName = new Intent(Intent.ACTION_SEND);
shareIntentWithJpgFileName.setType("image/jpeg");
File filePassedIn = new File(fileName);
Log.v(TAG, "exists: " + filePassedIn.exists() + " canRead: " + filePassedIn.canRead()); // Result is exists: true canRead: true. Thanks Mark!
shareIntentWithJpgFileName.putExtra(MediaStore.EXTRA_OUTPUT, FileProvider.getUriForFile(this, BuildConfig.APPLICATION_ID + ".provider", filePassedIn));
shareIntentWithJpgFileName.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
startActivity(Intent.createChooser(shareIntentWithJpgFileName, "Share Image"));
Run Code Online (Sandbox Code Playgroud)
另外,我将此作为以下内容的一部分AndroidManifest.xml:
<provider
android:name="android.support.v4.content.FileProvider"
android:authorities="${applicationId}.provider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/provider_paths"/>
</provider>
Run Code Online (Sandbox Code Playgroud)
这也是在AndroidManifest.xml …
android ×10
android-security ×10
react-native ×2
assets ×1
google-play ×1
java ×1
kotlin ×1
rsa ×1
security ×1
sha1 ×1
webview ×1
xss ×1