github-advanced-security[bot] commented on code in PR #59558: URL: https://github.com/apache/airflow/pull/59558#discussion_r2683303017
########## providers/google/src/airflow/providers/google/cloud/hooks/ray.py: ########## @@ -0,0 +1,223 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +"""This module contains a Google Cloud Ray Job hook.""" + +from __future__ import annotations + +from typing import TYPE_CHECKING, Any + +from ray.job_submission import JobSubmissionClient + +from airflow.providers.google.common.hooks.base_google import GoogleBaseHook + +if TYPE_CHECKING: + from ray.dashboard.modules.job.common import JobStatus + from ray.dashboard.modules.job.pydantic_models import JobDetails + + +class RayJobHook(GoogleBaseHook): + """Hook for Jobs APIs.""" + + def get_client(self, address: str): + """ + Create a client for submitting and interacting with jobs on a remote cluster. + + :param address: Either (1) the address of the Ray cluster, or (2) the HTTP address + of the dashboard server on the head node, e.g. "http://<head-node-ip>:8265". + In case (1) it must be specified as an address that can be passed to + ray.init(), e.g. a Ray Client address (ray://<head_node_host>:10001), + or "auto", or "localhost:<port>". + """ + if address.endswith("aiplatform-training.googleusercontent.com"): Review Comment: ## Incomplete URL substring sanitization The string [aiplatform-training.googleusercontent.com](1) may be at an arbitrary position in the sanitized URL. [Show more details](https://github.com/apache/airflow/security/code-scanning/563) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
