-
Notifications
You must be signed in to change notification settings - Fork 4.6k
feat: add warnings for public repository downloads in multiple SDKs #36476
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -280,8 +280,10 @@ def _really_stop_process(process_and_endpoint): | |
| class JavaJarServer(SubprocessServer): | ||
|
|
||
| MAVEN_CENTRAL_REPOSITORY = 'https://repo.maven.apache.org/maven2' | ||
| MAVEN_STAGING_REPOSITORY = 'https://repository.apache.org/content/groups/staging' # pylint: disable=line-too-long | ||
| GOOGLE_MAVEN_MIRROR = 'https://maven-central.storage-download.googleapis.com/maven2' # pylint: disable=line-too-long | ||
| MAVEN_STAGING_REPOSITORY = ( | ||
| 'https://repository.apache.org/content/groups/staging') | ||
| GOOGLE_MAVEN_MIRROR = ( | ||
| 'https://maven-central.storage-download.googleapis.com/maven2') | ||
| BEAM_GROUP_ID = 'org.apache.beam' | ||
| JAR_CACHE = os.path.expanduser("~/.apache_beam/cache/jars") | ||
|
|
||
|
|
@@ -431,6 +433,26 @@ def _download_jar_to_cache( | |
| cached_jar_path (str): The local path where the jar should be cached. | ||
| user_agent (str): The user agent to use when downloading. | ||
| """ | ||
| # Issue warning when downloading from public repositories | ||
| public_repos = [ | ||
| cls.MAVEN_CENTRAL_REPOSITORY, | ||
| cls.GOOGLE_MAVEN_MIRROR, | ||
| ] | ||
|
|
||
| if any(download_url.startswith(repo) for repo in public_repos): | ||
| _LOGGER.warning( | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could logging the destination path (instead of url path) be more helpful in terms of instructing user where to stage the jar?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good idea. Log both now. |
||
| " WARNING: Apache Beam is downloading dependencies from a " | ||
| "public repository at runtime.\n" | ||
| " This may pose security risks or cause instability due to " | ||
| "repository availability.\n" | ||
| " URL: %s\n" | ||
| " Destination: %s\n" | ||
| " Consider pre-staging dependencies or using a private repository " | ||
| "mirror.\n" | ||
| " For more information, see: " | ||
| "https://beam.apache.org/documentation/sdks/python-dependencies/", | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think https://beam.apache.org/documentation/sdks/python-dependencies/ contains relevant information for this manner (for now). But we can add recommendation there
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Agree. Just want to use that as a placeholder. |
||
| download_url, | ||
| cached_jar_path) | ||
| try: | ||
| url_read = FileSystems.open(download_url) | ||
| except ValueError: | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.