简体   繁体   English

Swift / iOS8:仅允许某些键盘

[英]Swift/iOS8: allow only certain keyboards

How can I deny certain keyboards to be displayed in iOS8? 如何拒绝某些键盘在iOS8中显示?

The actual case is that Users can make a REST Call in my Search Field - should they switch to the Emoji keyboard and send them, Alamofire will crash, not recognizing the Input --> subsequently my App crashes. 实际情况是用户可以在我的搜索字段中进行REST调用-如果他们切换到Emoji键盘并发送给他们,Alamofire将崩溃,无法识别输入->随后我的应用程序崩溃。

Rule 1 in security: 安全规则1:

Never Trust User Input 永不信任用户输入

Filter the input. 过滤输入。 You can not trust the user's input even after denying some keyboards. 即使拒绝了某些键盘,您也无法信任用户的输入。

You may want to use a regex for the filtering. 您可能要使用正则表达式进行过滤。

Side note: You will have to do the filtering on the server side too. 旁注:您也必须在服务器端进行过滤。 Your API may be called from an other location. 您的API可能会从其他位置调用。 Potentially, that's a huge security issue. 潜在地,这是一个巨大的安全问题。 Hackers can do some nasty things if you don't filter your parameters. 如果您不过滤参数,黑客可能会做一些令人讨厌的事情。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM