【问题标题】:How to set App Transport Security in Appcelerator如何在 Appcelerator 中设置应用程序传输安全性
【发布时间】:2018-07-25 13:00:30
【问题描述】:

我正在尝试配置应用程序传输安全性,但我总是从安全扫描中收到未正确配置的响应。我正在使用适用于 iOS 的 Appcelerator SDK 7.0.1。

扫描结果:

App Transport Security
App Transport Security (ATS), which is a networking security feature that ensures network connections employ the most secure protocols and ciphers, was found to be misconfigured.

NSAllowsArbitraryLoads set YES

这是我的 tiapp.xml 的一部分

<property name="ios.whitelist.appcelerator.com" type="bool">false</property>
<ios>
    <enable-launch-screen-storyboard>true</enable-launch-screen-storyboard>
    <use-app-thinning>true</use-app-thinning>
    <plist>
        <dict>
            <key>UISupportedInterfaceOrientations~iphone</key>
            <array>
                <string>UIInterfaceOrientationPortrait</string>
            </array>
            <key>UISupportedInterfaceOrientations~ipad</key>
            <array>
                <string>UIInterfaceOrientationPortrait</string>
                <string>UIInterfaceOrientationPortraitUpsideDown</string>
            </array>
            <key>UIRequiresPersistentWiFi</key>
            <false/>
            <key>UIPrerenderedIcon</key>
            <false/>
            <key>UIStatusBarHidden</key>
            <false/>
            <key>UIStatusBarStyle</key>
            <string>UIStatusBarStyleDefault</string>
            <key>NSAppTransportSecurity</key>
            <dict>
                <key>NSAllowsArbitraryLoads</key>
                <true/>
            </dict>
        </dict>
    </plist>
</ios>

按照文档中的说明完成: http://docs.appcelerator.com/platform/latest/#!/api/Titanium.Network

我做错了什么?提前感谢您的帮助。

【问题讨论】:

    标签: titanium appcelerator titanium-mobile appcelerator-titanium nsapptransportsecurity


    【解决方案1】:

    将NSAllowsArbitraryLoads 设置为true 禁用 ATS,这意味着所有 URL 都将被允许并且没有配置限制。这是 Titanium 中默认配置的方式,以确保升级到较新 SDK 版本的应用程序的向后兼容性。它可以被覆盖以指定允许的域(白名单)或禁用NSAllowsArbitraryLoads。

    正如 Nirman 指出的那样,文档仍然不正确,所以我只是 updated them(因为我找不到前面提到的拉取请求)。

    【讨论】:

      【解决方案2】:

      我们需要将 NSAllowsArbitraryLoads 键设置为 NO 以启用 ATS 并消除安全警告。

      我认为文档是错误的。我已经在github上提交了一个CR来更新文档页面。

      【讨论】:

        猜你喜欢
        • 2016-09-19
        • 2018-05-20
        • 2016-11-11
        • 1970-01-01
        • 2016-04-09
        • 2016-04-17
        • 2015-12-17
        • 1970-01-01
        • 2016-10-23
        相关资源
        最近更新 更多