parse.com JavaScript 注册安全性
parse.com JavaScript signup security
如何防止虚假注册,因为javascript api密钥在客户端源代码中可见?我已经阅读了类级权限和 ACL,但对于注册,用户首先需要输入并保存其用户名和密码。
有人可以轻松地继续将虚假用户/数据添加到某人 parse.com 应用程序中。我知道这可能发生在其他系统上,但 parse.com,开发人员必须注意产生数据成本,而不是每秒处理请求。那么如何预防呢?当然有一些机制可以阻止这种情况,如果它 parse.com 如果他们自己的系统没有简单的方法来防止,就不应该向开发收费。
如果您尝试在浏览器中从桌面运行此 html 注册,您可以继续添加用户:-编辑
<!DOCTYPE html>
<html>
<head>
<title>Reg</title>
<script type="text/javascript" src="https://code.jquery.com/jquery-1.12.0.min.js"></script>
<script type="text/javascript" src="http://www.parsecdn.com/js/parse-1.3.5.min.js"></script>
<style type="text/css">
body {
padding-top: 20px;
padding-bottom: 40px;
}
/* Custom container */
.container-narrow {
margin: 0 auto;
max-width: 700px;
}
.container-narrow > hr {
margin: 30px 0;
}
/* Main marketing message and sign up button */
.jumbotron {
margin: 60px 0;
text-align: center;
}
.jumbotron h1 {
font-size: 72px;
line-height: 1;
}
.jumbotron .btn {
font-size: 21px;
padding: 14px 24px;
}
.marketing {
margin: 60px 0;
}
.marketing p + h4 {
margin-top: 28px;
}
</style>
<script>
Parse.initialize("Your-Application-ID they got from your app/website", "Your-Javascript-Key they got from your app/website");
//#################################################################################################
$(document).ready(function() {
Parse.User.logOut();
$("#submit").click(function(){ // capture the click
//parse
var user = new Parse.User();
user.set("username", $('input[name=username]').val());
user.set("password", $('input[name=password]').val());
user.set("email", $('input[name=email]').val());
// other fields can be set just like with Parse.Object
//user.set("phone", "415-392-0202");
user.signUp(null, {
success: function(user) {
// Hooray! Let them use the app now.
var name= user.get("username");
alert(name);
},
error: function(user, error) {
// Show the error message somewhere and let the user try again.
alert("Error: " + error.code + " " + error.message);
}
});
});
});
</script>
</head>
<body>
<div class="container-narrow">
<hr>
<div id="myTabContent" class="tab-content">
<div class="tab-pane active in" id="home">
<div class="row">
<div class="span6 offset1 well">
<legend>
<h5>Sign Up</h5>
</legend>
<input type="text" id="username" class="span6" name="username" placeholder="User ID"><br><br>
<input type="text" id="email" class="span6" name="emsil" placeholder="User Email"><br><br>
<input type="password" id="password" class="span6" name="password" placeholder="Password">
<hr>
<button type="submit" id="submit" name="submit" class="btn btn-info btn-block">Sign Up</button>
</div>
</div>
</div>
<hr>
</div>
<!-- /container -->
</body>
</html>
我通过使用添加到注册页面的谷歌 recaptcha v2 https://www.google.com/recaptcha/intro/index.html#advanced-security 并使用一些服务器端云代码解决了我们网站上的虚假注册,步骤:
-
在谷歌验证码注册您的域名,您将获得两个密钥,一个密钥站点和一个密钥。谷歌验证码仅适用于指定的域和本地主机。
- 站点密钥位于您的 HTML 中。
-
安全密钥用于在服务器云代码上与 Google 进行通信。
-
确保您使用谷歌验证码 v2
-
将站点密钥和 recaptcha 小部件集成到您的 html 中,网络上有很多关于如何做到这一点的示例。
-
当用户提交验证码时,网站会得到谷歌的回复。如果谷歌的机器学习验证码怀疑你,那么它将引发一个挑战,以证明你是一个人。
-
在您通过质询后,Google 会向您的网站发送响应令牌。
-
在 Parse 注册时,将令牌与用户详细信息一起发送到云代码。
-
在保存触发器之前的云代码中,将令牌与您的密钥一起发送给谷歌(请参阅下面的链接中的云代码)
-
谷歌将验证令牌,响应将指示令牌是有效还是无效。
请参阅以下帖子,其中我包含了服务器端所需的云云。 Parse.Com - 云代码中的HTTP方法,如何等待响应。 超级容易设置。
- 点击facebook像素跟踪注册(JS/JQUERY代码)
- 当组件准备就绪时,如何在Polymer中动态注册新属性
- 注册OpenLayers事件时,即使使用匿名函数或绑定,JavaScript关闭也会触发循环内的所有内容
- $https请求的安全性
- java,javascript签名的小程序(文件选择,ftp上传)安全性/套接字异常
- 如何在单击“提交”按钮时为“新建”窗口编写JavaScript,用“确定”和“取消”显示注册信息
- Angularamd在typescript控制器注册中
- 注册组件的非角度和角度版本
- JavaScript代码中的安全性
- 如何从已注册的事件发送 JavaScript 对象
- 不使用Grunt.initConfig()注册Grunt任务
- 使用谷歌图表将mousedown事件注册为click
- Stormpath注册页面上的社交登录
- 可以'我无法提交AJAX注册表
- 注册成功后重定向
- 模态上的输入/注册字段不起作用
- 如何在使用Passport.js和Sails.js注册后重定向到特定位置
- 注册后是否可以定义HTML5自定义元素中的生命周期回调
- 在Firefox插件中注册控制台服务侦听器
- parse.com JavaScript 注册安全性