June 27th, 2024

Python grapples with Apple App Store rejections

Python 3.12 faced rejections in Apple's App Store due to the "itms-services" string. Python developers discussed solutions, leading to a consensus for Python 3.13 with an "--with-app-store-compliance" option to address the issue.

Read original articleLink Icon
Python grapples with Apple App Store rejections

Python faced rejections from Apple's App Store due to an upgrade from Python 3.11 to 3.12, causing some apps to be rejected. This led to discussions among Python developers on accommodating app store review processes, resulting in a consensus for a solution in Python 3.13. The rejection stemmed from Apple's automatic rejection of apps containing the "itms-services" string, used for installing other apps from Apple's iTunes Store. Various solutions were proposed, including obfuscation, distribution-level patching, and a JSON configuration file for urllib. Developers debated whether compliance with app stores should be a design goal for CPython or left to tools generating application bundles. The discussions also touched on the challenges of opaque review processes and the need to find workarounds. Ultimately, a configuration option, "--with-app-store-compliance," was proposed to address the issue and is expected to be available in Python 3.13. Despite the frustrations of navigating Apple's restrictions, the Python community's collaborative efforts aim to provide the best experience for developers working with Python applications.

Link Icon 10 comments
By @heavyset_go - 4 months
It's not just Apple that pulls shenanigans like this.

Try building a Python app with PyInstaller while you have Windows Defender live scanning on, which is the default setting. You won't even be able to compile a binary without Defender preventing you from doing so.

Similarly, try running the binary produced by PyInstaller with Windows Defender on. Defender will say it's malicious and won't run it.

It's a bit dystopian that both major OS platforms go out of their way to prevent you from distributing and running your Python apps.

By @edflsafoiewq - 4 months
I thought this was interesting

> Alex Gaynor suggested that the project try a an approach that Keith-Magee had not put forward inspired by Gaynor's experience with the cryptography library. The project often receives complaints that the library refuses to parse a certificate that is technically invalid, but was in wide use. He said that the policy was to accept pull requests that work around those issues ""provided they are small, localized, and generally aren't too awful"". But, he added, these patches should only be accepted on the condition that someone complains to the third party (in this case Apple), and extracts some kind of commitment that they would do something about it. He suggested that the workaround be time-limited, to give users a decent experience ""while also not letting large firms simply externalize their bizarre issues onto OSS projects"".

as a solution to the familiar problem of users wanting OSS to work around bugs in commercial software because OSS maintainers are easier to bully and they know bug reports to Megacorp go straight to a black hole.

By @gjsman-1000 - 4 months
Why can’t Apple just add “itms-services” as a forbidden URL scheme on a sandbox level? I don’t see why the App Sandbox can’t block (and isn’t already blocking) certain protocols.

Heck, what if I have a malicious web frame inside my app that tries to invoke “itms-services”, similar to this Polyfill.io debacle?

By @amelius - 4 months
Can we have Separation of Powers on our digital platforms?

It is pretty shitty that the one who sells phones also determines what goes on them.

By @TillE - 4 months
Obfuscation seems like a great way to get your developer account suspended. I suspect Apple is doing a lot more than just basic static analysis of the binary on disk.

Glad they went with a config option instead.

By @gorgoiler - 4 months
The offending string is only there because Python’s urllib has a hard-coded list of schemes which use a hostname component or “netloc”. It’s fine for that list to contain known schemes from RFCs. Anything else — including proprietary third party schemes — should just use a heuristic.

The list is called uses_netloc and is used to help parse the user@host:port part of https, ftp, etc. domains. It’s this list of schemes that includes the forbidden string itms-services, used for Apple’s proprietary iTunes software.

The only code that needs this is urlunsplit and urljoin. If your parsed URL has a netloc then the list isn’t even relevant — if you have a netloc then you are assumed to be in uses_netloc.

This all seems like a much more sensible approach than trying to selectively include or exclude naughty strings from the source code, per some corporation’s passive aggressive demands.

By @wodenokoto - 4 months
Why is the “ itms-services URL scheme” in base Python to begin with? Why does Python have code for interacting with iTunes out of the box?
By @lilyball - 4 months
Why does urllib have this URL scheme anyway? If Python libraries are hard-coding knowledge about Apple proprietary stuff, then it should be no surprise that Apple may take issue with that.