github-advanced-security[bot] commented on code in PR #836: URL: https://github.com/apache/hugegraph-toolchain/pull/836#discussion_r4351653434
########## hugegraph-hubble/hubble-dist/assembly/travis/vermeer_dev.py: ########## @@ -0,0 +1,360 @@ +#!/usr/bin/env python3 +# 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. + +"""Retained cloud development environment: Hubble + Vermeer + HugeGraph hstore.""" + +import argparse +import hashlib +import json +import math +import os +from pathlib import Path +import secrets +import shutil +import signal +import socket +import subprocess +import tarfile +import time +import urllib.request + +REPO = Path(__file__).resolve().parents[4] +SETUP = Path(os.environ.get('VERMEER_DEV_HOME', '/workspace/.onboarding')) +RUN = SETUP / 'integration' +SOURCE = Path(os.environ.get('VERMEER_SOURCE_DIR', str(REPO.parent / 'hugegraph-computer/vermeer'))) +GO = SETUP / 'tools/go1.23.7' +COMPUTER_COMMIT = '090bf276e2c7860c292f317c3569559034621c21' +IMAGES = { + 'pd': 'hugegraph/pd@sha256:1ca2c236cba50ac27f47e9db4c9a44f1f50bb9df85a07e837b7c25ba7a2704a8', + 'store': 'hugegraph/store@sha256:1cc8d6a1e1624328b91e5346731b57c68569de435400981ff7287150ae63651c', + 'server': 'hugegraph/server@sha256:14b00b6edab43560c630326016e3a07579cc2a30b045b7edd3dc1c62a1ef1d98', +} +HUBBLE = 'http://127.0.0.1:8088' +VERMEER = os.environ.get('VERMEER_URL', 'http://127.0.0.1:6688') +API = HUBBLE + '/api/v1.3' +GRAPH_NAME = os.environ.get('VERMEER_GRAPH', 'vermeer_demo') +GRAPH = API + '/graphspaces/DEFAULT/graphs/' + GRAPH_NAME + + +def environment(): + env = os.environ.copy() + env.update({ + 'JAVA_HOME': str(SETUP / 'tools/jdk17'), + 'PATH': f'{GO}/bin:{SETUP}/bin:{SETUP}/tools/jdk17/bin:' + env['PATH'], + 'GOTOOLCHAIN': 'local', + 'GOPATH': env.get('GOPATH', str(SETUP / 'go')), + 'GOMODCACHE': env.get('GOMODCACHE', str(SETUP / 'go-mod')), + 'GOCACHE': env.get('GOCACHE', str(SETUP / 'go-build')), + }) + return env + + +def command(args, cwd=REPO, **kwargs): + return subprocess.run([str(x) for x in args], cwd=cwd, env=environment(), + check=True, **kwargs) + + +def request(url, method='GET', data=None, hubble=False): + body = None if data is None else json.dumps(data).encode() + opener = urllib.request.build_opener(urllib.request.ProxyHandler({})) + req = urllib.request.Request(url, data=body, method=method, + headers={'Content-Type': 'application/json'}) + with opener.open(req, timeout=35) as response: + payload = response.read() + value = json.loads(payload) if payload else {'ready': True} + if hubble: + if value.get('status') != 200: + raise RuntimeError(f'{url}: {value.get("message")}') + return value['data'] + if value.get('errcode', 0) != 0: + raise RuntimeError(f'{url}: {value.get("message")}') + return value + + +def wait_ready(check, name, seconds=120): + deadline = time.monotonic() + seconds + error = None + while time.monotonic() < deadline: + try: + value = check() + if value: + print(f'{name}: ready', flush=True) + return value + except Exception as exc: + error = exc + time.sleep(1) + raise RuntimeError(f'{name} did not become ready: {error}; inspect {RUN}') + + +def private_file(path, value): + path.parent.mkdir(parents=True, exist_ok=True) + with open(path, 'w', opener=lambda p, flags: os.open(p, flags, 0o600)) as output: + output.write(value) Review Comment: ## CodeQL / Clear-text storage of sensitive information This expression stores [sensitive data (password)](1) as clear text. This expression stores [sensitive data (secret)](2) as clear text. [Show more details](https://github.com/apache/hugegraph-toolchain/security/code-scanning/32) -- 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] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
