Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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

Merged
freakboy3742 merged 4 commits intopython:mainfromfreakboy3742:appstore-patch
Jul 21, 2024

Conversation

@freakboy3742
Copy link
Contributor

@freakboy3742freakboy3742 commentedJul 18, 2024
edited by github-actionsbot
Loading

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 stringitms-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 ofitms-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 thelibinstall target. 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-modules is configured, any missing files will generate rejected chunks, andpatch will 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.rej file 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/

erlend-aasland reacted with eyes emoji
@freakboy3742freakboy3742 added OS-mac 3.12only security fixes 3.13bugs and security fixes OS-ios 3.14bugs and security fixes needs backport to 3.13bugs and security fixes labelsJul 18, 2024
.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)"; \
Copy link
ContributorAuthor

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-run means no changes are applied
  • --quiet means no "patching xyz.py" messages are output
  • --force means no questions are asked of the user, and the patch is assumed to be forward.

erlend-aasland reacted with thumbs up emoji
@ # 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 ; \
Copy link
ContributorAuthor

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:

  • --force means no questions are asked of the user, and the patch is assumed to be forward.
  • --reject-file provides 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.

erlend-aasland reacted with thumbs up emoji
@freakboy3742
Copy link
ContributorAuthor

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
Copy link
ContributorAuthor

!buildbot iOS

@freakboy3742
Copy link
ContributorAuthor

The iOS buildbot will fail because of#121832, but the host install stage will show evidence that the patch has been applied.

@freakboy3742
Copy link
ContributorAuthor

@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
Copy link
Member

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.

freakboy3742 reacted with thumbs up emoji

@itamaro
Copy link
Contributor

3.12 didn't even celebrate its first birthday yet! afaik it's still well within the "security AND bugfixes" realm.

Copy link
Member

@ned-deilyned-deily left a 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
Copy link
Member

@Yhg1s Could I ask for a release manager's call on back porting this to 3.12?

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 toconfigure and theMakefile are always a bit risky and, in this case, the affected audience is quite small and has likely already worked around the original App Store review problem with a bespoke patch; it's pretty easy to do and, if so, the additional convenience of an official patch is likely not worth the risk to breaking other uses.

Yhg1s reacted with thumbs up emoji

@freakboy3742
Copy link
ContributorAuthor

@Yhg1s Could I ask for a release manager's call on back porting this to 3.12?

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 toconfigure and theMakefile are always a bit risky and, in this case, the affected audience is quite small and has likely already worked around the original App Store review problem with a bespoke patch; it's pretty easy to do and, if so, the additional convenience of an official patch is likely not worth the risk to breaking other uses.

That's a solid enough argument for me. I'll backport to 3.13, but leave it at that.

ned-deily reacted with thumbs up emoji

@freakboy3742freakboy3742 merged commit728432c intopython:mainJul 21, 2024
@miss-islington-app
Copy link

Thanks@freakboy3742 for the PR 🌮🎉.. I'm working now to backport this PR to: 3.13.
🐍🍒⛏🤖

@freakboy3742freakboy3742 deleted the appstore-patch branchJuly 21, 2024 23:36
miss-islington pushed a commit to miss-islington/cpython that referenced this pull requestJul 21, 2024
…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>
@bedevere-app
Copy link

GH-122105 is a backport of this pull request to the3.13 branch.

@bedevere-appbedevere-appbot removed the needs backport to 3.13bugs and security fixes labelJul 21, 2024
freakboy3742 added a commit that referenced this pull requestJul 22, 2024
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
Copy link

⚠️⚠️⚠️ Buildbot failure⚠️⚠️⚠️

Hi! The buildbots390x Fedora LTO + PGO 3.x has failed when building commit728432c.

What do you need to do:

  1. Don't panic.
  2. Checkthe buildbot page in the devguide if you don't know what the buildbots are or how they work.
  3. Go to the page of the buildbot that failed (https://buildbot.python.org/#builders/545/builds/6225) and take a look at the build logs.
  4. Check if the failure is related to this commit (728432c) or if it is a false positive.
  5. If the failure is related to this commit, please, reflect that on the issue and make a new Pull Request with a fix.

You can take a look at the buildbot page here:

https://buildbot.python.org/#builders/545/builds/6225

Failed tests:

  • test_pyrepl

Failed subtests:

  • test_inspect_keeps_globals_from_inspected_module - test.test_pyrepl.test_pyrepl.TestMain.test_inspect_keeps_globals_from_inspected_module

Summary of the results of the build (if available):

==

Click to see traceback logs
Traceback (most recent call last):  File"/home/dje/cpython-buildarea/3.x.edelsohn-fedora-z.lto-pgo/build/Lib/test/test_pyrepl/test_pyrepl.py", line995, in_run_repl_globals_testself.fail(f"{var}= not found in output")~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^AssertionError:__package__= not found in outputTraceback (most recent call last):  File"/home/dje/cpython-buildarea/3.x.edelsohn-fedora-z.lto-pgo/build/Lib/test/test_pyrepl/test_pyrepl.py", line995, in_run_repl_globals_testself.fail(f"{var}= not found in output")~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^AssertionError:__name__= not found in outputTraceback (most recent call last):  File"/home/dje/cpython-buildarea/3.x.edelsohn-fedora-z.lto-pgo/build/Lib/test/test_pyrepl/test_pyrepl.py", line995, in_run_repl_globals_testself.fail(f"{var}= not found in output")~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^AssertionError:__file__= not found in outputTraceback (most recent call last):  File"/home/dje/cpython-buildarea/3.x.edelsohn-fedora-z.lto-pgo/build/Lib/test/test_pyrepl/test_pyrepl.py", line995, in_run_repl_globals_testself.fail(f"{var}= not found in output")~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^AssertionError:FOO= not found in output

@freakboy3742
Copy link
ContributorAuthor

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.

freakboy3742 added a commit to freakboy3742/cpython that referenced this pull requestJul 30, 2024
…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>
freakboy3742 added a commit to freakboy3742/cpython that referenced this pull requestAug 5, 2024
…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>
freakboy3742 added a commit to freakboy3742/cpython that referenced this pull requestAug 5, 2024
…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>
freakboy3742 added a commit to freakboy3742/cpython that referenced this pull requestAug 5, 2024
…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>
freakboy3742 added a commit to freakboy3742/cpython that referenced this pull requestAug 5, 2024
…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>
freakboy3742 added a commit to freakboy3742/cpython that referenced this pull requestSep 6, 2024
…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>
freakboy3742 added a commit to freakboy3742/cpython that referenced this pull requestSep 9, 2024
…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>
freakboy3742 added a commit to freakboy3742/cpython that referenced this pull requestSep 9, 2024
…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>
freakboy3742 added a commit to freakboy3742/cpython that referenced this pull requestSep 9, 2024
…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>
freakboy3742 added a commit to freakboy3742/cpython that referenced this pull requestSep 9, 2024
…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>
freakboy3742 added a commit to freakboy3742/cpython that referenced this pull requestOct 9, 2024
…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>
freakboy3742 added a commit to freakboy3742/cpython that referenced this pull requestDec 13, 2024
…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>
freakboy3742 added a commit to freakboy3742/cpython that referenced this pull requestDec 13, 2024
…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>
freakboy3742 added a commit to freakboy3742/cpython that referenced this pull requestDec 13, 2024
…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>
freakboy3742 added a commit to freakboy3742/cpython that referenced this pull requestDec 13, 2024
…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>
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@ned-deilyned-deilyned-deily approved these changes

@erlend-aaslanderlend-aaslandAwaiting requested review from erlend-aaslanderlend-aasland is a code owner

@corona10corona10Awaiting requested review from corona10corona10 is a code owner

Assignees

No one assigned

Labels

3.12only security fixes3.13bugs and security fixes3.14bugs and security fixesOS-iosOS-mac

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Python 3.12 change results in Apple App Store rejection

4 participants

@freakboy3742@ned-deily@itamaro@bedevere-bot

[8]ページ先頭

©2009-2025 Movatter.jp