Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

App Transport Security blocking loading images #5

Closed
mayankverma opened this issue Feb 24, 2016 · 3 comments
Closed

App Transport Security blocking loading images #5

mayankverma opened this issue Feb 24, 2016 · 3 comments

Comments

@mayankverma
Copy link

Even though this is an https connection to itunes, I am still getting this error. And the images doesn't load. However, if I set "NSAllowsArbitraryLoads" to "YES" it works. I don't want to set it "YES" because of obvious security issues.

How do I get around this?

thanks

@JanC
Copy link
Owner

JanC commented Feb 24, 2016

Hi,
you are right, all the images in the iTunes API have http url:

  "results": [
    {
      "screenshotUrls": [
        "http://a1.mzstatic.com/us/r30/Purple5/v4/5f/1f/6f/5f1f6f60-822f-eada-8378-62e0a1000909/screen1136x1136.jpeg",
        "http://a4.mzstatic.com/us/r30/Purple3/v4/d6/59/d8/d659d88c-ca02-1599-6284-f985184fb08c/screen1136x1136.jpeg",
        "http://a1.mzstatic.com/us/r30/Purple3/v4/56/39/41/5639412f-ab11-144d-e519-57ecf33c37c0/screen1136x1136.jpeg",
        "http://a1.mzstatic.com/us/r30/Purple3/v4/d6/4e/1d/d64e1d95-f61f-b97b-6c2a-ab10e9b5f2dc/screen1136x1136.jpeg"
      ],

Unfortunately, their HTTPs version do not have a valid certificate so it would fail as well

https://a1.mzstatic.com/us/r30/Purple5/v4/5f/1f/6f/5f1f6f60-822f-eada-8378-62e0a1000909/screen1136x1136.jpeg

You could disable ATS only for this domain mzstatic.com but it is not guaranteed that those images will be hosted there all the time

    <key>NSAppTransportSecurity</key>
    <dict>
        <key>NSExceptionDomains</key>
        <dict>
            <key>mzstatic.com</key>
            <dict>
                <key>NSExceptionAllowsInsecureHTTPLoads</key>
                <true/>
                <key>NSIncludesSubdomains</key>
                <true/>
            </dict>
        </dict>
    </dict>

So I think the only way is to enable NSAllowsArbitraryLoads

cheers

@JanC JanC closed this as completed Feb 24, 2016
@JanC JanC reopened this Feb 24, 2016
@mayankverma
Copy link
Author

cool... I tried my own implementation and had same issue... Now I am loading it through my app website so I still have control over my security front... :)

@JanC
Copy link
Owner

JanC commented Feb 24, 2016

cool

@JanC JanC closed this as completed Feb 24, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants