App Transport Securityとローカルネットワーキング/iOSDC Japan 2017

App Transport Securityとローカルネットワーキング/iOSDC Japan 2017

https://iosdc.jp/2017/node/1443

App Transport Securityとローカルネットワーキング
Noritaka Kamiya (@nolili)
App Transport Securityが発表された時、我々は戦慄しました。ローカルネットワーク上のIoTデバイスとHTTPで通信する手段を失ってしまうのです。 ATSを無効にしちゃうのか? それでApp Storeの審査は通るのか? libcurlならいけるのでは? HTTPクライアントを自分たちで作る?
このトークは2年間にわたるApp Transport Securityとの戦い、その記録です。

8e2e0edcf1ffc34e5fbc9ccf7c9a1328?s=128

Noritaka Kamiya

September 16, 2017
Tweet

Transcript

  1. "QQ5SBOTQPSU4FDVSJUZͱ ϩʔΧϧωοτϫʔΩϯά @iOS Developers Conference Japan 2017

  2. /PSJUBLB,BNJZB Twitter/Github @nolili Scrum Master & Software Engineer Ubiregi Inc.

    http://noli.li
  3. None
  4. "HFOEB "QQ5SBOTQPSU4FDVSJUZ "54 ͷ͓͞Β͍ ϩʔΧϧωοτϫʔΩϯάͰͷ໰୊ͱରॲͷه࿥ ϕετϓϥΫςΟεͱམͱ݀͠

  5. "QQ5SBOTQPSU4FDVSJUZ "54 ͷ͓͞Β͍ l"QQ5SBOTQPSU4FDVSJUZ͸σϑΥϧτͷ઀ଓཁ ݅Λنఆ͢ΔػೳͰ͢ɻ͜ΕʹΑΓɺ$'63-·ͨ͸ /463-4FTTJPOͷ֤"1*ͷ࢖༻࣌ʹɺ"QQ͕࠷ྑ ͷํ๏Ͱ҆શͳ઀ଓΛߦ͏͜ͱ͕࣮֬ʹͳΓ·͢ɻl IUUQTJNBHFTBQQMFDPNKQCVTJOFTTEPDT J04@4FDVSJUZ@(VJEFQEG

  6. "QQ5SBOTQPSU4FDVSJUZ "54 ͷ͓͞Β͍ ηΩϡΞͳϓϩτίϧҎ֎͸࢖༻Ͱ͖ͳ͍ ੬ऑͳ҉߸ΞϧΰϦζϜ͸࢖༻Ͱ͖ͳ͍

  7. "QQ5SBOTQPSU4FDVSJUZ "54 ͷ͓͞Β͍ ӨڹΛड͚Δ 63-4FTTJPO $PSF'PVOEBUJPO 8FC7JFXʜ ӨڹΛड͚ͳ͍ 4USFBN #4%TPDLFU

  8. ௚໘ͨ͠໰୊ ϩʔΧϧωοτϫʔΫ಺ʹཱ͍ͬͯΔσόΠε )551 αʔόʔʣͱ௨৴Ͱ͖ͳ͍ʂ σόΠε͸CPOKPVSͰ୳ࡧ͠ɺϗετ໊Ͱ63-Λ࡞੒ ͠ɺ)551Ͱ௨৴

  9. ໰୊ʹͳΔέʔε J1IPOFͱαʔόʢσόΠεʣ͕Ͱ઀ଓ͢Δ ϗετ໊ͰΞΫηε͢Δ *1ΞυϨεͳΒ0, )551 4FSWFS -"/

  10. ໰୊ʹͳΒͳ͍έʔε J1IPOFͱαʔόʢσόΠεʣͷؒʹ8FCαʔϏε͕ ཱ͍ͬͯΔ 4FSWFS FYBNQMFDPN )551 $MJFOU

  11. J04Ͱͷ໰୊ ϩʔΧϧωοτϫʔΫΛྫ֎ʹ͢Δํ๏͕ͳ͔ͬͨ 'PSVNͰૌ͑Δ͕࣮૷ؒʹ߹Θͣ "54Λશͯແޮʹ͢Δ/4"MMPXT"SCJUSBSZ-PBET

  12. ࣌͸ա͗೥ͷ88%$ ݄ "54͕"QQ4UPSFͷཁ݅ͱͳΔ͜ͱ͕Ξφ΢ϯε λΠϜϦϛοτ͸೥຤ Ͳ͏͢Δ

  13. Կ΋͠ͳ͍Ͱઆಘ͢ΔҊ "QQ3FWJFXʹૌ͑Δ ʮզʑͷΞϓϦ͸ϩʔΧϧͷαʔόͱ઀ଓ͢Δඞཁ͕ ͋Δʯ

  14. )551ΫϥΠΞϯτΛ࡞ΔҊ ௿ϨΠϠʔ"1*͸"54ͷӨڹΛड͚ͳ͍ 4XJGUͰ)551ΫϥΠΞϯτΛ࡞ͬͨ

  15. ͢Ͱʹ͋Δ)551ΫϥΠΞϯτΛ࢖͏Ҋ ࣮੷ͷ͋ΔϥΠϒϥϦ͸ͳ͍͔  MJCDVSM CJUDPEFΛग़ྗͰ͖ΔΑ͏ʹϏϧυ͢Δ
 ʢকདྷͷඞਢԽʹඋ͑Δʣ

  16. ຊ໋ͷొ৔ /4"MMPXT-PDBM/FUXPSLJOH

  17. /4"MMPXT-PDBM/FUXPSLJOH 5%-͕MPDBMͷυϝΠϯΛྫ֎ͱͯ͠ڐՄ J04Ҏ্Ͱ༗ޮ J04ͱͷڞଘΛ͢Δ৔߹ /4"MMPXT"SCJUSBSZ-PBETͱͷซ༻͕ඞཁ MPDBMIPTU΋"54ͷྫ֎ͱͳΔ

  18. -(5.ʂ

  19. /4 /FU4FSWJDF /FU4FSWJDFͱ"QQ5SBOTQPSU4FDVSJUZ

  20. /4 /FU4FSWJDF /FU4FSWJDF#SPXTFS /FU4FSWJDFSFTPMWF  /FU4FSWJDFIPTU/BNF

  21. class Browser: NSObject, NetServiceBrowserDelegate, NetServiceDelegate { var serviceBrowser = NetServiceBrowser()

    var services = [NetService]() func start() { serviceBrowser.delegate = self serviceBrowser. searchForServices(ofType: "_http._tcp.", inDomain: "local") } func netServiceBrowser(_ browser: NetServiceBrowser, didFind service: NetService, moreComing: Bool) { services.append(service) service.delegate = self service.resolve(withTimeout: 1.0) } func netServiceDidResolveAddress(_ sender: NetService) { print(sender.hostName!, sender.addresses!) } }
  22. class Browser: NSObject, NetServiceBrowserDelegate, NetServiceDelegate { var serviceBrowser = NetServiceBrowser()

    var services = [NetService]() func start() { serviceBrowser.delegate = self serviceBrowser. searchForServices(ofType: "_http._tcp.", inDomain: "local") } func netServiceBrowser(_ browser: NetServiceBrowser, didFind service: NetService, moreComing: Bool) { services.append(service) service.delegate = self service.resolve(withTimeout: 1.0) } func netServiceDidResolveAddress(_ sender: NetService) { print(sender.hostName!, sender.addresses!) } } NZEFWJDFMPDBM
  23. /4 /FU4FSWJDF IPTU/BNFͷ຤ඌʹSPPUΛ͕ࣔͭ͘͢ ͕͍͍ͭͯΔ63-ͱ͸௨৴ෆՄ ྫNZEFWJDFMPDBM

  24. ϕετϓϥΫςΟε J04Λαϙʔτ͢Δ৔߹ <key>NSAppTransportSecurity</key> <dict> <key>NSAllowsArbitraryLoads</key> <true/> <key>NSAllowsLocalNetworking</key> <true/> </dict>

  25. ϩʔΧϧωοτϫʔΩϯάΛΑΓ҆શʹ͢ΔͨΊʹ ূ໌ॻͷద੾ͳ؅ཧΛߦ͍ɺηΩϡΞͳ઀ଓΛݕ౼͢Δ ࣗݾॺ໊ূ໌ॻΛൃߦͰ͖Δػث΋ొ৔͍ͯ͠Δ

  26. None
  27. Ԇظ "54͕"QQ4UPSFͷཁ݅ͱͳΔ͜ͱ͕Ξφ΢ϯε Ԇظʢ࣍ͷλΠϜϦϛοτ͸ະఆʣ ౰໘͸/4"MMPXT"SCJUSBSZ-PBET͕ڐ͞ΕΔ

  28. 88%$ͷָ͠Έํ 8IBU`TOFXJOTFDVSJUZʢඞݟʣ 1SJWBDZBOE:PVS"QQT ϥϘͰࠔ͍ͬͯΔ͜ͱΛ૬ஊ͢Δ

  29. 3FMBUFE4FTTJPO

  30. ࢀߟจݙͳͲ *OGPSNBUJPO1SPQFSUZ-JTU,FZ3FGFSFODF IUUQTEFWFMPQFSBQQMFDPNMJCSBSZDPOUFOUEPDVNFOUBUJPO(FOFSBM3FGFSFODF *OGP1MJTU,FZ3FGFSFODF"SUJDMFT$PDPB,FZTIUNM "QQ5SBOTQPSU4FDVSJUZBOEMPDBMOFUXPSLJOH IUUQTGPSVNTEFWFMPQFSBQQMFDPNUISFBE #POKPVS0WFS7JFX IUUQTEFWFMPQFSBQQMFDPNMJCSBSZDPOUFOUEPDVNFOUBUJPO$PDPB$PODFQUVBM /FU4FSWJDFT"SUJDMFTEPNBJOOBNFTIUNMBQQMF@SFGEPDVJE5148

  31. "QQ5SBOTQPSU4FDVSJUZͱ ϩʔΧϧωοτϫʔΩϯά @iOS Developers Conference Japan 2017