Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork33.7k
gh-120522: Apply App Store compliance patch during installation#121947
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
| .PHONY: check-app-store-compliance | ||
| check-app-store-compliance: | ||
| @if [ "$(APP_STORE_COMPLIANCE_PATCH)" != "" ]; then \ | ||
| patch --dry-run --quiet --force --strip 1 --directory "$(abs_srcdir)" --input "$(abs_srcdir)/$(APP_STORE_COMPLIANCE_PATCH)"; \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Some explanation of the choices here:
--dry-runmeans no changes are applied--quietmeans no "patching xyz.py" messages are output--forcemeans no questions are asked of the user, and the patch is assumed to be forward.
| @ # due to files that are missing because of --disable-test-modules etc. | ||
| @if [ "$(APP_STORE_COMPLIANCE_PATCH)" != "" ]; then \ | ||
| echo "Applying app store compliance patch"; \ | ||
| patch --force --reject-file "$(abs_builddir)/app-store-compliance.rej" --strip 2 --directory "$(DESTDIR)$(LIBDEST)" --input "$(abs_srcdir)/$(APP_STORE_COMPLIANCE_PATCH)" || true ; \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Some explanation of the choices here:
--forcemeans no questions are asked of the user, and the patch is assumed to be forward.--reject-fileprovides a file where rejected chunks will be output.
The--reject-file option is required because installing when--disable-test-modules is enabled results in a failure patchingtest/test_urlparse.py - which then fails again because thetest folder doesn't exist, so it can't write a.rej file. If the directorydid exist, there would be a.rej file in the distributed artefact.
.orig files shouldn't be generated because we know the patch applies cleanly as a result of pre-validation.
freakboy3742 commentedJul 18, 2024
An additional note for reviewers: It would be possible to enable checking the patch on macOS whennot installing; but it would require adding another configuration target to differentiate between "apply", and "check but don't apply" cases. Given the additional complexity, and the fact that the patch willalways be applied on iOS, I opted to omit this option - but I'm happy to revisit that. |
freakboy3742 commentedJul 18, 2024
!buildbot iOS |
freakboy3742 commentedJul 18, 2024
The iOS buildbot will fail because of#121832, but the host install stage will show evidence that the patch has been applied. |
freakboy3742 commentedJul 18, 2024
@Yhg1s Could I ask for a release manager's call on back porting this to 3.12? As noted in the PR description, the problemexists in 3.12, but fixing it requires introducing a change to the build process, and it's not really a "security" issue by any conventional measure. |
ned-deily commentedJul 18, 2024
Thanks for pursuing this,@freakboy3742! I will get to reviewing it ASAP but it likely won't be in time for 3.13.0b4 tomorrow. |
itamaro commentedJul 18, 2024
3.12 didn't even celebrate its first birthday yet! afaik it's still well within the "security AND bugfixes" realm. |
ned-deily left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Excellent! This looks really good and this time I wasn't able to think of any other strange configure / make options to try! Thanks for taking so much time and care to try to get this as good as possible. Given the complexity of our Unix builds, it wouldn't be surprising if someone does find another edge case but I think we've done more than our due diligence here.
ned-deily commentedJul 19, 2024
FWIW, I am -0 (maybe even -1) for backporting to 3.12. At several releases in at this point, 3.12 is at a stable point in its lifecycle. Making changes like this to |
freakboy3742 commentedJul 21, 2024
That's a solid enough argument for me. I'll backport to 3.13, but leave it at that. |
Thanks@freakboy3742 for the PR 🌮🎉.. I'm working now to backport this PR to: 3.13. |
…pythonGH-121947)Adds a --with-app-store-compliance configuration option that patches out code known to be an issue with App Store review processes. This option is applied automatically on iOS, and optionally on macOS.(cherry picked from commit728432c)Co-authored-by: Russell Keith-Magee <russell@keith-magee.com>
GH-122105 is a backport of this pull request to the3.13 branch. |
GH-121947) (#122105)gh-120522: Apply App Store compliance patch during installation (GH-121947)Adds a --with-app-store-compliance configuration option that patches out code known to be an issue with App Store review processes. This option is applied automatically on iOS, and optionally on macOS.(cherry picked from commit728432c)Co-authored-by: Russell Keith-Magee <russell@keith-magee.com>
bedevere-bot commentedJul 22, 2024
|
freakboy3742 commentedJul 22, 2024
As far as I can make out, the buildbot failure is a false positive. The code that has been merged won't do anything on non-Apple platforms; and test that is failing doesn't intersect with the change that would have been made. |
…llation (pythonGH-121947) (python#122105)pythongh-120522: Apply App Store compliance patch during installation (pythonGH-121947)Adds a --with-app-store-compliance configuration option that patches out code known to be an issue with App Store review processes. This option is applied automatically on iOS, and optionally on macOS.(cherry picked from commit728432c)Co-authored-by: Russell Keith-Magee <russell@keith-magee.com>
…llation (pythonGH-121947) (python#122105)pythongh-120522: Apply App Store compliance patch during installation (pythonGH-121947)Adds a --with-app-store-compliance configuration option that patches out code known to be an issue with App Store review processes. This option is applied automatically on iOS, and optionally on macOS.(cherry picked from commit728432c)Co-authored-by: Russell Keith-Magee <russell@keith-magee.com>
…llation (pythonGH-121947) (python#122105)pythongh-120522: Apply App Store compliance patch during installation (pythonGH-121947)Adds a --with-app-store-compliance configuration option that patches out code known to be an issue with App Store review processes. This option is applied automatically on iOS, and optionally on macOS.(cherry picked from commit728432c)Co-authored-by: Russell Keith-Magee <russell@keith-magee.com>
…llation (pythonGH-121947) (python#122105)pythongh-120522: Apply App Store compliance patch during installation (pythonGH-121947)Adds a --with-app-store-compliance configuration option that patches out code known to be an issue with App Store review processes. This option is applied automatically on iOS, and optionally on macOS.(cherry picked from commit728432c)Co-authored-by: Russell Keith-Magee <russell@keith-magee.com>
…lation (pythonGH-121947) (python#122105)pythongh-120522: Apply App Store compliance patch during installation (pythonGH-121947)Adds a --with-app-store-compliance configuration option that patches out code known to be an issue with App Store review processes. This option is applied automatically on iOS, and optionally on macOS.(cherry picked from commit728432c)Co-authored-by: Russell Keith-Magee <russell@keith-magee.com>
…llation (pythonGH-121947) (python#122105)pythongh-120522: Apply App Store compliance patch during installation (pythonGH-121947)Adds a --with-app-store-compliance configuration option that patches out code known to be an issue with App Store review processes. This option is applied automatically on iOS, and optionally on macOS.(cherry picked from commit728432c)Co-authored-by: Russell Keith-Magee <russell@keith-magee.com>
…llation (pythonGH-121947) (python#122105)pythongh-120522: Apply App Store compliance patch during installation (pythonGH-121947)Adds a --with-app-store-compliance configuration option that patches out code known to be an issue with App Store review processes. This option is applied automatically on iOS, and optionally on macOS.(cherry picked from commit728432c)Co-authored-by: Russell Keith-Magee <russell@keith-magee.com>
…llation (pythonGH-121947) (python#122105)pythongh-120522: Apply App Store compliance patch during installation (pythonGH-121947)Adds a --with-app-store-compliance configuration option that patches out code known to be an issue with App Store review processes. This option is applied automatically on iOS, and optionally on macOS.(cherry picked from commit728432c)Co-authored-by: Russell Keith-Magee <russell@keith-magee.com>
…llation (pythonGH-121947) (python#122105)pythongh-120522: Apply App Store compliance patch during installation (pythonGH-121947)Adds a --with-app-store-compliance configuration option that patches out code known to be an issue with App Store review processes. This option is applied automatically on iOS, and optionally on macOS.(cherry picked from commit728432c)Co-authored-by: Russell Keith-Magee <russell@keith-magee.com>
…lation (pythonGH-121947) (python#122105)pythongh-120522: Apply App Store compliance patch during installation (pythonGH-121947)Adds a --with-app-store-compliance configuration option that patches out code known to be an issue with App Store review processes. This option is applied automatically on iOS, and optionally on macOS.(cherry picked from commit728432c)Co-authored-by: Russell Keith-Magee <russell@keith-magee.com>
…llation (pythonGH-121947) (python#122105)pythongh-120522: Apply App Store compliance patch during installation (pythonGH-121947)Adds a --with-app-store-compliance configuration option that patches out code known to be an issue with App Store review processes. This option is applied automatically on iOS, and optionally on macOS.(cherry picked from commit728432c)Co-authored-by: Russell Keith-Magee <russell@keith-magee.com>
…lation (pythonGH-121947) (python#122105)pythongh-120522: Apply App Store compliance patch during installation (pythonGH-121947)Adds a --with-app-store-compliance configuration option that patches out code known to be an issue with App Store review processes. This option is applied automatically on iOS, and optionally on macOS.(cherry picked from commit728432c)Co-authored-by: Russell Keith-Magee <russell@keith-magee.com>
…llation (pythonGH-121947) (python#122105)pythongh-120522: Apply App Store compliance patch during installation (pythonGH-121947)Adds a --with-app-store-compliance configuration option that patches out code known to be an issue with App Store review processes. This option is applied automatically on iOS, and optionally on macOS.(cherry picked from commit728432c)Co-authored-by: Russell Keith-Magee <russell@keith-magee.com>
…llation (pythonGH-121947) (python#122105)pythongh-120522: Apply App Store compliance patch during installation (pythonGH-121947)Adds a --with-app-store-compliance configuration option that patches out code known to be an issue with App Store review processes. This option is applied automatically on iOS, and optionally on macOS.(cherry picked from commit728432c)Co-authored-by: Russell Keith-Magee <russell@keith-magee.com>
…llation (pythonGH-121947) (python#122105)pythongh-120522: Apply App Store compliance patch during installation (pythonGH-121947)Adds a --with-app-store-compliance configuration option that patches out code known to be an issue with App Store review processes. This option is applied automatically on iOS, and optionally on macOS.(cherry picked from commit728432c)Co-authored-by: Russell Keith-Magee <russell@keith-magee.com>
Uh oh!
There was an error while loading.Please reload this page.
A revised approach to the change made by#120984 (which was reverted) and#121830, incorporating feedback from the review of those patches.
Apple’s macOS App Store is auto-rejects any app that contains the string
itms-services. This is the custom URL prefix used for requesting an app installation from the iTunes App Store; however, sandboxed apps are prohibited from using these URLs. Apple’s automagical review processes are catching on the code in urllib’s parser’s handling of these URLs - even if the app in question never uses an itms-services:// URL. It’s present in the standard library; therefore the app is rejected.Followinga discussion on discuss.python.org, this PR adds a --with-app-store-compliance option to configure that will patch out any code that is known to be an issue with app store compliance.
There is currently a single patch, in the Mac resources directory, patching the known occurrences of
itms-services. This patch is optionally applied on macOS if the configure flag is enabled, and isalways applied on iOS, because all apps will need to pass App Store compliance.The option allows for a custom patch file to be provided (in case App Store rules change after support for a Python release has ceased). This also allows a platform other than iOS or macOS to apply a "compliance" patch by manually supplying one; although there's no known use case for this at present.
If the use of the patch is configured, a dry-run of the patching is performed early in the build process, against the original sources. This provides early feedback if the patch needs to be updated; if the patch cannot be applied, the build will fail.
The patch is actually applied during the
libinstalltarget. It is applied against the installed library, prior to bytecode compilation.Any errors returned during this patch areignored. This is required because the installed library might be missing files that are included in the patch. If
--disable-test-modulesis configured, any missing files will generate rejected chunks, andpatchwill return an error. However, in our case, we know (as a result of the validation check during the build) that the patchcan be successfully applied against the files thatdo exist, so the only failures must be due to missing files. Any rejected chunks are written to a.rejfile in the build directory.As the patch isalways applied on iOS, we'll get verification if the patch becomes incompatible (admittedly, only during buildbot validation, not during standard GitHub CI).
The underlying problemexists in 3.12, but fixing it requires adding a new build option, which arguably falls outside the "security fixes only" status of 3.12.
Fixes#120522.
📚 Documentation preview 📚:https://cpython-previews--121947.org.readthedocs.build/