Skip to content

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]

[Fix] Move Postgres DATABASE_URL to environment secret to avoid credential leak warnings

Yuneng Jiangd42e2f642911
diff --git a/.github/workflows/_test-unit-services-base.yml b/.github/workflows/_test-unit-services-base.yml
index 86f51173be3..042008f24a8 100644
--- a/.github/workflows/_test-unit-services-base.yml
+++ b/.github/workflows/_test-unit-services-base.yml
@@ -44,6 +44,8 @@ on:
required: false
REDIS_PASSWORD:
required: false
+ DATABASE_URL:
+ required: false
permissions:
contents: read
@@ -53,9 +55,15 @@ jobs:
name: Run tests
runs-on: ubuntu-latest
timeout-minutes: ${{ inputs.timeout-minutes }}
- # Environment is derived from enable-redis, not caller-controllable.
+ # Environment is derived from the enable-* flags, not caller-controllable.
# This prevents callers from passing arbitrary environment names to bypass secret scoping.
- environment: ${{ inputs.enable-redis && 'integration-redis' || '' }}
+ environment: >-
+ ${{
+ (inputs.enable-redis && inputs.enable-postgres) && 'integration-redis-postgres' ||
+ inputs.enable-redis && 'integration-redis' ||
+ inputs.enable-postgres && 'integration-postgres' ||
+ ''
+ }}
services:
postgres:
@@ -117,7 +125,7 @@ jobs:
- name: Run Prisma migrations
if: ${{ inputs.enable-postgres }}
env:
- DATABASE_URL: "postgresql://postgres:postgres@localhost:5432/litellm_test"
+ DATABASE_URL: ${{ secrets.DATABASE_URL }}
run: |
poetry run prisma db push --schema litellm/proxy/schema.prisma --accept-data-loss
@@ -127,7 +135,7 @@ jobs:
MAX_FAILURES: ${{ inputs.max-failures }}
WORKERS: ${{ inputs.workers }}
RERUNS: ${{ inputs.reruns }}
- DATABASE_URL: ${{ inputs.enable-postgres && 'postgresql://postgres:postgres@localhost:5432/litellm_test' || '' }}
+ DATABASE_URL: ${{ inputs.enable-postgres && secrets.DATABASE_URL || '' }}
REDIS_HOST: ${{ inputs.enable-redis && secrets.REDIS_HOST || '' }}
REDIS_PORT: ${{ inputs.enable-redis && secrets.REDIS_PORT || '' }}
REDIS_PASSWORD: ${{ inputs.enable-redis && secrets.REDIS_PASSWORD || '' }}
diff --git a/.github/workflows/test-unit-proxy-db.yml b/.github/workflows/test-unit-proxy-db.yml
index 0231da3f6e4..db0eef1cf66 100644
--- a/.github/workflows/test-unit-proxy-db.yml
+++ b/.github/workflows/test-unit-proxy-db.yml
@@ -1,8 +1,7 @@
name: "Unit Tests: Proxy DB Operations"
+# Uses DATABASE_URL secret — only runs on trusted branches, not PRs.
on:
- pull_request:
- branches: [main]
push:
branches: [main, "litellm_*"]
@@ -10,7 +9,7 @@ permissions:
contents: read
concurrency:
- group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
+ group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
@@ -40,3 +39,5 @@ jobs:
timeout-minutes: ${{ matrix.timeout }}
enable-redis: false
enable-postgres: true
+ secrets:
+ DATABASE_URL: ${{ secrets.DATABASE_URL }}
diff --git a/.github/workflows/test-unit-security.yml b/.github/workflows/test-unit-security.yml
index 63eed494a73..1a08608740a 100644
--- a/.github/workflows/test-unit-security.yml
+++ b/.github/workflows/test-unit-security.yml
@@ -1,8 +1,7 @@
name: "Unit Tests: Security"
+# Uses DATABASE_URL secret — only runs on trusted branches, not PRs.
on:
- pull_request:
- branches: [main]
push:
branches: [main, "litellm_*"]
@@ -10,7 +9,7 @@ permissions:
contents: read
concurrency:
- group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
+ group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
@@ -23,3 +22,5 @@ jobs:
timeout-minutes: 20
enable-redis: false
enable-postgres: true
+ secrets:
+ DATABASE_URL: ${{ secrets.DATABASE_URL }}