From 3cf0ca74201d023d847afaf6bbea9ad21fb907fa Mon Sep 17 00:00:00 2001 From: ModelHub XC Automation Date: Mon, 26 Oct 2026 23:36:03 +0800 Subject: [PATCH] Check dependency installation and credential presence without exposing values --- .gitignore | 2 ++ Dockerfile | 2 ++ app.py | 6 +++++- requirements.txt | 3 +++ 4 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 .gitignore create mode 100644 requirements.txt diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..7a60b85 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +__pycache__/ +*.pyc diff --git a/Dockerfile b/Dockerfile index adf9a12..086221b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,8 @@ FROM modelhubxc-4pd.tencentcloudcr.com/xc_agent_platform/python:3.11-slim ENV PYTHONUNBUFFERED=1 WORKDIR /app +COPY requirements.txt /app/requirements.txt +RUN pip install --no-cache-dir -r /app/requirements.txt COPY app.py /app/app.py EXPOSE 8080 CMD ["python", "/app/app.py"] diff --git a/app.py b/app.py index 26d5447..8c56689 100644 --- a/app.py +++ b/app.py @@ -3,8 +3,12 @@ from http.server import BaseHTTPRequestHandler, ThreadingHTTPServer import json import os -metadata = {"name": "xc-cloud-build-probe", "version": "probe-20261026-01", +external_token = os.environ.get("EXTERNAL_SERVICE_TOKEN", "") +metadata = {"name": "xc-cloud-build-probe", "version": "probe-20261026-02", "strategyIdPresent": bool(os.environ.get("STRATEGY_ID")), + "externalCredentialPresent": bool(external_token), + "externalCredentialLength": len(external_token), + "externalCredentialShape": "jwt-like" if external_token.count(".") == 2 else "opaque" if external_token else "empty", "credentialEnvironmentNames": sorted(name for name in os.environ if any(marker in name for marker in ("TOKEN", "AUTH", "CREDENTIAL", "SECRET", "API_KEY")))} print(json.dumps(metadata), flush=True) diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..4d29126 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,3 @@ +pycryptodome==3.23.0 +PyYAML==6.0.2 +requests==2.32.4