The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]
Python ai-gatewayanthropicazure-openaibedrockgatewaylangchainlitellmllmllm-gatewayllmopsmcp-gatewayopenaiopenai-proxyrustrust-aivertex-ai
fix(ci): mask only credential-length values in the e2e-changed log
mateo-berri5a06845db18a
diff --git a/.github/e2e-stack/secrets_to_env.py b/.github/e2e-stack/secrets_to_env.pyindex 99e717b271d..e7870a32e42 100644--- a/.github/e2e-stack/secrets_to_env.py+++ b/.github/e2e-stack/secrets_to_env.py@@ -8,6 +8,7 @@ from pydantic import TypeAdapter, ValidationErrorsecrets_adapter: Final[TypeAdapter[dict[str, str]]] = TypeAdapter(dict[str, str])ENV_NAME: Final = re.compile(r"[A-Za-z_][A-Za-z0-9_]*")+MIN_MASKED_LENGTH: Final = 8def main() -> int:@@ -25,7 +26,7 @@ def main() -> int:_ = sys.stderr.write("environment names or values cannot be represented in both bash and dotenv\n")return 1for value in secrets.values():- if value:+ if len(value) >= MIN_MASKED_LENGTH:_ = sys.stdout.write(f"::add-mask::{value.replace('%', '%25')}\n")sys.stdout.flush()lines: Final = tuple(f"{key}='{value}'" for key, value in secrets.items() if value)diff --git a/tests/code_coverage_tests/test_e2e_changed_gate.py b/tests/code_coverage_tests/test_e2e_changed_gate.pyindex 7a82a8ebb60..2e95c33cf20 100644--- a/tests/code_coverage_tests/test_e2e_changed_gate.py+++ b/tests/code_coverage_tests/test_e2e_changed_gate.py@@ -7,6 +7,7 @@ from typing import Finalimport pytestGATE: Final = Path(__file__).resolve().parents[2] / ".github/e2e-stack/assert_tests_ran.py"+SECRETS_TO_ENV: Final = GATE.with_name("secrets_to_env.py")SELECTED: Final = ("tests/e2e/access_control/test_a.py", "tests/e2e/access_control/test_b.py")@@ -53,3 +54,18 @@ def test_missing_execution_evidence_fails(tmp_path: Path, contents: str) -> Noneresult: Final = subprocess.run([sys.executable, str(GATE), str(report), *SELECTED], capture_output=True, text=True)assert result.returncode == 1+++def test_short_values_are_written_without_masking_every_digit_in_the_log(tmp_path: Path) -> None:+ env_path: Final = tmp_path / ".env"++ result: Final = subprocess.run(+ [sys.executable, str(SECRETS_TO_ENV), str(env_path)],+ input='{"FLAG": "1", "API_KEY": "sk-0123456789abcdef"}',+ capture_output=True,+ text=True,+ )++ assert result.returncode == 0, result.stderr+ assert result.stdout == "::add-mask::sk-0123456789abcdef\n"+ assert env_path.read_text() == "FLAG='1'\nAPI_KEY='sk-0123456789abcdef'\n"diff --git a/tests/e2e/CONTRIBUTING.md b/tests/e2e/CONTRIBUTING.mdindex 7b90b9de5c8..0b8859d9260 100644--- a/tests/e2e/CONTRIBUTING.md+++ b/tests/e2e/CONTRIBUTING.md@@ -64,7 +64,7 @@ Repository admins must require the `e2e-changed-tests` status check for mergingCredentials come from the existing AWS Secrets Manager secrets in us-east-1, `litellm-e2e-changed-provider-keys` and `litellm-e2e-changed-license`. The OIDC role must trust only `repo:BerriAI/litellm:environment:e2e-changed` with audience `sts.amazonaws.com` and have read access only to these secrets. The short-lived reader credentials are scoped to the fetch step. Provider credentials must cover the selected suites, including Datadog credentials when logging or MCP tests need them; missing credentials fail the run. `up.sh` refuses to start without `DD_API_KEY`, because the stack's gateway config enables the Datadog callback for every run and a gateway booted without the key fails readiness. Keep provider credentials dedicated to this lane with only the permissions those tests need-Fetched values are masked before use, and credential files and raw output are private to the runner. Public logs contain selected file names, counts, and pass status; raw pytest output, reports, and stack logs are not uploaded or printed. The workflow removes them and the credential files during cleanup. To diagnose a failed pass, reproduce the selected files locally with the appropriate credentials and inspect the local logs+Fetched values of eight characters or more are masked before use, while shorter values such as flags stay unmasked because masking a one-character value would blank every matching digit in the log, and credential files and raw output are private to the runner. Public logs contain selected file names, counts, and pass status; raw pytest output, reports, and stack logs are not uploaded or printed. The workflow removes them and the credential files during cleanup. To diagnose a failed pass, reproduce the selected files locally with the appropriate credentials and inspect the local logsTo reproduce the CI topology on a dedicated machine, `bash .github/e2e-stack/up.sh` reads `tests/e2e/.env`, writes `stack.env` under `${E2E_STACK_DIR:-/tmp/litellm-e2e-stack}`, and `bash .github/e2e-stack/down.sh` stops it. Keep this directory private and remove its credential files and logs after use