Android:通过静态变量传递值会导致安全问题吗? [英] Android: Does passing values through static variable cause securtiy issues?

查看:45
本文介绍了Android:通过静态变量传递值会导致安全问题吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

从其他技术角度关注通过静态变量传递值此处,但是我想知道是否使用静态变量作为跨所有应用程序范围的全局变量,由于 android 应用程序在独立沙箱中运行,导致安全问题或信息泄漏?

Passing values through static variables is focused from other technical perspective here, however I want to know if using static variables as global variables across all application scope, lead to security issues or information leakage since android apps are running inside standalone sandboxes?

推荐答案

你的意思是说 Intent 不如静态变量安全?

You mean Intent can be said less secure than static variables?

每当您调用 startActivity()startService()bindService()sendBroadcast() 时在 Context 上,Intent 离开您的进程,进入核心操作系统进程,然后进入包含您尝试使用的组件的任何进程.这包括调用该方法的组件与其尝试使用的组件处于同一进程中的情况.在其他条件相同的情况下,static 变量更安全,因为它不会离开进程(除非您自己这样做).

Whenever you call startActivity(), startService(), bindService(), or sendBroadcast() on a Context, the Intent leaves your process, goes to a core OS process, and then goes to whatever process contains the component you are trying to work with. That includes cases where the component calling the method is in the same process as the component it is trying to work with. All else being equal, a static variable is more secure, in that it does not leave the process (unless you do that yourself).

据我们所知,Intent 对象对于间谍是安全的.不过这方面过去也有过bug,不排除以后有bug的可能.

As far as we know, Intent objects are secure against spies. However, there have been bugs in this area in the past, and I cannot rule out the possibility of bugs in the future.

从所有应用程序范围我的意思是静态变量是共享的,应用程序中的每个人都可以看到它

from all application scope I meant static variables are shared and everybody inside application can see it

您负责应用程序中的所有代码,框架实现除外.

You are responsible for all of the code in your application, except for the framework implementation.

如果一个应用程序有多个进程,它们之间共享静态变量

if an application have several process, static variables are shared among them

没有

还是每个进程持有不同的静态变量实例?

or each process hold different instances of static variable?

是的.

这篇关于Android:通过静态变量传递值会导致安全问题吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆