Configuring App Transport Security Exceptions in iOS 9 and OSX 10.11

2023-10-29

What is App Transport Security (ATS)?

At WWDC 2015, Apple announced “App Transport Security” for iOS 9 and OSX 10.11 El Capitan. The “What’s New in iOS” guide for iOS 9 explains:

App Transport Security (ATS) lets an app add a declaration to its Info.plist file that specifies the domains with which it needs secure communication. ATS prevents accidental disclosure, provides secure default behavior, and is easy to adopt. You should adopt ATS as soon as possible, regardless of whether you’re creating a new app or updating an existing one.

If you’re developing a new app, you should use HTTPS exclusively. If you have an existing app, you should use HTTPS as much as you can right now, and create a plan for migrating the rest of your app as soon as possible.

In simple terms, this means that if your application attempts to connect to any HTTP server (in this example, yourserver.com) that doesn’t support the latest SSL technology (TLSv1.2), your connections will fail with an error like this:

CFNetwork SSLHandshake failed (-9801)
Error Domain=NSURLErrorDomain Code=-1200 "An SSL error has occurred and a secure connection to the server cannot be made." UserInfo=0x7fb080442170 {NSURLErrorFailingURLPeerTrustErrorKey=<SecTrustRef: 0x7fb08043b380>, NSLocalizedRecoverySuggestion=Would you like to connect to the server anyway?, _kCFStreamErrorCodeKey=-9802, NSUnderlyingError=0x7fb08055bc00 "The operation couldn’t be completed. (kCFErrorDomainCFNetwork error -1200.)", NSLocalizedDescription=An SSL error has occurred and a secure connection to the server cannot be made., NSErrorFailingURLKey=https://yourserver.com, NSErrorFailingURLStringKey=https://yourserver.com, _kCFStreamErrorDomainKey=3}

Curiously, you’ll notice that the connection attempts to change the http protocol to https to protect against mistakes in your code where you may have accidentally misconfigured the URL. In some cases, this might actually work, but it’s also confusing.

WARNING: ATS is good for you and your users and you shouldn’t disable it!

The reason why Apple is pushing so aggressively to force secure connections is because it’s the right thing to do. Protecting personal data from being compromised over insecure wireless connections, among other things, is great for users. Just because these exceptions exist doesn’t mean you should actually use them.

If your application is connecting to third party APIs that you can’t control (such as in my case, where my application Routesy connects to public transit APIs that don’t yet support SSL) or serving as a means to load syndicated content (a browser or a news reader, for instance), these techniques might be useful to you.

The bottom line is, if you run your own API server, FIX YOUR SSL. Thanks to Dave DeLong for reminding me that I should clarify that disabling ATS is a bad idea.

That being said…

How to Bypass App Transport Security

Unfortunately, the pre-release documentation doesn’t currently include any references to this key, so many developers who are testing their preexisting apps with the new betas have been receiving this error and aren’t sure what to do about it. Thanks to some digging through the strings in the CFNetwork executable bundled with Xcode 7, I was able to find the keys necessary to configure your Info.plist.

Per-Domain Exceptions

To configure a per-domain exception so that your app can connect to a non-secure (or non TLSv1.2-enabled secure host), add these keys to your Info.plist (and note that Xcode doesn’t currently auto-complete these keys as of the first Xcode 7 beta seed):

<key>NSAppTransportSecurity</key>
<dict>
  <key>NSExceptionDomains</key>
  <dict>
    <key>yourserver.com</key>
    <dict>
      <!--Include to allow subdomains-->
      <key>NSIncludesSubdomains</key>
      <true/>
      <!--Include to allow HTTP requests-->
      <key>NSTemporaryExceptionAllowsInsecureHTTPLoads</key>
      <true/>
      <!--Include to specify minimum TLS version-->
      <key>NSTemporaryExceptionMinimumTLSVersion</key>
      <string>TLSv1.1</string>
    </dict>
  </dict>
</dict>

But What If I Don’t Know All the Insecure Domains I Need to Use?

If your app (a third-party web browser, for instance) needs to load arbitrary content, Apple provides a way to disable ATS altogether, but I suspect it’s wise for you to use this capability sparingly:

<key>NSAppTransportSecurity</key>
<dict>
  <!--Include to allow all connections (DANGER)-->
  <key>NSAllowsArbitraryLoads</key>
      <true/>
</dict>
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

Configuring App Transport Security Exceptions in iOS 9 and OSX 10.11 的相关文章

  • sizeWithFont:constrainedToSize:lineBreakMode:不准确?

    sizeWithFont constrainedToSize lineBreakMode 似乎没有给我返回正确的宽度 执行这些代码后 我看到标签中的部分字符串被切断 这意味着我必须手动添加一些像素到大小 我错过了什么吗 我有一个 UILab
  • iOS 中tableview 的动态搜索

    I ve a tableview和我实现搜索方法的文本字段 现在 当我在其中写入一些值时textfield然后点击搜索按钮 然后在tableview 但是 我希望它是动态的 意味着我开始输入的那一刻textfield它应该开始搜索而不点击任
  • 如何在 iPhone 应用程序中运行进程而不阻塞用户界面

    我正在 iPhone 上访问照片库 需要很长时间才能导入我在应用程序中选择的图片 如何在辅助线程上运行该进程 或者我应该使用什么解决方案来不阻塞用户界面 我在这里使用 PerformSelectOnBackground 或 GCD 对示例代
  • 为什么UICollectionViewCell的outlet为nil?

    我在 Interface Builder 中创建了一个自定义 UICollectionViewCell 将其上的视图绑定到类 然后当我想使用字符串并将其设置为字符串上的标签时 该标签具有 nil 值 override func viewDi
  • 如何解决 Xcode 7 中的 No Type or Protocol Named 错误?

    我试图passing从第二个开始的值class我正在使用的头等舱protocol and delegate过程 每当我运行我的程序时 我都会遇到以下问题 No Type or Protocol Named locateMeDelegate
  • 增加uitableviewcell高度同时增加内部UITextView

    我创建一个UITableView与不同类型的UITableViewCell取决于要显示的内容类型 其中之一是UITableViewCell里面有一个UITextView以这种方式以编程方式创建 UITableViewCell tableVi
  • 使用 PHP 发送器和 Swift 在后台未收到 IOS GCM 推送通知

    我正在努力让后台通知在带有 GCM 的 IOS 上工作 非后台通知已经可以工作了 以下是我集成后台通知的步骤 在 UIBackgroundmodes 中启用远程通知标签 将内容可用密钥添加到我的通知负载中 在我的委托中编写 applicat
  • UITableView - 节标题。如何更改文字?

    我有一个使用故事板的项目 我有一个带有静态单元格和组样式的 UITableView 我需要根据分段控件 在另一部分中 中所做的选择来更改一个部分中的部分文本 我找到了一些解决方案 表明您应该使用覆盖此方法 NSString tableVie
  • 在 XMPPFrameWork ios 中将 XMPPMessage 保存在 CoreData 中

    我正在开发一个聊天应用程序并使用 xmppframework 现在需要将消息存储在持久存储中 谁能告诉我如何在 IOS 中从 CoreData 存储和检索消息 由于您使用的是 github robbiehanson XMPPFramewor
  • 将自动布局约束应用于多个对象

    我正在 iOS 中使用 autoLayout 约束 我的用例是这样的 我会用图片更好地解释 我正在为 UITableViewCell 使用自定义单元格 通过自动布局 我为下面的文本和分隔线设置了约束 并且它们遵守自动布局约束 现在您可以看到
  • Jenkins 上的 XCode 项目陷入“codesign”

    我使用 Jenkins 与 XCode 插件进行持续集成 有一个 Jenkins 坚持的项目 usr bin codesign force sign 接下来是旋转器 永远旋转 我以前从未见过这个 以前有人见过这个吗 是配置文件问题还是证书问
  • 如何制作抗崩溃的ios应用程序

    我现在正在编写 ios 应用程序一段时间 但我的应用程序仍然经常崩溃 并且需要时间才能使它们变得非常稳定 我觉得这很烦人 那么 有没有关于防崩溃编程ios应用程序的编程模式呢 打开编译器警告 删除所有警告 运行静态分析器 删除所有警告 使用
  • UISlider 拇指中心位于轨道的起点和终点

    默认行为UISlider是它的拇指没有集中在轨道的开始 结束处 就像下面这样 我想修改它的行为以获得 拇指的中心可以位于起点或终点 我试图用空来覆盖开始 结束UIView 效果是看起来几乎没问题 但是拇指有阴影 显示了我在某些位置的黑客攻击
  • IOS Box2D - 身体遵循基于速度波动的点数组的特定路径

    我有一个关于身体的问题 它遵循特定的路径 首先是将身体移动到目标点的方法 const float destinationControl 0 3f b2Vec2 targetPosition path counter b2Vec2 missi
  • GoogleMaps iOS SDK 1.5 无法加载

    所以我开始研究使用 GoogleMaps iOS SDK 我按照说明进行操作 在控制台中启用适用于 iOS 的 Google Maps SDK 设置 API 密钥并添加捆绑 ID 我使用演示项目 Google Supplies 更新了常量
  • 使用您正在散列的内容的散列作为盐?

    假设用户注册了您的网站 您对他们选择的密码进行哈希处理 然后使用该哈希值作为盐 并使用该盐重新哈希其密码 Example String hash1 MD5 password String endHash MD5 hash1 password
  • UIPopoverBackgroundView contentViewInsets 必须由子类实现

    我正在实现一个自定义 PopoverBackgroundView 并按照指定斯威夫特文档 https developer apple com library ios documentation UIKit Reference UIPopov
  • 在 iOS 7 中创建 UUID 和 UDID

    我想创建 UUID 我下面有可以创建 UUID 的代码 如何在 iOS7 中创建具有多个供应商相同 ID 的 UDID NSString stringWithNewUUID CFUUIDRef uuidObj CFUUIDCreate ni
  • 在 NSData 和 base64 字符串之间转换

    在之间进行转换的最简单和最快的代码是什么NSData和一个base64字符串 我读过很多解决方案 其中大部分涉及添加另一个类等 我找到了一个很好的解决方案here http cocoawithlove com 2009 06 base64
  • 如何将react-native与php一起使用并获取返回数据始终为空

    我的回报始终为空 我似乎无法让它发挥作用 我如何将react native与php一起使用并获取json 任何人都可以帮忙吗 PHP myArray array myArray lat POST lat myArray lng POST l

随机推荐

  • 反序列化漏洞

    什么是序列化 序列化 serialize 是将对象的状态信息转换为可以存储或传输的形式的过程 在序列化期间 对象将其当前状态写入到临时或持久性存储区 以后 可以通过从存储区中读取或反序列化对象的状态 重新创建该对象 将状态信息保存为字符串
  • android 开发(一些控件用法)

    1 属性 XML标记内部id语法 android id id button 号表示这是一个新的资源名称 引用Android资源Id时不需要加 但是需要加android命名空间 android id android id button 引用创
  • 算法系列-leetcode-34.二叉树中和为某一值的路径

    剑指 Offer 34 二叉树中和为某一值的路径 中等 给你二叉树的根节点 root 和一个整数目标和 targetSum 找出所有 从根节点到叶子节点 路径总和等于给定目标和的路径 叶子节点 是指没有子节点的节点 示例 1 输入 root
  • 【会议资源】2022年第三届自动化科学与工程国际会议(JCASE 2022)

    2022年第三届自动化科学与工程国际会议 JCASE 2022 重要信息 会议网址 www ijcase org 会议时间 2022年10月14 16日 召开地点 中国成都 截稿时间 2022年8月30日 录用通知 投稿后2周内 收录检索
  • Spring给对象属性赋值的三种注入方式

    bean类 package com zxh model public class Student private String username private String password private Integer id publ
  • 2021年06月学习

    daily plan 2021 06 2021年06月 聊天室代码 https www jianshu com p b4e2a555ef4c https cshihong github io 2017 08 20 E5 9F BA E4 B
  • 第十一届蓝桥杯 D 题——REPEAT程序(文件数据读取与处理)

    前言 蓝桥杯不时会考察对文件的读取和处理 prog txt 解题思路 首先 我们将题目中给出的样例拿出来分析 REPEAT 2 A A 4 REPEAT 5 REPEAT 6 A A 5 A A 7 A A 8 A A 9 可得 式子 与
  • upload-labs详细教程

    目录 第一关 js检查 第二关 Content Type 第三关 黑名单验证 第四关 黑名单验证 htaccess绕过 第五关 黑名单验证 user ini 第六关 空格绕过 第七关 点绕过 第八关 DATA绕过 第九关 空格 绕过 第十一
  • 利用matlab从图片中提取曲线坐标数据

    目录 0 引言 1 思路详解与分析 2 MATLAB程序 0 引言 在读文献的时 经常遇到这样的情况 文章里提出的方法好有趣啊 好想拿文中用的数据来试试看看能不能得到相近的结果 可是文中只有根据原始数据绘制的曲线图 没有数据 如下图所示 此
  • LAMP系统构建论文

    毕业论文中文摘要 随着信息技术的不断发展 网络技术的不断完善 各种服务类平台层出不穷 在这样的环境下 Lamp系统架构应运而生了 并且经过不断的完善 俨然已成为国内外首屈一指的大型服务平台之一 Lamp Linux Apache MySQL
  • vue+阿里的G2图表-antv+折线图

    前言 之前使用的图表是echarts highcharts两个常用图表的 现在的话因为项目需要和别的原因也接触使用了阿里的g2图表 感觉效果还是挺好的 在这里分享下 官网入口 实现效果 实现步骤 第一 安装插件 npm install an
  • VS code 运行C/C++文件

    VS code 运行C C 文件 搞了一下午 搞得头疼 网上的教程五花八门 奈何VS code版本更新太快 于是 就出现了各种bug 就很难受 不过最终终于成功啦 所以做一个简短的小结 防止自己以后再装就忘了 第一步 下载mingw 这个直
  • 计算KL散度与JS散度的MATLAB程序-简单好用

    阅读目录 Content MATLAB小函数 计算KL散度与JS散度 1 MATLAB程序 2 结果 MATLAB程序 计算KL散度与JS散度 问题 给定两个向量 计算这两个向量之间的Kullback Leibler Divergence与
  • Unity之Animation窗口

    一 Animation窗口是用来干啥的 Animation窗口 直译就是动画窗口 它主要用于在Unity内部创建和修改动画 所有在场景中的对象都可以通过Animation窗口为其制作动画 二 打开Animation窗口 Window gt
  • Github上的十大机器学习项目

    原文作者 Matthew Mayo 译文地址 Top 10 Machine Learning Projects on Github 文章译者 赵屹华 搜狗计算广告工程师 前生物医学工程师 关注推荐算法 机器学习领域 文章审校 刘帝伟 Git
  • 学1个月爬虫就月赚6000?别被骗了,我来告诉你真实情况

    这是我前几天看到的一个真实事件 也是我写这篇文章的缘由 前几天有粉丝跟我反馈说 某机构的人跟他说学爬虫1个月就能接单 让这小伙子去报名那个机构的爬虫课程 学完之后1个月就能把6000多的学费赚回来 可能是因为我和粉丝的交流比较多 所以小伙子
  • 2.Python简介、特点、安装配置、pip包管理命令

    Python简介 Python 语言 语言 人与人之间交流需要语言 比如说汉语 英语 编程语言就是人与机器交流的语言 面向过程往面向对象的过渡 例 C C C sharp Java是面向对象 面向过程 面向过程可以认为是流程 一步一步操作
  • HMM隐马尔可夫模型进行中文文本分词

    文章目录 一 HMM简述 1 引入 2 隐马尔科夫模型 1 定义 Definition of a hidden Markov model 2 应用 3 前向算法 了解 4 维特比算法 5 前向 后向算法 了解 二 使用HMM进行文本分类 1
  • [Python系列-14]:人工智能 - 数学基础 -4- 数组元素的线性代数运算(向量、矩阵运算)

    作者主页 文火冰糖的硅基工坊 https blog csdn net HiWangWenBing 本文网址 https blog csdn net HiWangWenBing article details 119301224 目录 第1章
  • Configuring App Transport Security Exceptions in iOS 9 and OSX 10.11

    What is App Transport Security ATS At WWDC 2015 Apple announced App Transport Security for iOS 9 and OSX 10 11 El Capita