控制台中的 AngularJs 范围变量 [英] AngularJs scope variables in console

查看:27
本文介绍了控制台中的 AngularJs 范围变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道我们可以使用 batarang(chrome 扩展)和 angular.element(document.querySelector('selector')).scope() 访问范围变量

I know that we can access scope variables using batarang (chrome extension), and angular.element(document.querySelector('selector')).scope()

我能够在 angular.ioangularjs.org

但是我遇到了一个 angularJs 网站 (www.paytm.com),它也可以阻止我访问控制台中的范围变量控制器等

But I came across an angularJs website (www.paytm.com) that is able to block me from accessing scope variables in console, also controller, etc.

  1. 如何阻止用户访问范围变量?
  2. 即使我阻止,用户是否可以通过任何方式访问范围变量?
  3. 如果我阻止用户访问范围数据,我会获得额外的安全保障吗?

推荐答案

网站使用

$compileProvider.debugInfoEnabled(false)

主要任务是提高应用性能.

尽管它可以(松散地)被认为是针对 RE 的反制措施的一部分,但我严重怀疑这对于任何能够对混淆的应用程序进行逆向工程的程序员来说都是一个问题.如果您不想破坏代码库,请不要在客户端使用它.

Though it can be (loosely) considered a part of counter-measures against RE, I seriously doubt it would be a problem for any programmer that is capable of reverse-engineering an obfuscated app. If you aren't keen on compromising the codebase, don't use it on client side.

即使我屏蔽了,用户有没有办法访问范围变量?

Even if I block, is there any way that users may access the scope variables?

当然.

var scope;
angular.element(document.body).injector().invoke(function ($rootScope) {
  scope = $rootScope;
  console.log(scope);
});

或者简单地angular.reloadWithDebugInfo(),正如上面的指南所建议的那样.

Or simply angular.reloadWithDebugInfo(), as the guide above suggests.

这篇关于控制台中的 AngularJs 范围变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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